コード例 #1
0
        public static SkynetProcess FromId(int id, string processName)
        {
            var result = new SkynetProcess();

            result.process     = Process.GetProcessById(id);
            result.Output      = new BasicOutput();
            result.Name        = "S-" + processName;
            result.PackageName = "S-" + result.process.ProcessName;
            return(result);
        }
コード例 #2
0
 public SkynetProcessInfo StartNewProcess(string packageName, string processName, string executable, string[] args)
 {
     lock (startedProcesses)
     {
         if (startedProcesses.Select(x => x.Name).Contains(processName))
             throw new InvalidOperationException(String.Format("There is already a process with name {0}", processName));
         var process = new SkynetProcess(executable, args, packageName, processName);
         startedProcesses.Add(process);
         return process.GetProcessInfo();
     }
 }
コード例 #3
0
 public SkynetProcessInfo StartNewProcess(string packageName, string processName, string executable, string[] args)
 {
     lock (startedProcesses)
     {
         if (startedProcesses.Select(x => x.Name).Contains(processName))
         {
             throw new InvalidOperationException(String.Format("There is already a process with name {0}", processName));
         }
         var process = new SkynetProcess(executable, args, packageName, processName);
         startedProcesses.Add(process);
         return(process.GetProcessInfo());
     }
 }
コード例 #4
0
 public void Heartbeat(Guid origin, int processId)
 {
     lock (startedProcesses)
     {
         var process = startedProcesses.Where(x => x.ProcessId == processId).SingleOrDefault();
         if (process != null)
         {
             process.RegisterHeartbeat(origin);
         }
         else
         {
             var processName = origin.GetHashCode();
             var proc        = SkynetProcess.FromId(processId, processName.ToString());
             startedProcesses.Add(proc);
             proc.RegisterHeartbeat(origin);
         }
     }
 }
コード例 #5
0
ファイル: SkynetProcess.cs プロジェクト: Elders/Skynet
 public static SkynetProcess FromId(int id, string processName)
 {
     var result = new SkynetProcess();
     result.process = Process.GetProcessById(id);
     result.Output = new BasicOutput();
     result.Name = "S-" + processName;
     result.PackageName = "S-" + result.process.ProcessName;
     return result;
 }