using System; using System.Linq; using System.Reflection; using System.Diagnostics; using System.Windows.Forms; using System.ServiceProcess; using Launcher_Server.Database; namespace Launcher_Server { class Program { public static ServiceBase[] ServicesToRun; public static Query RunQuery; static void Main() { if (Environment.UserInteractive) { ServiceController Controller = ServiceController.GetServices().Where(Service => Service.DisplayName == "_OxionLogin").FirstOrDefault(); if (Controller != null) { Message("Oxion Login is already uploaded."); Environment.Exit(0); } Process CMDStart = new Process(); ProcessStartInfo CMDStartInfo = new ProcessStartInfo() { Arguments = String.Format("/C sc create OxionLogin binPath= \"{0}\" DisplayName= _OxionLogin", Assembly.GetExecutingAssembly().Location), FileName = "cmd.exe", WindowStyle = ProcessWindowStyle.Hidden }; CMDStart.StartInfo = CMDStartInfo; CMDStart.Start(); Message("Uploaded Oxion Login successfully."); Environment.Exit(0); } ServicesToRun = new ServiceBase[] { new OxionLogin() }; ServiceBase.Run(ServicesToRun); } private static void Message(String Message, params Object[] Args) { String FormattedMessage = String.Format(Message, Args); MessageBox.Show(FormattedMessage, "Oxion Login", MessageBoxButtons.OK, MessageBoxIcon.Information); } } }