コード例 #1
0
 public void StopService(ServiceInformation si)
 {
     if (si.Service.IsRunning)
     {
         si.Service.ShutDown();
     }
 }
コード例 #2
0
 public void AbortService(ServiceInformation si)
 {
     if (si.Service.IsRunning)
     {
         si.Service.Abort();
     }
 }
コード例 #3
0
        public bool StartService(ServiceInformation si)
        {
            if (si.Service.IsRunning)
            {
                return(true);
            }

            si.Service.StartUp();
            return(false);
        }
コード例 #4
0
        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);
        }
コード例 #5
0
        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);
        }
コード例 #6
0
 internal OnServiceLogHandlerArgs(ServiceInformation serviceInformation, OnLogHandlerArgs originalArgs)
 {
     ServiceInformation = serviceInformation;
     OriginalArgs       = originalArgs;
 }
コード例 #7
0
 public void DeleteFile(ServiceInformation si, string fileName)
 {
     si.Service.DeleteFile(fileName);
 }