Beispiel #1
0
 private void FormAdmin_Load(object sender, EventArgs e)
 {
     try
     {
         // C:\Windows\Microsoft.NET\Framework\v2.0.50727\installutil.exe NeokernelService.exe
         this.textBoxSVNBinaryPath.Text  = RegistryRW.ReadValue(RegistryRW.RegistryRootKeys.HKEY_LOCAL_MACHINE, "SOFTWARE\\NeokernelService", "Path", "E:\\Hd\trunk\\Hd2\\Reference").ToString();
         this.textBoxRepositoryPath.Text = RegistryRW.ReadValue(RegistryRW.RegistryRootKeys.HKEY_LOCAL_MACHINE, "SOFTWARE\\NeokernelService", "Parameters", "-startup_dir E:\\Hd\\trunk\\Hd2\\Reference -startup_agent Feng.Server.Agents.StartupAgent -reporter com.neokernel.io.ServiceReporter").ToString();
     }
     catch (Exception ex)
     {
         System.Console.WriteLine(ex.ToString());
     }
 }
Beispiel #2
0
 private void buttonSave_Click(object sender, EventArgs e)
 {
     try
     {
         RegistryRW.WriteValue(RegistryRW.RegistryRootKeys.HKEY_LOCAL_MACHINE, "SOFTWARE\\NeokernelService", "Path", this.textBoxSVNBinaryPath.Text.ToString(), true);
         RegistryRW.WriteValue(RegistryRW.RegistryRootKeys.HKEY_LOCAL_MACHINE, "SOFTWARE\\NeokernelService", "Parameters", this.textBoxRepositoryPath.Text.ToString(), true);
         MessageBox.Show("Your configuration has been updated");
         this.Close();
     }
     catch (Exception ex)
     {
         MessageBox.Show("Please login with an administrative account");
         System.Console.WriteLine(ex.ToString());
         this.Close();
     }
 }
Beispiel #3
0
        protected override void OnStart(string[] args)
        {
            this.nkExe   = "neokernel.exe";
            this.AutoLog = false;
            try
            {
                this.nkBinaryPath = RegistryRW.ReadValue(RegistryRW.RegistryRootKeys.HKEY_LOCAL_MACHINE, "SOFTWARE\\NeokernelService", "Path", " ").ToString();
                this.nkParameters = RegistryRW.ReadValue(RegistryRW.RegistryRootKeys.HKEY_LOCAL_MACHINE, "SOFTWARE\\NeokernelService", "Parameters", " ").ToString();
                this.nkPath       = System.IO.Path.Combine(nkBinaryPath, nkExe);
            }
            catch (Exception)
            {
                this.eventLog.WriteEntry("Please run nkServiceAdmin to create a valid configuration");
                // raise exception otherwise the service will start even if svnserve.exe could not be started
                throw;
            }

            try
            {
                process.EnableRaisingEvents = false;
                process.StartInfo.FileName  = nkPath;
                //use --daemon because svnserve has to work as daemon in our case anyway
                process.StartInfo.Arguments += nkParameters;

                process.StartInfo.CreateNoWindow  = true;
                process.StartInfo.UseShellExecute = false;
                process.StartInfo.ErrorDialog     = true;

                process.Start();
                this.eventLog.WriteEntry("SVN Service successfully started");
            }
            catch (Exception)
            {
                eventLog.WriteEntry("Failed to start nkService: " + nkPath.ToString() + " " + process.StartInfo.Arguments.ToString() + " Check your configuration", System.Diagnostics.EventLogEntryType.Error);
                // raise exception otherwise the service will be running even if svnserve.exe could not be started
                throw;
            }
        }