Пример #1
0
        private void frmMain_Shown(object sender, EventArgs e)
        {
            // Position
            // TODO: Subtract Vista/Win7 Taskbar height..
            //Location = new Point(Location.X, Location.Y + (ClientSize.Height / 2));

            mRegistry = new RegHelper();
            if (mRegistry.Initialize() == false)
            {
                MessageBox.Show("Failed to access the registry!\nPlease check your user access.", "Patch error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                Close();
                return;
            }

            if (mRegistry.FirstRun)
            {
                // First start, reset patches
                mRegistry.PatchReset(0);
            }

            UpdateStatus("Loading server status..");
            Application.DoEvents();
            CheckStatus();
            Application.DoEvents();

            if (mRegistry.SearchPatcherUpdates())
            {
                mRegistry.SetLastPatcherUpdate();

                UpdateStatus("Searching for patcher updates..");
                UpdateHandler uHandler = new UpdateHandler();
                var           asm      = System.Reflection.Assembly.GetExecutingAssembly();
                if (uHandler.CheckVersion(asm, URL_PATCHER_UPDATE) == true && uHandler.StartUpdate() == true)
                {
                    UpdateStatus("Patcher update found. Start download..");
                    Close();
                    return;
                }
            }
            btnGameStart.Enabled              = false;
            mPatches                          = new ClientPatchList();
            mPatches.OnPatchProgressComplete += ProgressPatches;
            mPatches.Download(URL_PATCHER_PATCHES + "Patches.xml");
        }
Пример #2
0
		private void frmMain_Shown(object sender, EventArgs e) {
			// Position
			// TODO: Subtract Vista/Win7 Taskbar height..
			//Location = new Point(Location.X, Location.Y + (ClientSize.Height / 2));

			mRegistry = new RegHelper();
			if (mRegistry.Initialize() == false) {
				MessageBox.Show("Failed to access the registry!\nPlease check your user access.", "Patch error", MessageBoxButtons.OK, MessageBoxIcon.Error);
				Close();
				return;
			}

			if (mRegistry.FirstRun) {
				// First start, reset patches
				mRegistry.PatchReset(0);
			}

			UpdateStatus("Loading server status..");
			Application.DoEvents();
			CheckStatus();
			Application.DoEvents();

			if (mRegistry.SearchPatcherUpdates()) {
				mRegistry.SetLastPatcherUpdate();

				UpdateStatus("Searching for patcher updates..");
				UpdateHandler uHandler = new UpdateHandler();
				var asm = System.Reflection.Assembly.GetExecutingAssembly();
				if (uHandler.CheckVersion(asm, URL_PATCHER_UPDATE) == true && uHandler.StartUpdate() == true) {
					UpdateStatus("Patcher update found. Start download..");
					Close();
					return;
				}
			}
			btnGameStart.Enabled = false;
			mPatches = new ClientPatchList();
			mPatches.OnPatchProgressComplete += ProgressPatches;
			mPatches.Download(URL_PATCHER_PATCHES + "Patches.xml");
		}