public async void Install(IEnumerable <AddonToInstall> addons) { IsWorking = true; await Task.Run(() => { AddonInstaller.PerformInstall(Url, addons); }); if (IsActive && addons.All(a => a.Success)) { Close(); } IsWorking = false; }
public IEnumerable <AddonToInstall> GetAddons() { try { var foundProjects = AddonInstaller.GetProjectsFromRepo(RepoHolder.GetRemoteAddonRepositoryDirectory()); return (foundProjects.Select(p => new Tuple <string, bool>(p, Settings.Instance.InstalledAddons.IsAddonInstalled(Url, p))) .Select(t => new AddonToInstall(t.Item1, ProjectsToInstall.Contains(Path.GetFileNameWithoutExtension(t.Item1)), !t.Item2, t.Item2 ? "Installed" : ""))); } catch (Exception e) { Log.Instance.DoLog(string.Format("Unexpected error while searching for project files during addon installation. Exception: {0}", e), Log.LogType.Error); return(new[] { new AddonToInstall("Error while getting project files", false, false, "Error") }); } }
internal static void Process(string url) { var uri = new Uri(url); switch (uri.Authority) { case "install": var host = HttpUtility.ParseQueryString(uri.Query).Get("host"); var projects = HttpUtility.ParseQueryString(uri.Query).Get("project") ?? ""; AddonInstaller.InstallAddonsFromRepo(host, projects.Split(';')); break; default: //legacy var urischeme = Constants.UriSchemePrefix + "://"; url = url.Replace(urischeme, "https://github.com/"); AddonInstaller.InstallAddonsFromRepo(url); break; } }
private void Finish() { Hide(); var configuration = Settings.Instance.Configuration; var properties = configuration.GetType().GetProperties(); var settings = SelectedSettings.GroupBy(s => s.Behavior); foreach (var g in settings) { switch (g.Key) { case WizardStep.WizardStepBehavior.Toggle: foreach (var step in g) { var property = properties.FirstOrDefault(p => p.Name == step.Tag); if (property != null) { property.SetValue(configuration, step.Value); } } break; case WizardStep.WizardStepBehavior.Install: var repositories = g.GroupBy(s => s.Tag.Split(';')[0]); foreach (var repo in repositories) { AddonInstaller.InstallAddonsFromRepo(repo.Key, repo.Select(s => s.Tag.Split(';')[1]).ToArray()); } break; case WizardStep.WizardStepBehavior.Text: break; } } Close(); }
private void ProcessInstallRequest(bool remoteAddon, string requestString) { if (!remoteAddon) { //TODO: check for valid path var args = new Dictionary <string, object> { { "projectPath", requestString } }; var taskWindow = new TaskWindow { Owner = Owner }; Hide(); taskWindow.WindowTitle = MultiLanguage.Text.TitleTaskAddonInstaller; taskWindow.BeginTask(new TaskWindow.TaskWindowDelegate[] { InstallLocalAddon }, args); if (taskWindow.Success) { Close(); } else { Show(); MessageBox.Show( string.Format(MultiLanguage.Text.ErrorFailedToInstallAddon, Path.GetFileNameWithoutExtension(LocalAddonTextBox.Text)), MultiLanguage.Text.TitleTaskAddonInstaller, MessageBoxButton.OK, MessageBoxImage.Exclamation); } } else { Hide(); AddonInstaller.InstallAddonsFromRepo(requestString); Close(); } }