Exemplo n.º 1
0
        void DownloadLauncher()
        {
            using (WebClient client = new WebClient())
            {
                string address = string.Format("{0}/api/download/launcher/get/{1}/{2}", Domain, mPlatform.ToString(), mServerLauncherVersion.ToString());
                string file    = GetLauncherPath("Update.exe");

                DownloadProgressWindow window = new DownloadProgressWindow(client, mLauncherRelease);
                client.DownloadFileAsync(new Uri(address), file);
                Application.Run(window);
                if (window.Success)
                {
                    Process.Start(file, "/action updatelauncher");
                }
            }
        }
Exemplo n.º 2
0
        void DownloadGame()
        {
            Application.Run(new UpdateWindow(mBuildRelease));

            using (WebClient client = new WebClient())
            {
                string address = string.Format("{0}/api/download/build/get/{1}/{2}", Domain, mPlatform.ToString(), mServerGameVersion.Value.ToString());
                string file    = GetLauncherPath("Game.zip");

                DownloadProgressWindow window = new DownloadProgressWindow(client, mBuildRelease);
                client.DownloadFileAsync(new Uri(address), file);
                Application.Run(window);
                if (window.Success)
                {
                    FastZip zip = new FastZip();
                    Directory.Delete(GetGamePath(null), true);
                    zip.ExtractZip(file, GetGamePath(null), null);

                    File.Delete(file);

                    File.WriteAllText(GetLauncherPath("manifest.ini"), String.Format("version = {0}", mServerGameVersion.Value.ToString()));
                }
            }
        }