private void sync(bool saveChangeList) { HandleDownloadProgressEvent(null, new DownloadProgressEventArgs { BytesTotal = -1 }); HandleUpdateProgressEvent(null, new DownloadProgressEventArgs { BytesTotal = -1 }); Program.LoadedServer.DownloadProgressEvent += HandleDownloadProgressEvent; Program.LoadedServer.UpdateProgressEvent += HandleUpdateProgressEvent; MessageBox.Show(Strings.AboutToFetchMods); Stopwatch Sw = new Stopwatch(); Task t = Task.Factory.StartNew(() => { SetTextBoxes(false); SetLoadButton(false); SetSyncButton(false); Sw.Start(); statusStrip.Text = Strings.FetchingChangesStatus; SetProgressLabels(Strings.FetchingChangesStatus); FailedChanges = Program.LoadedServer.FetchChanges(Program.LoadedServer.GetLocalPath(), Remote.GetModFolderHashes(Program.LoadedServer.GetServerFileUri()), saveChangeList); /* * No longer needed due to TS 3.1 * if (TeamSpeakPlugin.TeamSpeakInstalled()) * { * logger.Info("TeamSpeak install detected at {0}", TeamSpeakPlugin.TeamSpeakPath()); * var TeamSpeakPlugins = TeamSpeakPlugin.GetModFoldersWithPlugins(Program.LoadedServer.GetLoadedMods(), Program.LoadedServer.GetLocalPath().ToString()); * TeamSpeak.FindAndCopyTeamSpeakPlugin(TeamSpeakPlugins, Program.LoadedServer.GetLocalPath(), new DirectoryInfo(TeamSpeakPlugin.TeamSpeakPath())); * } */ // Do the same with user configs if (ArmA.IsInstalled()) { // Just in case ArmA isn't installed (why someone is installing mods is another issue..), to prevent any errors //var UserConfigs = UserConfig.GetModFoldersWithUserConfigs(Program.LoadedServer.GetLoadedMods(), Program.LoadedServer.GetLocalPath().ToString()); UserConfig.CopyUserConfigs(Program.LoadedServer.GetLoadedMods(), Program.LoadedServer.GetLocalPath()); try { Bikey.CopyBiKeys(Program.LoadedServer.GetLoadedMods(), Program.LoadedServer.GetLocalPath()); } catch (IOException ex) { // Just log, we don't care logger.Warn(ex); } // Generate and install Arma3 Launcher preset Local local = ArmALauncher.ReadLocal(); local = ArmALauncher.UpdateLocal(Program.LoadedServer.GetLoadedMods(), local, Program.LoadedServer.GetLocalPath().FullName); ArmALauncher.WriteLocal(local); string preset = ArmALauncher.GeneratePreset(Program.LoadedServer.GetLocalPath().FullName, Program.LoadedServer.GetLoadedMods(), Program.LoadedServer.Dlcs); ArmALauncher.WritePreset(preset, Program.LoadedServer.GetServerFile().ServerName); } }).ContinueWith(x => { Program.LoadedServer.DownloadProgressEvent -= HandleDownloadProgressEvent; Program.LoadedServer.UpdateProgressEvent -= HandleUpdateProgressEvent; Sw.Stop(); SetSyncButton(true); SetTextBoxes(true); SetLoadButton(true); statusStrip.Text = string.Format(Strings.ChangesFetchedIn, Sw.Elapsed.ToString()); if (FailedChanges > 0) { if ( MessageBox.Show( string.Format( Strings.FailedToAcquire, FailedChanges), Strings.Error, MessageBoxButtons.RetryCancel, MessageBoxIcon.Error) == DialogResult.Retry) { load(); } } else { MessageBox.Show(string.Format(Strings.FetchedModsIn, Sw.Elapsed.ToString())); } }); }