protected override void OnStart(string[] args) { var sbs = new BinaryServerFormatterSinkProvider(); var props = new Dictionary <string, object>() { { "name", "TempServe" }, { "portName", "TempServe" }, { "authorizedGroup", "Users" } }; server = new IpcServerChannel(props, sbs); ChannelServices.RegisterChannel(server, false); RemotingConfiguration.RegisterWellKnownServiceType(typeof(TempLogger), "DataService", WellKnownObjectMode.Singleton); TempLogger.running = true; mainloop = new Thread(() => TempLogger.StartTempLogging(false, true, false)); mainloop.Start(); }
public static int Main(string[] args) { bool consolemode = false; bool logmode = false; bool dumpmode = false; if (args.Contains("-install")) { try { string[] a = { "TempServe.exe" }; ManagedInstallerClass.InstallHelper(a); } catch (Exception exception) { Console.Error.WriteLine(exception.Message); return(-1); } return(0); } if (args.Contains("-uninstall")) { try { string[] a = { "/u", "TempServe.exe" }; ManagedInstallerClass.InstallHelper(a); } catch (Exception exception) { Console.Error.WriteLine(exception.Message); return(-1); } return(0); } if (args.Contains("-console")) { consolemode = true; } if (args.Contains("-log")) { logmode = true; } if (args.Contains("-dump")) { dumpmode = true; } try { if (!consolemode) { logmode = true; ServiceBase.Run(new TempLogService()); } else { TempLogger.StartTempLogging(consolemode, logmode, dumpmode); } } catch (Exception ex) { Console.Error.WriteLine(ex); return(-1); } return(0); }