├── ProcessMonitor.App
├── Images
│ ├── add.png
│ ├── Icon.ico
│ ├── clear.png
│ ├── exit.png
│ ├── remove.png
│ ├── reset.png
│ ├── start.png
│ ├── stop.png
│ ├── update.png
│ ├── connect.png
│ └── disconnect.png
├── Presenters
│ ├── IPresenter.cs
│ ├── AddToWatchPresenter.cs
│ └── MainPresenter.cs
├── App.xaml
├── Views
│ ├── IConnectView.cs
│ ├── IView.cs
│ ├── IAddToWatchView.cs
│ ├── IMainView.cs
│ ├── AboutView.xaml
│ ├── AboutView.xaml.cs
│ ├── ConnectView.xaml
│ ├── AddToWatchView.xaml
│ ├── ConnectView.xaml.cs
│ ├── AddToWatchView.xaml.cs
│ ├── MainView.xaml
│ └── MainView.xaml.cs
├── Service References
│ └── MonitorService
│ │ ├── Message1.xsd
│ │ ├── Arrays.xsd
│ │ ├── ProcessMonitor1.xsd
│ │ ├── configuration.svcinfo
│ │ ├── Reference.svcmap
│ │ ├── service21.xsd
│ │ ├── service2.xsd
│ │ ├── Reference.cs
│ │ ├── service1.wsdl
│ │ └── configuration91.svcinfo
├── ViewModels
│ ├── ViewModelBase.cs
│ └── WatchProcessViewModel.cs
├── Properties
│ ├── DataSources
│ │ └── ProcessMonitor.WatchProcess.datasource
│ └── AssemblyInfo.cs
├── App.config
├── App.xaml.cs
├── Command
│ └── RelayCommand.cs
└── ProcessMonitor.App.csproj
├── ProcessMonitor.Service
├── !install.bat
├── !uninstall.bat
├── Program.cs
├── ProjectInstaller.cs
├── App.config
├── Properties
│ └── AssemblyInfo.cs
├── MonitorService.cs
└── ProcessMonitor.Service.csproj
├── .gitignore
├── ProcessMonitor.Installer
├── Variables.wxi
├── Shortcuts.wxs
├── Features.wxs
├── Product.wxs
├── Files.wxs
├── ProcessMonitor.Installer.wixproj
└── License.rtf
├── .gitattributes
├── README.md
├── ProcessMonitor
├── IMonitor.cs
├── App.config
├── Properties
│ └── AssemblyInfo.cs
├── WatchProcess.cs
├── ProcessMonitor.csproj
└── Monitor.cs
├── ProcessMonitor.ConsoleApp
├── App.config
├── Properties
│ └── AssemblyInfo.cs
├── Program.cs
└── ProcessMonitor.ConsoleApp.csproj
└── ProcessMonitor.sln
/ProcessMonitor.App/Images/add.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sys27/ProcessMonitor/HEAD/ProcessMonitor.App/Images/add.png
--------------------------------------------------------------------------------
/ProcessMonitor.App/Images/Icon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sys27/ProcessMonitor/HEAD/ProcessMonitor.App/Images/Icon.ico
--------------------------------------------------------------------------------
/ProcessMonitor.App/Images/clear.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sys27/ProcessMonitor/HEAD/ProcessMonitor.App/Images/clear.png
--------------------------------------------------------------------------------
/ProcessMonitor.App/Images/exit.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sys27/ProcessMonitor/HEAD/ProcessMonitor.App/Images/exit.png
--------------------------------------------------------------------------------
/ProcessMonitor.App/Images/remove.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sys27/ProcessMonitor/HEAD/ProcessMonitor.App/Images/remove.png
--------------------------------------------------------------------------------
/ProcessMonitor.App/Images/reset.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sys27/ProcessMonitor/HEAD/ProcessMonitor.App/Images/reset.png
--------------------------------------------------------------------------------
/ProcessMonitor.App/Images/start.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sys27/ProcessMonitor/HEAD/ProcessMonitor.App/Images/start.png
--------------------------------------------------------------------------------
/ProcessMonitor.App/Images/stop.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sys27/ProcessMonitor/HEAD/ProcessMonitor.App/Images/stop.png
--------------------------------------------------------------------------------
/ProcessMonitor.App/Images/update.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sys27/ProcessMonitor/HEAD/ProcessMonitor.App/Images/update.png
--------------------------------------------------------------------------------
/ProcessMonitor.App/Images/connect.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sys27/ProcessMonitor/HEAD/ProcessMonitor.App/Images/connect.png
--------------------------------------------------------------------------------
/ProcessMonitor.App/Images/disconnect.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sys27/ProcessMonitor/HEAD/ProcessMonitor.App/Images/disconnect.png
--------------------------------------------------------------------------------
/ProcessMonitor.Service/!install.bat:
--------------------------------------------------------------------------------
1 | C:\Windows\Microsoft.NET\Framework\v4.0.30319\installutil ProcessMonitor.Service.exe
2 | net start MonitorService
3 | pause
--------------------------------------------------------------------------------
/ProcessMonitor.Service/!uninstall.bat:
--------------------------------------------------------------------------------
1 | net stop MonitorService
2 | C:\Windows\Microsoft.NET\Framework\v4.0.30319\installutil /u ProcessMonitor.Service.exe
3 | pause
--------------------------------------------------------------------------------
/ProcessMonitor.App/Presenters/IPresenter.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace ProcessMonitor.App.Presenters
8 | {
9 |
10 | public interface IPresenter
11 | {
12 |
13 | }
14 |
15 | }
16 |
--------------------------------------------------------------------------------
/ProcessMonitor.App/App.xaml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | [Bb]in/
2 | [Oo]bj/
3 | [Dd]ebug/
4 | [Rr]elease/
5 | TestResults
6 | packages
7 |
8 | *.com
9 | *.dll
10 | *.exe
11 | *.pdb
12 | *.obj
13 |
14 | *.zip
15 | *.log
16 |
17 | *.mdf
18 | *.ldf
19 | *.suo
20 | *.vssscc
21 | *.vspscc
22 | *.psess
23 | *.vsp
24 | *.user
25 | *.nupkg
26 | *.nuspec
27 | *.diff
28 | *.design
29 | *.pfx
30 |
31 | Thumbs.db
--------------------------------------------------------------------------------
/ProcessMonitor.Installer/Variables.wxi:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/ProcessMonitor.App/Views/IConnectView.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace ProcessMonitor.App.Views
8 | {
9 |
10 | public interface IConnectView : IView
11 | {
12 |
13 | string Server { get; set; }
14 |
15 | }
16 |
17 | }
18 |
--------------------------------------------------------------------------------
/ProcessMonitor.App/Views/IView.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using ProcessMonitor.App.Presenters;
7 |
8 | namespace ProcessMonitor.App.Views
9 | {
10 |
11 | public interface IView
12 | {
13 |
14 | IPresenter Presenter { get; set; }
15 |
16 | }
17 |
18 | }
19 |
--------------------------------------------------------------------------------
/ProcessMonitor.App/Service References/MonitorService/Message1.xsd:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
--------------------------------------------------------------------------------
/ProcessMonitor.App/Views/IAddToWatchView.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace ProcessMonitor.App.Views
8 | {
9 |
10 | public interface IAddToWatchView : IView
11 | {
12 |
13 | void SetAllProcesses(IEnumerable processes);
14 | string Process { get; set; }
15 |
16 | }
17 |
18 | }
19 |
--------------------------------------------------------------------------------
/ProcessMonitor.Service/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.ServiceProcess;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 |
8 | namespace ProcessMonitor.Service
9 | {
10 |
11 | static class Program
12 | {
13 |
14 | static void Main()
15 | {
16 | ServiceBase.Run(new MonitorService());
17 | }
18 |
19 | }
20 |
21 |
22 | }
23 |
--------------------------------------------------------------------------------
/ProcessMonitor.App/Views/IMainView.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using ProcessMonitor.App.ViewModels;
7 |
8 | namespace ProcessMonitor.App.Views
9 | {
10 |
11 | public interface IMainView : IView
12 | {
13 |
14 | void ShowError(string message);
15 | void SetWatchList(IEnumerable watchList);
16 | void SetTotalTime(string time);
17 |
18 | }
19 |
20 | }
21 |
--------------------------------------------------------------------------------
/ProcessMonitor.App/ViewModels/ViewModelBase.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.ComponentModel;
3 |
4 | namespace ProcessMonitor.App.ViewModels
5 | {
6 |
7 | public abstract class ViewModelBase : INotifyPropertyChanged
8 | {
9 |
10 | public event PropertyChangedEventHandler PropertyChanged;
11 |
12 | protected virtual void OnPropertyChanged(string property)
13 | {
14 | if (PropertyChanged != null)
15 | PropertyChanged(this, new PropertyChangedEventArgs(property));
16 | }
17 |
18 | }
19 |
20 | }
--------------------------------------------------------------------------------
/ProcessMonitor.App/Views/AboutView.xaml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/.gitattributes:
--------------------------------------------------------------------------------
1 | # Auto detect text files and perform LF normalization
2 | * text=auto
3 |
4 | # Custom for Visual Studio
5 | *.cs diff=csharp
6 | *.sln merge=union
7 | *.csproj merge=union
8 | *.vbproj merge=union
9 | *.fsproj merge=union
10 | *.dbproj merge=union
11 |
12 | # Standard to msysgit
13 | *.doc diff=astextplain
14 | *.DOC diff=astextplain
15 | *.docx diff=astextplain
16 | *.DOCX diff=astextplain
17 | *.dot diff=astextplain
18 | *.DOT diff=astextplain
19 | *.pdf diff=astextplain
20 | *.PDF diff=astextplain
21 | *.rtf diff=astextplain
22 | *.RTF diff=astextplain
23 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | ProcessMonitor
2 | =====
3 | ProcessMonitor is desktop app that allows you to watch processes. It has a service that can be installed on a remote computer and you can connect to this service via WCF and monitors running processes. Also it has installer that installs the service and the desktop app. All code is written on C#.
4 |
5 | ### Structure of projects
6 |
7 | 1. ProcessMonitor.App - a desktop app.
8 | 2. ProcessMonitor.ConsoleApp - a console app.
9 | 3. ProcessMonitor.Installer - a WiX installer.
10 | 4. ProcessMonitor.Service - a WCF service.
11 | 5. ProcessMonitor - a shared library with code.
12 |
--------------------------------------------------------------------------------
/ProcessMonitor.App/Service References/MonitorService/Arrays.xsd:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/ProcessMonitor.App/Properties/DataSources/ProcessMonitor.WatchProcess.datasource:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 | ProcessMonitor.WatchProcess, ProcessMonitor, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
10 |
--------------------------------------------------------------------------------
/ProcessMonitor.App/Views/AboutView.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using System.Windows;
7 | using System.Windows.Controls;
8 | using System.Windows.Data;
9 | using System.Windows.Documents;
10 | using System.Windows.Input;
11 | using System.Windows.Media;
12 | using System.Windows.Media.Imaging;
13 | using System.Windows.Shapes;
14 | using ProcessMonitor.App.Presenters;
15 |
16 | namespace ProcessMonitor.App.Views
17 | {
18 |
19 | public partial class AboutView : Window
20 | {
21 |
22 | public AboutView()
23 | {
24 | InitializeComponent();
25 | }
26 |
27 | }
28 |
29 | }
30 |
--------------------------------------------------------------------------------
/ProcessMonitor.App/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
19 |
20 |
--------------------------------------------------------------------------------
/ProcessMonitor.App/App.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Configuration;
4 | using System.Data;
5 | using System.Linq;
6 | using System.Threading.Tasks;
7 | using System.Windows;
8 | using ProcessMonitor.App.Presenters;
9 | using ProcessMonitor.App.Views;
10 |
11 | namespace ProcessMonitor.App
12 | {
13 |
14 | public partial class App : Application
15 | {
16 |
17 | protected override void OnStartup(StartupEventArgs e)
18 | {
19 | Dispatcher.UnhandledException += (o, args) =>
20 | #if DEBUG
21 | MessageBox.Show(args.Exception.ToString());
22 | #else
23 | MessageBox.Show(args.Exception.Message);
24 | #endif
25 |
26 | MainView mainView = new MainView();
27 | MainPresenter presenter = new MainPresenter(mainView);
28 | //mainView.Presenter = presenter;
29 | mainView.Show();
30 | //base.OnStartup(e);
31 | }
32 |
33 | }
34 |
35 | }
36 |
--------------------------------------------------------------------------------
/ProcessMonitor.App/Views/ConnectView.xaml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/ProcessMonitor.App/Service References/MonitorService/ProcessMonitor1.xsd:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/ProcessMonitor.Installer/Shortcuts.wxs:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
14 |
15 |
--------------------------------------------------------------------------------
/ProcessMonitor.Service/ProjectInstaller.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections;
3 | using System.Collections.Generic;
4 | using System.ComponentModel;
5 | using System.Configuration.Install;
6 | using System.Linq;
7 | using System.ServiceProcess;
8 | using System.Threading.Tasks;
9 |
10 | namespace ProcessMonitor.Service
11 | {
12 |
13 | [RunInstaller(true)]
14 | public class ProjectInstaller : Installer
15 | {
16 |
17 | private ServiceProcessInstaller serviceProcessInstaller;
18 | private ServiceInstaller serviceInstaller;
19 |
20 | public ProjectInstaller()
21 | {
22 | serviceProcessInstaller = new ServiceProcessInstaller()
23 | {
24 | Account = ServiceAccount.LocalSystem
25 | };
26 | serviceInstaller = new ServiceInstaller()
27 | {
28 | DisplayName = "Process Monitor",
29 | ServiceName = "MonitorService",
30 | StartType = ServiceStartMode.Automatic
31 | };
32 | Installers.AddRange(new Installer[] { serviceProcessInstaller, serviceInstaller });
33 | }
34 |
35 | }
36 |
37 | }
38 |
--------------------------------------------------------------------------------
/ProcessMonitor.App/ViewModels/WatchProcessViewModel.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace ProcessMonitor.App.ViewModels
8 | {
9 |
10 | public class WatchProcessViewModel : ViewModelBase
11 | {
12 |
13 | private string process;
14 | private string time;
15 |
16 | public WatchProcessViewModel(string process, string milliseconds)
17 | {
18 | this.process = process;
19 | this.time = milliseconds;
20 | }
21 |
22 | public string Process
23 | {
24 | get
25 | {
26 | return process;
27 | }
28 | set
29 | {
30 | process = value;
31 | OnPropertyChanged("Process");
32 | }
33 | }
34 |
35 | public string Milliseconds
36 | {
37 | get
38 | {
39 | return time;
40 | }
41 | set
42 | {
43 | time = value;
44 | OnPropertyChanged("Milliseconds");
45 | }
46 | }
47 |
48 | }
49 |
50 | }
51 |
--------------------------------------------------------------------------------
/ProcessMonitor.App/Presenters/AddToWatchPresenter.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using System.Windows.Input;
7 | using ProcessMonitor.App.Command;
8 | using ProcessMonitor.App.MonitorService;
9 | using ProcessMonitor.App.Views;
10 |
11 | namespace ProcessMonitor.App.Presenters
12 | {
13 |
14 | public class AddToWatchPresenter : IPresenter
15 | {
16 |
17 | private IAddToWatchView view;
18 | private MainPresenter presenter;
19 |
20 | public AddToWatchPresenter(IAddToWatchView view, MainPresenter presenter)
21 | {
22 | this.view = view;
23 | this.presenter = presenter;
24 | view.Presenter = this;
25 | UpdateList();
26 | }
27 |
28 | public void UpdateList()
29 | {
30 | view.SetAllProcesses(presenter.GetAllProcesses());
31 | }
32 |
33 | public string Process
34 | {
35 | get
36 | {
37 | return view.Process;
38 | }
39 | set
40 | {
41 | view.Process = value;
42 | }
43 | }
44 |
45 | }
46 |
47 | }
48 |
--------------------------------------------------------------------------------
/ProcessMonitor.Installer/Features.wxs:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
--------------------------------------------------------------------------------
/ProcessMonitor.App/Views/AddToWatchView.xaml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/ProcessMonitor/IMonitor.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.IO;
4 | using System.ServiceModel;
5 |
6 | namespace ProcessMonitor
7 | {
8 |
9 | [ServiceContract]
10 | public interface IMonitor
11 | {
12 |
13 | [OperationContract]
14 | void Start();
15 |
16 | [OperationContract]
17 | void Stop();
18 |
19 | [OperationContract]
20 | void AddToWatch(string process);
21 |
22 | [OperationContract]
23 | void RemoveWatch(string process);
24 |
25 | [OperationContract]
26 | void ClearWatchs();
27 |
28 | [OperationContract]
29 | void Reset();
30 |
31 | [OperationContract]
32 | uint GetTotalWorkTime();
33 |
34 | [OperationContract]
35 | WatchProcess[] GetWatchList();
36 |
37 | [OperationContract]
38 | void LoadWatchs();
39 |
40 | [OperationContract]
41 | void SaveWatchs();
42 |
43 | [OperationContract]
44 | void SaveStatistics();
45 |
46 | [OperationContract]
47 | uint GetInterval();
48 |
49 | [OperationContract]
50 | void SetInterval(uint interval);
51 |
52 | [OperationContract]
53 | bool IsStarted();
54 |
55 | [OperationContract]
56 | Stream GetStatistics();
57 |
58 | [OperationContract]
59 | string[] GetAllProcesses();
60 |
61 | }
62 |
63 | }
64 |
--------------------------------------------------------------------------------
/ProcessMonitor.ConsoleApp/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/ProcessMonitor.App/Service References/MonitorService/configuration.svcinfo:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/ProcessMonitor.Service/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
--------------------------------------------------------------------------------
/ProcessMonitor/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
--------------------------------------------------------------------------------
/ProcessMonitor/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("Process Monitor")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("Process Monitor")]
13 | [assembly: AssemblyCopyright("Copyright © eXit 2012")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("b81abee9-5511-4bb6-a98c-8a32032765cb")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/ProcessMonitor.Service/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("Process Monitor Service")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("Process Monitor")]
13 | [assembly: AssemblyCopyright("Copyright © 2012")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("fce222f1-b460-4aca-b90c-87c2eb926b9a")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/ProcessMonitor.ConsoleApp/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("ProcessMonitor.ConsoleApp")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("ProcessMonitor.ConsoleApp")]
13 | [assembly: AssemblyCopyright("Copyright © 2012")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("ddad05b4-eb43-426c-bd4e-16790f2237be")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/ProcessMonitor/WatchProcess.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Runtime.Serialization;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 |
8 | namespace ProcessMonitor
9 | {
10 |
11 | [DataContract]
12 | public class WatchProcess
13 | {
14 |
15 | private string process;
16 | private uint milliseconds;
17 |
18 | public WatchProcess()
19 | {
20 |
21 | }
22 |
23 | public WatchProcess(string process)
24 | {
25 | this.process = process;
26 | }
27 |
28 | public override bool Equals(object obj)
29 | {
30 | var p = obj as WatchProcess;
31 | if (p == null)
32 | return false;
33 |
34 | return this.process == p.Process;
35 | }
36 |
37 | public override int GetHashCode()
38 | {
39 | return process.GetHashCode();
40 | }
41 |
42 | public override string ToString()
43 | {
44 | return string.Format("{0} ({1})", process, milliseconds);
45 | }
46 |
47 | [DataMember]
48 | public string Process
49 | {
50 | get
51 | {
52 | return process;
53 | }
54 | set
55 | {
56 | process = value;
57 | }
58 | }
59 |
60 | [DataMember]
61 | public uint Milliseconds
62 | {
63 | get
64 | {
65 | return milliseconds;
66 | }
67 | set
68 | {
69 | milliseconds = value;
70 | }
71 | }
72 |
73 | }
74 |
75 | }
76 |
--------------------------------------------------------------------------------
/ProcessMonitor.App/Views/ConnectView.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using System.Windows;
7 | using System.Windows.Controls;
8 | using System.Windows.Data;
9 | using System.Windows.Documents;
10 | using System.Windows.Input;
11 | using System.Windows.Media;
12 | using System.Windows.Media.Imaging;
13 | using System.Windows.Shapes;
14 | using ProcessMonitor.App.Command;
15 | using ProcessMonitor.App.Presenters;
16 |
17 | namespace ProcessMonitor.App.Views
18 | {
19 |
20 | public partial class ConnectView : Window, IConnectView
21 | {
22 |
23 | private RelayCommand connectCommand;
24 |
25 | public ConnectView()
26 | {
27 | InitializeComponent();
28 |
29 | serverBox.Focus();
30 | this.DataContext = this;
31 | }
32 |
33 | IPresenter IView.Presenter
34 | {
35 | get
36 | {
37 | return null;
38 | }
39 | set { }
40 | }
41 |
42 | public string Server
43 | {
44 | get
45 | {
46 | return serverBox.Text;
47 | }
48 | set
49 | {
50 | serverBox.Text = value;
51 | }
52 | }
53 |
54 | public ICommand ConnectCommand
55 | {
56 | get
57 | {
58 | if (connectCommand == null)
59 | connectCommand = new RelayCommand(o =>
60 | {
61 | this.DialogResult = true;
62 | this.Close();
63 | }, o => !string.IsNullOrWhiteSpace(serverBox.Text));
64 |
65 | return connectCommand;
66 | }
67 | }
68 |
69 | }
70 |
71 | }
72 |
--------------------------------------------------------------------------------
/ProcessMonitor.Installer/Product.wxs:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 | = 501)]]>
40 |
41 |
42 |
43 |
44 |
45 |
--------------------------------------------------------------------------------
/ProcessMonitor.ConsoleApp/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Net;
5 | using System.ServiceModel;
6 | using System.Text;
7 | using System.Threading.Tasks;
8 |
9 | namespace ProcessMonitor.ConsoleApp
10 | {
11 |
12 | class Program
13 | {
14 |
15 | static void Main(string[] args)
16 | {
17 | Console.WriteLine("Run:");
18 | Console.WriteLine("1 - Local Monitor");
19 | Console.WriteLine("2 - Service");
20 |
21 | var input = Console.ReadLine();
22 | if (input == "1")
23 | {
24 | Monitor monitor = new Monitor();
25 | monitor.AddToWatch("explorer");
26 | monitor.AddToWatch("calc");
27 | monitor.AddToWatch("chrome");
28 | monitor.Start();
29 |
30 | Console.ReadLine();
31 | }
32 | else if (input == "2")
33 | {
34 | string address = string.Empty; ;
35 | foreach (IPAddress item in Dns.GetHostAddresses(Dns.GetHostName()))
36 | {
37 | //if (!item.IsIPv6LinkLocal)
38 | // if (!item.IsIPv6Multicast)
39 | // if (!item.IsIPv6SiteLocal)
40 | // if (!item.IsIPv6Teredo)
41 | // address = item.ToString();
42 | if (!item.IsIPv6LinkLocal && !item.IsIPv6Multicast && !item.IsIPv6SiteLocal && !item.IsIPv6Teredo)
43 | address = item.ToString();
44 | }
45 |
46 | Monitor monitor = new Monitor();
47 | using (ServiceHost host = new ServiceHost(monitor, new Uri(string.Format("http://{0}:4325/", address))))
48 | {
49 | host.Open();
50 | monitor.Start();
51 | Console.WriteLine("Opened...");
52 |
53 | Console.ReadLine();
54 | }
55 | }
56 | }
57 |
58 | }
59 |
60 | }
61 |
--------------------------------------------------------------------------------
/ProcessMonitor.App/Service References/MonitorService/Reference.svcmap:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | false
5 | true
6 |
7 | false
8 | false
9 | false
10 |
11 |
12 | true
13 | Auto
14 | true
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
--------------------------------------------------------------------------------
/ProcessMonitor.App/Command/RelayCommand.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Windows;
3 | using System.Windows.Input;
4 |
5 | namespace ProcessMonitor.App.Command
6 | {
7 |
8 | public class RelayCommand : ICommand
9 | {
10 |
11 | private readonly Action