private static void Main(string[] args) { //fixes wrong screensize for screen share if (Environment.OSVersion.Version.Major >= 6) { SetProcessDPIAware(); } if (!Directory.Exists(AppEnvironment.DataPath)) { Directory.CreateDirectory(AppEnvironment.DataPath); } if (!Debugger.IsAttached) { ExceptionHandler.AddGlobalHandlers(); } Console.WriteLine("Exception Handlers attached"); Settings.Initialize("Config.json"); Console.Title = Resources.Program_Title; Tools.ConfigureServer(); var useTerminal = Convert.ToBoolean(Settings.Get("Terminal").AllowTerminal); var usePlugins = Convert.ToBoolean(Settings.Get("Plugins").LoadPlugins); var useWebServer = Convert.ToBoolean(Settings.Get("WebServer").UseWebServer); WebCamManager.LoadWebcams(); if (usePlugins) { PluginHandler.LoadPlugins(); } if (useWebServer) { HttpServer.Setup(); } var systemUtilities = new SystemUtilities(); systemUtilities.Start(); //Keep down here if you actually want a functional program TaskManagerServer.Start(); if (useTerminal) { TerminalManagerServer.Start(); } Console.ReadLine(); }
private static void ConsoleMain(string[] args) { Console.WriteLine("Command line = {0}", Environment.CommandLine); for (var ix = 0; ix < args.Length; ++ix) Console.WriteLine("Argument{0} = {1}", ix + 1, args[ix]); WebCamManager.LoadWebcams(); PluginManager.LoadPlugins(); Tools.GenerateSettings(); HttpServer.Setup(); var systemUtilities = new SystemUtilities(); systemUtilities.Start(); //Keep down here if you actually want a functional program TaskManagerServer.Start(); TerminalManagerServer.Start(); Console.ReadLine(); }
private static void LoadManagerFromFile(FrmMain uiform) { IFormatter formatter = new BinaryFormatter(); try { Stream stream = new FileStream("SlowAndSteadyParser.store", FileMode.Open, FileAccess.Read, FileShare.Read); try { LocalStorage store = (LocalStorage)formatter.Deserialize(stream); uiform.LevelFlagsToButtonStatus(store.LogLevelFlags); m_tms = store.CurrentTaskManager; m_ttm = store.CurrentTransmissionManager; DomainManager.DomainList = store.DomainList; IsMinToSystemTray = store.IsMinToSystemTray; IsServerModeRemote = !store.IsServerModeLocal; if (store.ServerTcpPort != 0) ServerPort = store.ServerTcpPort; if (store.LogLoadingLimit != 0) LogLoadingLimit = store.LogLoadingLimit; if (store.LogReservedDays != 0) LogReservedDays = store.LogReservedDays; if (store.MessagePeriod != 0) MessagePeriod = store.MessagePeriod; IsUsingFetion = store.IsUsingFetion; if (store.FetionNumber != null) FetionNumber = store.FetionNumber; if (store.FetionPsd != null) FetionPsd = store.FetionPsd; if (store.FetionSendingTime != null) FetionSendingTime = store.FetionSendingTime; if (store.ADSLEntryName != null) ADSLEntry = store.ADSLEntryName; if (store.ADSLUserName != null) ADSLUserName = store.ADSLUserName; if (store.ADSLPassword != null) ADSLPassword = store.ADSLPassword; } catch (SerializationException e) { m_tms = new TaskManagerServer(); m_ttm = new TaskTransmissionManager(); log.Warn("本地数据文件格式错误", e); } catch (Exception e) { m_tms = new TaskManagerServer(); m_ttm = new TaskTransmissionManager(); log.Warn("本地数据文件格式错误", e); } finally { stream.Close(); } } catch (System.IO.FileNotFoundException e) { m_tms = new TaskManagerServer(); m_ttm = new TaskTransmissionManager(); log.Warn("未找到本地数据文件", e); } finally { if (m_ttm == null) m_ttm = new TaskTransmissionManager(); if (m_tms == null) m_tms = new TaskManagerServer(); } }