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); }
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(); } }
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()); } }
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); } } }
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; }