private void handleModDownload(bool install = false) { using (var tasker = new Tasks.Tasker(parentForm)) using (var taskerForm = new TaskerForm()) { tasker.AttachViews(new TaskerTaskbar(), taskerForm); tasker.SetStatusImage(Resources.sign_cogs); tasker.SetTitle(Resources.Processing); List <string> selectedMods = new List <string>(); foreach (ListViewItem item in modList.SelectedItems) { var mod = (Repository.Repository.Item)(item.Tag); tasker.AddTasks(GetItemDownloadTask(mod)); if (mod.Kind == Repository.Repository.ItemKind.Hmod) { selectedMods.Add(mod.RawName); } } if (install && selectedMods.Count > 0) { tasker.AddTasks(new MembootTasks(MembootTasks.MembootTaskType.MembootRecovery, forceRecoveryReload: false)); tasker.AddTask(ShellTasks.ShellCommand("touch /user-recovery.flag")); tasker.AddTask(ShellTasks.ShellCommand("touch /mod-recovery.flag")); tasker.AddTask(ShellTasks.MountBase); tasker.AddTask((Tasker innerTasker, object syncObject) => { tasker.AddTasks(new MembootTasks(MembootTasks.MembootTaskType.ProcessMods, selectedMods.ToArray())); return(Conclusion.Success); }); } tasker.Start(); foreach (var mod in selectedMods) { var found = installedMods.Where((o) => o.RawName.Equals(mod, System.StringComparison.CurrentCultureIgnoreCase)).ToArray(); foreach (var foundMod in found) { installedMods.Remove(foundMod); } } installedMods.AddRange(Hmod.Hmod.GetMods(true, selectedMods.ToArray(), parentForm)); CoreCollection.HmodInfo = installedMods.ToArray(); CoreCollection.Load(); } }
public Item[] LoadTasker(Form hostForm) { using (var tasker = new Tasks.Tasker(hostForm)) { tasker.AttachViews(new TaskerTaskbar(), new TaskerForm()); tasker.SetStatusImage(Resources.sign_cogs); tasker.SetTitle("Loading Repository"); tasker.AddTask(LoadTask); if (tasker.Start() == Tasker.Conclusion.Success) { return(Items.ToArray()); } return(null); } }
private void handleModDownload(bool install = false) { using (var tasker = new Tasks.Tasker(parentForm)) { tasker.AttachViews(new TaskerTaskbar(), new TaskerForm()); tasker.SetStatusImage(Resources.sign_cogs); tasker.SetTitle(Resources.Processing); List <string> selectedMods = new List <string>(); foreach (ListViewItem item in modList.SelectedItems) { var mod = (Repository.Repository.Item)(item.Tag); tasker.AddTasks(GetItemDownloadTask(mod)); if (mod.Kind == Repository.Repository.ItemKind.Hmod) { selectedMods.Add(mod.RawName); } } if (install && selectedMods.Count > 0) { tasker.AddTask(ShellTasks.MountBase); tasker.AddTasks(new MembootTasks(MembootTasks.MembootTaskType.ProcessMods, selectedMods.ToArray()).Tasks); tasker.AddTask(MembootTasks.BootHakchi); } tasker.Start(); foreach (var mod in selectedMods) { var found = installedMods.Where((o) => o.RawName.Equals(mod, System.StringComparison.CurrentCultureIgnoreCase)).ToArray(); foreach (var foundMod in found) { installedMods.Remove(foundMod); } } installedMods.AddRange(Hmod.Hmod.GetMods(true, selectedMods.ToArray(), parentForm)); } }