コード例 #1
0
        static void Main(string[] Args)
        {
            bool EndUpdate = false;

            foreach (string str in Args)
            {
                string Command = str.ToLower().Trim('-', '\\', '/');
                switch (Command)
                {
                default:
                    continue;

                case "offline":
                    OfflineMode = true;
                    continue;

                case "endupdate":
                    EndUpdate = true;
                    continue;
                }
            }

            if (System.IO.File.Exists(AppDomain.CurrentDomain.BaseDirectory + "Launcher.exe"))
            {
                try {
                    Thread.Sleep(500);
                    System.IO.File.Delete(AppDomain.CurrentDomain.BaseDirectory + "Launcher.exe");
                } catch { }
            }

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            Engine.InitializeStrings();

            if (EndUpdate)
            {
                MessageBox.Show(Engine.LoadTranslation(Engine.TLID.UpdatesInstaled), "VNXTLP", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }

            new Thread(() => {
                try {
                    if (Engine.GetConfig("FTP", "AutoLogin", false) == "true")
                    {
                        Connecting = true;
                        Engine.Login(Engine.GetConfig("FTP", "AutoUser", true), Engine.GetConfig("FTP", "AutoPass", true), false);
                    }
                } catch { }
                Connecting = false;
            }).Start();

            if (!OfflineMode)
            {
                try {
                    (new CheckUpdate()).ShowDialog();
                } catch { }
                if (!Engine.FTP.Avaliable)
                {
                    MessageBox.Show(Engine.LoadTranslation(Engine.TLID.NoFTPServer), "VNXTLP", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    System.Diagnostics.Process.GetCurrentProcess().Kill();
                    return;
                }
                if (!Engine.Authenticated)
                {
                    Form Login;
                    switch (Engine.UsingTheme())
                    {
                    case "modern":
                        Login = new NewStyle.StyleLogin();
                        break;

                    case "bern":
                        Login = new BernStyle.StyleLogin();
                        break;

                    default:
                        Login = new NoStyleLogin();
                        break;
                    }

                    Login.ShowDialog();
                    if (!Engine.Authenticated)
                    {
                        return;
                    }
                }
            }

            switch (Engine.UsingTheme())
            {
            case "modern":
                MainForm = new NewStyle.StyleProgram();
                break;

            case "bern":
                MainForm = new BernStyle.StyleProgram();
                break;

            default:
                MainForm = new NoStyle();
                break;
            }

            new Thread(() => {
                Engine.InitializePipe();
            }).Start();

            Application.Run(MainForm);
        }