public void ExploreCustomUserRuleFile() { string customUserRuleFilename = HostMap.Instance().GetCustomUserRuleFile(); if (CustomUserRuleFileReadyToOpen != null) { CustomUserRuleFileReadyToOpen(this, new PathEventArgs() { Path = customUserRuleFilename }); } }
static void Main(string[] args) { #if !_CONSOLE foreach (string arg in args) { if (arg == "--setautorun") { if (!Controller.AutoStartup.Switch()) { Environment.ExitCode = 1; } return; } if (arg == "--check") { MessageBox.Show("ilys-ssr-client","info"); } } using (Mutex mutex = new Mutex(false, "Global\\ShadowsocksR_" + Application.StartupPath.GetHashCode())) { AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; Application.EnableVisualStyles(); Application.ApplicationExit += Application_ApplicationExit; SystemEvents.PowerModeChanged += SystemEvents_PowerModeChanged; Application.SetCompatibleTextRenderingDefault(false); if (!mutex.WaitOne(0, false)) { MessageBox.Show(I18N.GetString("Find Shadowsocks icon in your notify tray.") + "\n" + I18N.GetString("If you want to start multiple Shadowsocks, make a copy in another directory."), I18N.GetString("ShadowsocksR is already running.")); return; } #endif Directory.SetCurrentDirectory(Application.StartupPath); //#if !DEBUG Logging.OpenLogFile(); //#endif #if !_CONSOLE int try_times = 0; while (Configuration.Load() == null) { if (try_times >= 5) return; using (InputPassword dlg = new InputPassword()) { if (dlg.ShowDialog() == DialogResult.OK) Configuration.SetPassword(dlg.password); else return; } try_times += 1; } #endif //_controller = new ShadowsocksController(); HostMap.Instance().LoadHostFile(); #if !_CONSOLE //_viewController = new MenuViewController(_controller); #endif //_controller.Start(); #if !_CONSOLE //Util.Utils.ReleaseMemory(); Application.Run(new Client()); } #else Console.ReadLine(); _controller.Stop(); #endif }