public void StopService(ServiceInformation si) { if (si.Service.IsRunning) { si.Service.ShutDown(); } }
public void AbortService(ServiceInformation si) { if (si.Service.IsRunning) { si.Service.Abort(); } }
public bool StartService(ServiceInformation si) { if (si.Service.IsRunning) { return(true); } si.Service.StartUp(); return(false); }
public bool UpdateFile(ServiceInformation si, string fileName, string localFilePath) { string content = null; try { content = File.ReadAllText(Path.Combine(PersistenceConfiguration.ExampleFilesDirectory, localFilePath)); } catch (Exception) { return(false); } si.Service.UpdateFile(fileName, content); return(true); }
public ServiceInformation CreateNewService() { CheckPathsExist(); var id = IDService.GenerateNextID(); var serviceId = IDService.GetServiceUIDForId(id); var si = new ServiceInformation( id, new SyncService.SyncService( serviceId, Path.Combine(PersistenceConfiguration.SyncDirectory, serviceId), Path.Combine(PersistenceConfiguration.DBDirectory, serviceId + ".dat") ) ); services.Add(si); si.Service.OnLog += (source, args) => OnServiceLog?.Invoke(this, new OnServiceLogHandlerArgs(si, args)); return(si); }
internal OnServiceLogHandlerArgs(ServiceInformation serviceInformation, OnLogHandlerArgs originalArgs) { ServiceInformation = serviceInformation; OriginalArgs = originalArgs; }
public void DeleteFile(ServiceInformation si, string fileName) { si.Service.DeleteFile(fileName); }