public void MainWindow_OnClosing(object sender, CancelEventArgs e) { if (AssembliesWorker.IsBusy && e != null) { AssembliesWorker.CancelAsync(); e.Cancel = true; Hide(); return; } try { Utility.MapClassToXmlFile(typeof(Config), Config.Instance, Directories.ConfigFilePath); } catch { System.Windows.MessageBox.Show(Utility.GetMultiLanguageText("ConfigWriteError")); } KeyboardHook.UnHook(); InjectThread.Abort(); var allAssemblies = new List <LeagueSharpAssembly>(); foreach (var profile in Config.Instance.Profiles) { allAssemblies.AddRange(profile.InstalledAssemblies.ToList()); } Utility.ClearDirectory(Directories.AssembliesDir); Utility.ClearDirectory(Directories.LogsDir); SvnUpdater.ClearUnusedRepos(allAssemblies); }
public void ListAssemblies(string location, bool isSvn, string autoInstallName = null) { AbleToList = false; var bgWorker = new BackgroundWorker(); if (!isSvn) { bgWorker.DoWork += delegate { FoundAssemblies = LeagueSharpAssemblies.GetAssemblies(location); }; } else { bgWorker.DoWork += delegate { var updatedDir = SvnUpdater.Update(location, Logs.MainLog, Directories.RepositoryDir); FoundAssemblies = LeagueSharpAssemblies.GetAssemblies(Path.Combine(updatedDir, "trunk"), location); foreach (var assembly in FoundAssemblies) { if (autoInstallName != null && assembly.Name.ToLower() == autoInstallName.ToLower()) { assembly.InstallChecked = true; } } }; } bgWorker.RunWorkerCompleted += delegate { if (controller != null) { controller.CloseAsync(); controller = null; } AbleToList = true; System.Windows.Application.Current.Dispatcher.Invoke(() => installTabControl.SelectedIndex++); if (autoInstallName != null) { InstallSelected(); } }; bgWorker.RunWorkerAsync(); }
private void UpdateButton_OnClick(object s, RoutedEventArgs e) { var bw = new BackgroundWorker(); bw.DoWork += delegate { Application.Current.Dispatcher.Invoke( () => OnProgressStart(UpdateButton, UpdateLog, () => UpdateProgress)); if (Config.Repositories.Count == 0) { Utility.Log(LogStatus.Info, "No Repositories", UpdateLog); } Parallel.ForEach(Config.Repositories, repository => { SvnUpdater.Update(repository, UpdateLog, _repositoryDir); Application.Current.Dispatcher.Invoke(() => UpdateProgress++); }); }; bw.RunWorkerCompleted += (sender, args) => OnProgressFinish(UpdateButton, "Update"); bw.RunWorkerAsync(); }
public void MainWindow_OnClosing(object sender, CancelEventArgs e) { if (BgWorker.IsBusy && e != null) { BgWorker.CancelAsync(); e.Cancel = true; Hide(); return; } Utility.MapClassToXmlFile(typeof(Config), Config, "config.xml"); KeyboardHook.UnHook(); InjectThread.Abort(); var allAssemblies = new List <LeagueSharpAssembly>(); foreach (var profile in Config.Profiles) { allAssemblies.AddRange(profile.InstalledAssemblies.ToList()); } Utility.ClearDirectory(Directories.AssembliesDir); SvnUpdater.ClearUnusedRepos(allAssemblies); }
public static SvnUpdateResult SvnUpdate(this ICakeContext context, DirectoryPath directoryPath, SvnUpdateSettings settings) { var svnUpdater = new SvnUpdater(context.Environment, SvnClientFactoryMethod); return(svnUpdater.Update(directoryPath, settings ?? new SvnUpdateSettings())); }