public void InstallSelected() { var amount = FoundAssemblies.Count(a => a.InstallChecked); foreach (var assembly in FoundAssemblies.ToArray()) { if (assembly.InstallChecked) { if (assembly.Compile()) { if ( Config.Instance.SelectedProfile.InstalledAssemblies.All( a => a.Name != assembly.Name || a.SvnUrl != assembly.SvnUrl)) { Config.Instance.SelectedProfile.InstalledAssemblies.Add(assembly); FoundAssemblies.Remove(assembly); } amount--; } } } FoundAssemblies.Where(a => !string.IsNullOrEmpty(a.SvnUrl)).ToList().ForEach(x => GitUpdater.ClearUnusedRepoFolder(x.PathToProjectFile, Logs.MainLog)); if (amount == 0) { AfterInstallMessage(Utility.GetMultiLanguageText("SuccessfullyInstalled"), true); } else { AfterInstallMessage(Utility.GetMultiLanguageText("ErrorInstalling")); } }
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 = GitUpdater.Update(location, Logs.MainLog, Directories.RepositoryDir); FoundAssemblies = LeagueSharpAssemblies.GetAssemblies(updatedDir, location); foreach (var assembly in FoundAssemblies.ToArray()) { List <LeagueSharpAssembly> assemblies = Config.Instance.SelectedProfile.InstalledAssemblies.Where( y => y.Name == assembly.Name && y.SvnUrl == assembly.SvnUrl).ToList(); assemblies.ForEach(a => FoundAssemblies.Remove(a)); } 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; Application.Current.Dispatcher.Invoke(() => installTabControl.SelectedIndex++); if (autoInstallName != null) { InstallSelected(); } }; bgWorker.RunWorkerAsync(); }