static CCProcess() { // find the service process Process serviceProcess = null; CCPath pathCurDir = new CCPath(Environment.CurrentDirectory.Replace(Path.DirectorySeparatorChar, '/')); int score = 0; // if there are multiple shred host services, guess the one with more common path components foreach (Process process in Process.GetProcessesByName(SERVICE_PROCESS_NAME)) { try { string processDir = Path.GetDirectoryName(process.MainModule.FileName); CCPath pathProcessDir = new CCPath(processDir.Replace(Path.DirectorySeparatorChar, '/')); int scoreProcessDir = pathCurDir.GetCommonPath(pathProcessDir).Segments.Count; if (scoreProcessDir > score) { score = scoreProcessDir; serviceProcess = process; } } catch (Exception) {} } if (serviceProcess != null) { Service = new CCProcess(serviceProcess); } else { Service = new CCProcess(Process.GetCurrentProcess()); Platform.Log(LogLevel.Warn, "DevTools couldn't find the service process."); } }