Exemple #1
0
        static void Main()
        {
            try{
                if (!SingleInstance.Start())
                {
                    File.WriteAllLines(Application.StartupPath + @"\ARGS.t", Environment.GetCommandLineArgs());
                    SingleInstance.ShowFirstInstance();
                    return;
                }
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);

                GhostBase.GhostbladeInstance.Init();
                RiotSharp.ApiCache.CacheEnabled = true;
                RiotSharp.ApiCache.Initialize();
                // Register App
                ApplicationInstance.Instance.Register("CID");

                if (!File.Exists(Application.StartupPath + @"\Config.txt"))
                {
                    SettingsManager.Default();

                    SettingsForm frm = new SettingsForm();
                    frm.ShowDialog();
                }
                else
                {
                    SettingsManager.Init();
                    if (System.Windows.Forms.SystemInformation.Network)
                    {
                        Thread thr = new Thread(new ThreadStart(CheckForUpdates));
                        thr.Start();
                        thr.Join();
                    }
                }
                // Api cache
                RiotSharp.ApiCache.CacheEnabled = SettingsManager.Settings.ApiCacheEnabled;



                Application.ThreadException += new ThreadExceptionEventHandler(Application_ThreadException);

                AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);

                // Load Interfaces

                MethodInvoker mi = new MethodInvoker(NetworkManager.Init);
                mi.BeginInvoke(null, null);

                // GHOSTOVERLAY
                GhostOverlay.StartServer();

                MainFormInstance            = new MainForm();
                GhostbladeInstance.MainForm = MainFormInstance;
                Application.Run(MainFormInstance);
            }
            catch (Exception ex)
            {
                SendCrashReport(ex);
                Logger.Instance.Log.Fatal("Global fail", ex);
            }
            finally
            {
                if (RiotTool.pi != null)
                {
                    RiotTool.pi.Dispose();
                }

                if (SettingsManager.Settings.ProxyOption == ProxyType.Network && NetworkManager.DefaultProxy != null)
                {
                    ((NetworkInterfaceProxy)NetworkManager.DefaultProxy).Stop();
                }

                // Api cache
                RiotSharp.ApiCache.Close
                    ();
                GhostOverlay.Stop();
                StreamManager.Stop();
                SingleInstance.Stop();
            }
        }
Exemple #2
0
        private void metroLink1_Click(object sender, EventArgs e)
        {
            SettingsForm frm = new SettingsForm();

            frm.ShowDialog();
        }