public static void InstallZipFromFile(Control parent, InstallProgram install) { using (var dlg = new OpenFileDialog { Filter = TextUtil.FileDialogFiltersAll(TextUtil.FileDialogFilter( Resources.ConfigureToolsDlg_AddFromFile_Zip_Files, ToolDescription.EXT_INSTALL)), Multiselect = false }) { if (dlg.ShowDialog(parent) == DialogResult.OK) { InstallZipTool(parent, dlg.FileName, install); } } }
private void InstallerWorkerMethod() { try { Console.WriteLine(); string localNuterra = Path.Combine(Directory.GetCurrentDirectory(), "Nuterra_Data"); var info = new ModificationInfo(); info.TerraTechRoot = Path.GetDirectoryName(installSettings.TerraTechRoot); info.NuterraData = localNuterra; info.InitDefaults(); Console.WriteLine("Modding Assembly-CSharp.dll"); InstallProgram.PerformInstall(info); Console.WriteLine(); if (!ArePathsEqual(Directory.GetCurrentDirectory(), info.TerraTechRoot)) { CopyNuterraFiles(info, localNuterra); } else { Console.WriteLine("You are running the installer from the terratech root directory, copying files is skipped"); } Console.WriteLine(); Console.WriteLine("Install succesfull"); Console.WriteLine("Enjoy Nuterra :3"); } catch (Exception ex) { Console.WriteLine(); Console.WriteLine(ex.StackTrace); Console.WriteLine(); Console.WriteLine(ex.Message); Console.WriteLine("Install failed"); } finally { _installerThread = null; Invoke(new Action(() => { UpdateFromInstallSettings(logEvents: false); })); } }
public static void InstallZipFromWeb(Control parent, InstallProgram install) { try { IList <ToolStoreItem> toolStoreItems = null; using (var dlg = new LongWaitDlg { Message = Resources.ConfigureToolsDlg_AddFromWeb_Contacting_the_server }) { dlg.PerformWork(parent, 1000, () => { toolStoreItems = ToolStoreUtil.ToolStoreClient.GetToolStoreItems(); }); } if (toolStoreItems == null || toolStoreItems.Count == 0) { MessageDlg.Show(parent, Resources.ConfigureToolsDlg_AddFromWeb_Unknown_error_connecting_to_the_tool_store); } using (var dlg = new ToolStoreDlg(ToolStoreUtil.ToolStoreClient, toolStoreItems)) { if (dlg.ShowDialog(parent) == DialogResult.OK) { InstallZipTool(parent, dlg.DownloadPath, install); } } } catch (TargetInvocationException x) { if (x.InnerException is ToolExecutionException || x.InnerException is WebException) { MessageDlg.Show(parent, String.Format(Resources.ConfigureToolsDlg_GetZipFromWeb_Error_connecting_to_the_Tool_Store___0_, x.Message)); } else if (x.InnerException is JsonReaderException) { MessageDlg.Show(parent, Resources.ToolInstallUI_InstallZipFromWeb_The_server_returned_an_invalid_response__It_might_be_down_for_maintenance__Please_check_the_Tool_Store_on_the_skyline_ms_website_); } else { throw; } } }
public static void InstallZipFromWeb(Control parent, InstallProgram install) { try { IList <ToolStoreItem> toolStoreItems = null; using (var dlg = new LongWaitDlg { Message = Resources.ConfigureToolsDlg_AddFromWeb_Contacting_the_server }) { dlg.PerformWork(parent, 1000, () => { toolStoreItems = ToolStoreUtil.ToolStoreClient.GetToolStoreItems(); }); } if (toolStoreItems == null || toolStoreItems.Count == 0) { MessageDlg.Show(parent, Resources.ConfigureToolsDlg_AddFromWeb_Unknown_error_connecting_to_the_tool_store); } using (var dlg = new ToolStoreDlg(ToolStoreUtil.ToolStoreClient, toolStoreItems)) { if (dlg.ShowDialog(parent) == DialogResult.OK) { InstallZipTool(parent, dlg.DownloadPath, install); } } } catch (TargetInvocationException x) { if (x.InnerException is ToolExecutionException || x.InnerException is WebException) { MessageDlg.Show(parent, String.Format(Resources.ConfigureToolsDlg_GetZipFromWeb_Error_connecting_to_the_Tool_Store___0_, x.Message)); } else { throw; } } }
/// <summary> /// Copy a zip file's contents to the tools folder and loop through its .properties /// files adding the tools to the tools menu. /// </summary> /// <param name="parent">Parent window for alerts and forms</param> /// <param name="fullpath">The full path to the zipped folder containing the tools</param> /// <param name="install">Installation function</param> public static void InstallZipTool(Control parent, string fullpath, InstallProgram install) { ToolInstaller.UnzipToolReturnAccumulator result = null; var toolListStart = ToolList.CopyTools(Settings.Default.ToolList); Exception xFailure = null; try { result = ToolInstaller.UnpackZipTool(fullpath, new InstallZipToolHelper(parent, install)); } catch (ToolExecutionException x) { MessageDlg.ShowException(parent, x); } catch (Exception x) { xFailure = x; } if (xFailure != null) { MessageDlg.ShowWithException(parent, TextUtil.LineSeparate(String.Format(Resources.ConfigureToolsDlg_UnpackZipTool_Failed_attempting_to_extract_the_tool_from__0_, Path.GetFileName(fullpath)), xFailure.Message), xFailure); } if (result != null) { foreach (var message in result.MessagesThrown) { MessageDlg.Show(parent, message); } } else { // If result is Null, then we want to discard changes made to the ToolsList Settings.Default.ToolList = toolListStart; } }
public InstallZipToolHelper(Control parent, InstallProgram installProgram) { _parent = parent; _installProgram = installProgram; }
public static void InstallZipFromFile(Control parent, InstallProgram install) { using (var dlg = new OpenFileDialog { Filter = TextUtil.FileDialogFiltersAll(TextUtil.FileDialogFilter( Resources.ConfigureToolsDlg_AddFromFile_Zip_Files, ".zip")), // Not L10N Multiselect = false }) { if (dlg.ShowDialog(parent) == DialogResult.OK) InstallZipTool(parent, dlg.FileName, install); } }
public InstallZipToolHelper(InstallProgram installProgram) { _installProgram = installProgram; }
/// <summary> /// Copy a zip file's contents to the tools folder and loop through its .properties /// files adding the tools to the tools menu. /// </summary> /// <param name="parent">Parent window for alerts and forms</param> /// <param name="fullpath">The full path to the zipped folder containing the tools</param> /// <param name="install">Installation function</param> public static void InstallZipTool(Control parent, string fullpath, InstallProgram install) { ToolInstaller.UnzipToolReturnAccumulator result = null; var toolListStart = ToolList.CopyTools(Settings.Default.ToolList); Exception xFailure = null; try { result = ToolInstaller.UnpackZipTool(fullpath, new InstallZipToolHelper(install)); } catch (ToolExecutionException x) { MessageDlg.ShowException(parent, x); } catch (Exception x) { xFailure = x; } if (xFailure != null) { MessageDlg.ShowWithException(parent, TextUtil.LineSeparate(String.Format(Resources.ConfigureToolsDlg_UnpackZipTool_Failed_attempting_to_extract_the_tool_from__0_, Path.GetFileName(fullpath)), xFailure.Message), xFailure); } if (result != null) { foreach (var message in result.MessagesThrown) { MessageDlg.Show(parent, message); } } else { // If result is Null, then we want to discard changes made to the ToolsList Settings.Default.ToolList = toolListStart; } }
public static void InstallZipFromWeb(Control parent, InstallProgram install) { try { IList<ToolStoreItem> toolStoreItems = null; using (var dlg = new LongWaitDlg { Message = Resources.ConfigureToolsDlg_AddFromWeb_Contacting_the_server }) { dlg.PerformWork(parent, 1000, () => { toolStoreItems = ToolStoreUtil.ToolStoreClient.GetToolStoreItems(); }); } if (toolStoreItems == null || toolStoreItems.Count == 0) { MessageDlg.Show(parent, Resources.ConfigureToolsDlg_AddFromWeb_Unknown_error_connecting_to_the_tool_store); } using (var dlg = new ToolStoreDlg(ToolStoreUtil.ToolStoreClient, toolStoreItems)) { if (dlg.ShowDialog(parent) == DialogResult.OK) InstallZipTool(parent, dlg.DownloadPath, install); } } catch (TargetInvocationException x) { if (x.InnerException.GetType() == typeof(ToolExecutionException) || x.InnerException is WebException) MessageDlg.Show(parent, String.Format(Resources.ConfigureToolsDlg_GetZipFromWeb_Error_connecting_to_the_Tool_Store___0_, x.Message)); else throw; } }