private void Form1_Load(object sender, EventArgs e) { btnPlay.Enabled = false; _settings = new SettingsManager(); _settings.LoadSettings(); _settings.SaveSettings(); _patcher = new ClientPatcher(_settings.GetDefault()); _patcher.FileScanned += Patcher_FileScanned; _patcher.StartedDownload += Patcher_StartedDownload; _patcher.ProgressedDownload += Patcher_ProgressedDownload; _patcher.EndedDownload += Patcher_EndedDownload; if (ApplicationDeployment.IsNetworkDeployed) { Version myVersion = ApplicationDeployment.CurrentDeployment.CurrentVersion; Text += string.Concat("- Version: v", myVersion); } RefreshDdl(); }
private void bgDownloadWorker_DoWork(object sender, DoWorkEventArgs e) { ClientPatcher myPatcher = (ClientPatcher)e.Argument; //myPatcher.DownloadFiles(); myPatcher.DownloadFilesAsync(); }
private void Form1_Load(object sender, EventArgs e) { // Create Patcher shortcut on user's desktop if not already present. CheckForShortcut(); btnPlay.Enabled = false; // Load user's profiles, refresh from web if necessary. _settings = new SettingsManager(); _settings.Refresh(); // Get the default profile settings. PatcherSettings ps = _settings.GetDefault(); // Load the type of client patcher we need for scanning the default profile. // Adds event handlers. _patcher = GetClientPatcher(ps, _patcher); // Set the create account button to display "create account" text. SetCreateAccountText(_patcher.CurrentProfile); SetWebAddress("http://openmeridian.org/forums/latestnews.php"); if (ApplicationDeployment.IsNetworkDeployed) { Version myVersion = ApplicationDeployment.CurrentDeployment.CurrentVersion; Text += string.Concat("- Version: v", myVersion); } // Make sure the default is our current selection, and the data is displayed in options. InitDdl(); SetPatcherProfile(ps); }
private void Form1_Load(object sender, EventArgs e) { btnPlay.Enabled = false; _settings = new SettingsManager(); _settings.LoadSettings(); _patcher = new ClientPatcher(_settings.GetDefault()); _patcher.FileScanned += Patcher_FileScanned; _patcher.StartedDownload += Patcher_StartedDownload; _patcher.ProgressedDownload += Patcher_ProgressedDownload; _patcher.EndedDownload += Patcher_EndedDownload; RefreshDdl(); }
private void bgScanWorker_DoWork(object sender, DoWorkEventArgs e) { ClientPatcher myPatcher = (ClientPatcher)e.Argument; myPatcher.ScanClient(); }
/// <summary> /// Load the type of client patcher we need for scanning the given profile. /// </summary> private ClientPatcher GetClientPatcher(PatcherSettings ps, ClientPatcher oldPatcher) { // If a patcher already exists, remove the event handlers. if (oldPatcher != null) { oldPatcher.FileScanned -= Patcher_FileScanned; oldPatcher.StartedDownload -= Patcher_StartedDownload; oldPatcher.ProgressedDownload -= Patcher_ProgressedDownload; oldPatcher.EndedDownload -= Patcher_EndedDownload; oldPatcher.FailedDownload -= Patcher_FailedDownload; oldPatcher.StartedUnzip -= Patcher_StartedUnzip; oldPatcher.ProgressedUnzip -= Patcher_ProgressedUnzip; oldPatcher.EndedUnzip -= Patcher_EndedUnzip; oldPatcher.FailedDependency -= Patcher_FailedDependency; } ClientPatcher newPatcher; if (ps.ClientType == ClientType.DotNet) newPatcher = new OgreClientPatcher(ps); else newPatcher = new ClassicClientPatcher(ps); // Add event handlers. newPatcher.FileScanned += Patcher_FileScanned; newPatcher.StartedDownload += Patcher_StartedDownload; newPatcher.ProgressedDownload += Patcher_ProgressedDownload; newPatcher.EndedDownload += Patcher_EndedDownload; newPatcher.FailedDownload += Patcher_FailedDownload; newPatcher.StartedUnzip += Patcher_StartedUnzip; newPatcher.ProgressedUnzip += Patcher_ProgressedUnzip; newPatcher.EndedUnzip += Patcher_EndedUnzip; newPatcher.FailedDependency += Patcher_FailedDependency; return newPatcher; }
/// <summary> /// Selected a new profile. /// </summary> private void SetPatcherProfile(PatcherSettings profile) { // Don't set to null profile. if (profile == null) return; // In case we clicked out from Add Profile. if (_changetype == ChangeType.AddProfile) { _changetype = ChangeType.None; groupProfileSettings.Enabled = false; } if (_patcher.CurrentProfile.ClientType != profile.ClientType) _patcher = GetClientPatcher(profile, _patcher); else _patcher.CurrentProfile = profile; txtLog.Text += String.Format("Server {0} selected. Client located at: {1}\r\n", profile.ServerName, profile.ClientFolder); btnPlay.Enabled = false; // Set create account text. SetCreateAccountText(_patcher.CurrentProfile); _creatingAccount = false; //if (groupProfileSettings.Enabled != true) return; //groupProfileSettings.Enabled = false; // Set the Options tab data fields to the current selection. SetProfileDataFields(profile); }