Beispiel #1
0
 /// <summary>
 ///   Verifies whether the given process matches the targeted process.
 /// </summary>
 /// <param name="process">The process to verify whether it matches this targeted process.</param>
 /// <returns>True when the process matches the targeted process; false otherwise.</returns>
 public bool Matches( Process process )
 {
     FileVersionInfo info = process.MainModule.FileVersionInfo;
     Version fileVersion = new Version( info.FileMajorPart, info.FileMinorPart, info.FileBuildPart, info.FilePrivatePart );
     return
         Name == process.ProcessName &&
         Company == info.CompanyName &&
         ( Version == null || fileVersion.Matches( Version ) ); // 'null' matches any version.
 }