コード例 #1
0
        public MainForm()
        {
            InitializeComponent();

            mf = this;

            versionLabel.Text = "v" + launcherVer;

            var preAnchorLeftPanelSize = new Size(pnLeftSide.Width, pnLeftSide.Height - btnVersionDownloader.Height);

            sideversionForm = new SidebarVersionsPanel
            {
                BackColor = pnLeftSide.BackColor,
                TopLevel  = false
            };
            pnLeftSide.Controls.Add(sideversionForm);
            sideversionForm.Location = new Point(0, 0);
            sideversionForm.Size     = preAnchorLeftPanelSize;
            sideversionForm.Anchor   = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;

            sideversionForm.Show();

            sideinfoForm = new SidebarInfoPanel
            {
                BackColor = pnLeftSide.BackColor,
                TopLevel  = false
            };
            pnLeftSide.Controls.Add(sideinfoForm);
            sideinfoForm.Location = new Point(0, 0);
            sideinfoForm.Size     = preAnchorLeftPanelSize;
            sideinfoForm.Anchor   = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;

            RewireMouseMove();

            //creating default folders
            if (!Directory.Exists(launcherDir + Path.DirectorySeparatorChar + "VERSIONS" + Path.DirectorySeparatorChar))
            {
                Directory.CreateDirectory(launcherDir + Path.DirectorySeparatorChar + "VERSIONS" + Path.DirectorySeparatorChar);
            }

            if (!Directory.Exists(launcherDir + Path.DirectorySeparatorChar + "PACKAGES" + Path.DirectorySeparatorChar))
            {
                Directory.CreateDirectory(launcherDir + Path.DirectorySeparatorChar + "PACKAGES" + Path.DirectorySeparatorChar);
            }

            if (File.Exists(launcherDir + Path.DirectorySeparatorChar + "PACKAGES\\dev.txt"))
            {
                webResourceDomain = "http://cc.r5x.cc";
            }

            //Will trigger after an update from the original launcher
            if (Directory.Exists(launcherDir + Path.DirectorySeparatorChar + "VERSIONS" + Path.DirectorySeparatorChar + "Update_Launcher"))
            {
                Directory.Delete(launcherDir + Path.DirectorySeparatorChar + "VERSIONS" + Path.DirectorySeparatorChar + "Update_Launcher", true);
                if (File.Exists(launcherDir + Path.DirectorySeparatorChar + "PACKAGES" + Path.DirectorySeparatorChar + "Update_Launcher.zip"))
                {
                    File.Delete(launcherDir + Path.DirectorySeparatorChar + "PACKAGES" + Path.DirectorySeparatorChar + "Update_Launcher.zip");
                }
            }
        }
コード例 #2
0
        public MainForm()
        {
            InitializeComponent();

            mf = this;
            FormSync.SyncObject = this;

            versionLabel.Text = "v" + launcherVer;


            if (new DirectoryInfo(launcherDir).Name == "Launcher")
            {
                MessageBox.Show("This is the wrong file. Please run the Launcher.exe located in the same root directory where your VERSIONS and PACKAGES folder reside. If that exe is missing, you can copy this one to that location and run it from there.");
                Environment.Exit(-1);
            }

            var preAnchorLeftPanelSize = new Size(pnLeftSide.Width, pnLeftSide.Height - btnVersionDownloader.Height);

            sideversionForm = new SidebarVersionsPanel
            {
                BackColor = pnLeftSide.BackColor,
                TopLevel  = false
            };
            pnLeftSide.Controls.Add(sideversionForm);
            sideversionForm.Location = new Point(0, 0);
            sideversionForm.Size     = preAnchorLeftPanelSize;
            sideversionForm.Anchor   = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;

            sideversionForm.Show();

            sideinfoForm = new SidebarInfoPanel
            {
                BackColor = pnLeftSide.BackColor,
                TopLevel  = false
            };
            pnLeftSide.Controls.Add(sideinfoForm);
            sideinfoForm.Location = new Point(0, 0);
            sideinfoForm.Size     = preAnchorLeftPanelSize;
            sideinfoForm.Anchor   = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;

            RewireMouseMove();

            //creating default folders
            if (!Directory.Exists(launcherDir + Path.DirectorySeparatorChar + "VERSIONS" + Path.DirectorySeparatorChar))
            {
                Directory.CreateDirectory(launcherDir + Path.DirectorySeparatorChar + "VERSIONS" + Path.DirectorySeparatorChar);
            }

            if (!Directory.Exists(launcherDir + Path.DirectorySeparatorChar + "PACKAGES" + Path.DirectorySeparatorChar))
            {
                Directory.CreateDirectory(launcherDir + Path.DirectorySeparatorChar + "PACKAGES" + Path.DirectorySeparatorChar);
            }

            if (File.Exists(launcherDir + Path.DirectorySeparatorChar + "PACKAGES\\dev.txt"))
            {
                webResourceDomain = devServer;
            }
            else if (File.Exists(launcherDir + Path.DirectorySeparatorChar + "PACKAGES\\historical.txt"))
            {
                webResourceDomain = historicalServer;
            }
            else
            {
                webResourceDomain = releaseServer;
            }

            if (File.Exists(launcherDir + Path.DirectorySeparatorChar + "PACKAGES\\build.txt"))
            {
                buildFolder = File.ReadAllText(launcherDir + Path.DirectorySeparatorChar + "PACKAGES\\build.txt");
            }

            //Will trigger after an update from the original launcher
            if (Directory.Exists(launcherDir + Path.DirectorySeparatorChar + "VERSIONS" + Path.DirectorySeparatorChar + "Update_Launcher"))
            {
                Directory.Delete(launcherDir + Path.DirectorySeparatorChar + "VERSIONS" + Path.DirectorySeparatorChar + "Update_Launcher", true);
                if (File.Exists(launcherDir + Path.DirectorySeparatorChar + "PACKAGES" + Path.DirectorySeparatorChar + "Update_Launcher.zip"))
                {
                    File.Delete(launcherDir + Path.DirectorySeparatorChar + "PACKAGES" + Path.DirectorySeparatorChar + "Update_Launcher.zip");
                }
            }
        }