Chromium Code Reviews| Index: visual_studio/NativeClientVSAddIn/NativeClientVSAddIn/IProcessSearcher.cs |
| diff --git a/visual_studio/NativeClientVSAddIn/NativeClientVSAddIn/IProcessSearcher.cs b/visual_studio/NativeClientVSAddIn/NativeClientVSAddIn/IProcessSearcher.cs |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..11930729b57e9cef25f7854d2590460f5bcc11e3 |
| --- /dev/null |
| +++ b/visual_studio/NativeClientVSAddIn/NativeClientVSAddIn/IProcessSearcher.cs |
| @@ -0,0 +1,76 @@ |
| +using System; |
| +using System.Collections.Generic; |
| +using System.Linq; |
| +using System.Text; |
| + |
| +namespace NativeClientVSAddIn |
| +{ |
| + /// <summary> |
| + /// Represents the standardized utility for retrieving the list |
| + /// of running processes on the system |
| + /// </summary> |
| + interface IProcessSearcher |
| + { |
| + List<ProcessInfo> GetResults(string Constraints); |
|
Petr Hosek
2012/07/10 05:37:21
Names for method parameters should in general use
tysand
2012/07/11 05:23:46
Done.
|
| + List<ProcessInfo> GetResultsByName(string Name); |
| + List<ProcessInfo> GetResultsById(uint procId); |
| + } |
| + |
| + /// <summary> |
| + /// Holds information about a process |
| + /// </summary> |
| + class ProcessInfo |
| + { |
| + public ProcessInfo(uint id, uint parentId, string creationDate, string commandLine, string name) |
| + { |
| + // Convert an empty creationDate string into the current timestamp |
| + if (String.IsNullOrEmpty(creationDate)) |
| + { |
| + int timezoneMinutes = (int)Math.Round((DateTime.Now - DateTime.UtcNow).TotalMinutes); |
| + creationDate = String.Format("{0:yyyMMddHHmmss.ffffff}{1}", DateTime.Now, timezoneMinutes); |
| + } |
| + |
| + ID = id; |
| + ParentId = parentId; |
| + CreationDate = creationDate; |
|
Petr Hosek
2012/07/10 05:37:21
Why do not you store creation date as DateTime typ
tysand
2012/07/11 05:23:46
Good catch. This was left-over after a refactoring
|
| + CommandLine = commandLine; |
| + Name = name; |
| + } |
| + |
| + public uint ID |
|
Petr Hosek
2012/07/10 05:37:21
For simple properties like those in this class, yo
tysand
2012/07/11 05:23:46
Done.
|
| + { |
| + get { return _id; } |
| + set { _id = value; } |
| + } |
| + |
| + public uint ParentId |
|
Petr Hosek
2012/07/10 05:37:21
I would probably go for ParentID name to make it c
tysand
2012/07/11 05:23:46
Done.
|
| + { |
| + get { return _parentId; } |
| + set { _parentId = value; } |
| + } |
| + |
| + public string CreationDate |
| + { |
| + get { return _creationDate; } |
| + set { _creationDate = value; } |
| + } |
| + |
| + public string CommandLine |
| + { |
| + get { return _commandLine; } |
| + set { _commandLine = value; } |
| + } |
| + |
| + public string Name |
| + { |
| + get { return _name; } |
| + set { _name = value; } |
| + } |
| + |
| + private uint _parentId; |
|
Petr Hosek
2012/07/10 05:37:21
Underscoring private variables was recommended in
tysand
2012/07/11 05:23:46
To be consistent with Chrome C++ I'm changing this
|
| + private uint _id; |
| + private string _creationDate; |
| + private string _commandLine; |
| + private string _name; |
| + } |
| +} |