public void InstallService()
        {
            SetResutlText($"\n===== Installing service started =====", true);
            try
            {
                CopyAndUnzipFile();
                SetResutlText("Service installation begin");

                string installer = GetInstaller();
                if (string.IsNullOrEmpty(installer))
                {
                    SetResutlText("No application found to install");
                    SetResutlText($"\n===== Installing service ended with error =====", true);
                    return;
                }

                string cmd = GetInstallationCmd(installer);
                SetResutlText(ProcessHelpers.RunCmd(cmd, true));
            }
            catch (Exception ex)
            {
                SetResutlText($"{ex}");
            }
            SetResutlText($"\n===== Installing service ended =====", true);

            SetResutlText($"\n===== Starting service started =====", true);
            string startCmd = $"/k net start {setting.Settings.ServiceName}";

            SetResutlText(ProcessHelpers.RunCmd(startCmd, true));
            SetResutlText($"\n===== Starting service ended =====", true);
        }
        public void UnInstallService()
        {
            SetResutlText($"\n===== Uninstalling service started =====", true);
            string cmd = $"/k sc delete {setting.Settings.ServiceName}";

            SetResutlText(ProcessHelpers.RunCmd(cmd, true));
            SetResutlText($"\n===== Uninstalling service ended =====", true);
        }
Ejemplo n.º 3
0
        public void StopService()
        {
            SetResutlText($"\n===== Stopping service started =====", true);
            string cmd = $"/k net stop {setting.Settings.ServiceName}";

            SetResutlText(ProcessHelpers.RunCmd(cmd, true));
            SetResutlText($"\n===== Stopping service ended =====", true);
        }
        public void ServiceCheckStatus()
        {
            SetResutlText($"\n===== Getting service status started =====", true);
            string cmd = $"/k sc query {setting.Settings.ServiceName}";

            SetResutlText(ProcessHelpers.RunCmd(cmd, true));
            SetResutlText($"\n===== Getting service status ended =====", true);
        }