internal static void SaveOptionsGroup(String[] parameterNames, String[] parameterValues, String[] passwordNames, String[] passwordValues) { ConfigUtil.UpdateParameters(parameterNames, parameterValues); PasswordUtil.UpdateParameters(passwordNames, passwordValues); }
internal static bool InstallProcedure(Form1 form, ProgressBar installProgressBar, TextBox installTextBox, String culture) { try { String destinationPath = form.destinationPathTextBox.Text; bool onlySetPermissions = false; if (Directory.Exists(destinationPath)) { DirectoryInfo destinationDir = new DirectoryInfo(destinationPath); FileInfo[] destinationFiles = destinationDir.GetFiles(); if (destinationFiles.Length > 0) { bool alreadyExistsDtPad = SearchDtPadFiles(destinationFiles); String warningMessage = alreadyExistsDtPad ? "DestinationDirWithDtPad" : "DestinationDirWithFiles"; if (WindowManager.ShowWarningBox(form, LanguageUtil.GetCurrentLanguageString(warningMessage, className, culture), culture) != DialogResult.Yes) { installTextBox.Text = LanguageUtil.GetCurrentLanguageString("InstallInterrupted", className, culture); return(false); } if (alreadyExistsDtPad) { onlySetPermissions = true; } } } installProgressBar.Value = 0; installTextBox.Text = LanguageUtil.GetCurrentLanguageString("PreparingInstall", className, culture); form.Refresh(); //Directories installTextBox.Text += Environment.NewLine + LanguageUtil.GetCurrentLanguageString("CreatingDir", className, culture); CreateDirAndSetPermissions(destinationPath); CreateDirAndSetPermissions(Path.Combine(destinationPath, "Guides")); CreateDirAndSetPermissions(Path.Combine(destinationPath, "Icons")); CreateDirAndSetPermissions(Path.Combine(destinationPath, "Icons\\JL")); CreateDirAndSetPermissions(Path.Combine(destinationPath, "Languages")); CreateDirAndSetPermissions(Path.Combine(destinationPath, "Logs")); CreateDirAndSetPermissions(Path.Combine(destinationPath, "SupportFiles")); CreateDirAndSetPermissions(Path.Combine(destinationPath, "InternetCache")); installProgressBar.PerformStep(); //Executables and libraries installTextBox.Text += Environment.NewLine + LanguageUtil.GetCurrentLanguageString("ExtractingFile", className, culture); form.Refresh(); WriteFileAndSetPermissions(Path.Combine(destinationPath, "DtPad.exe"), FileResource.DtPad_exe); WriteFileAndSetPermissions(Path.Combine(destinationPath, "DtPadUpdater.exe"), FileResource.DtPadUpdater_exe); WriteFileAndSetPermissions(Path.Combine(destinationPath, "DtHelp.exe"), FileResource.DtHelp_exe); WriteFileAndSetPermissions(Path.Combine(destinationPath, "DtPadUninstaller.exe"), FileResource.DtPadUninstaller_exe); WriteFileAndSetPermissions(Path.Combine(destinationPath, "DevExpress.Data.v12.1.dll"), FileResource.DevExpress_Data_v12_1_dll); WriteFileAndSetPermissions(Path.Combine(destinationPath, "DevExpress.Utils.v12.1.dll"), FileResource.DevExpress_Utils_v12_1_dll); WriteFileAndSetPermissions(Path.Combine(destinationPath, "DevExpress.XtraEditors.v12.1.dll"), FileResource.DevExpress_XtraEditors_v12_1_dll); WriteFileAndSetPermissions(Path.Combine(destinationPath, "log4net.dll"), FileResource.log4net_dll); WriteFileAndSetPermissions(Path.Combine(destinationPath, "ICSharpCode.SharpZipLib.dll"), FileResource.ICSharpCode_SharpZipLib_dll); WriteFileAndSetPermissions(Path.Combine(destinationPath, "DtControls.dll"), FileResource.DtControls_dll); WriteFileAndSetPermissions(Path.Combine(destinationPath, "itextsharp.dll"), FileResource.itextsharp_dll); WriteFileAndSetPermissions(Path.Combine(destinationPath, "Be.Windows.Forms.HexBox.dll"), FileResource.Be_Windows_Forms_HexBox_dll); WriteFileAndSetPermissions(Path.Combine(destinationPath, "XmlGridControl.dll"), FileResource.XmlGridControl_dll); WriteFileAndSetPermissions(Path.Combine(destinationPath, "MonthCalendar.dll"), FileResource.MonthCalendar_dll); WriteFileAndSetPermissions(Path.Combine(destinationPath, "AppLimit.CloudComputing.SharpBox.dll"), FileResource.AppLimit_CloudComputing_SharpBox_dll); WriteFileAndSetPermissions(Path.Combine(destinationPath, "Newtonsoft.Json.dll"), FileResource.Newtonsoft_Json_dll); WriteFileAndSetPermissions(Path.Combine(destinationPath, "Microsoft.WindowsAPICodePack.dll"), FileResource.Microsoft_WindowsAPICodePack_dll); WriteFileAndSetPermissions(Path.Combine(destinationPath, "Microsoft.WindowsAPICodePack.Shell.dll"), FileResource.Microsoft_WindowsAPICodePack_Shell_dll); WriteFileAndSetPermissions(Path.Combine(destinationPath, "Hunspellx86.dll"), FileResource.Hunspellx86_dll); WriteFileAndSetPermissions(Path.Combine(destinationPath, "Hunspellx64.dll"), FileResource.Hunspellx64_dll); WriteFileAndSetPermissions(Path.Combine(destinationPath, "NHunspell.dll"), FileResource.NHunspell_dll); WriteFileAndSetPermissions(Path.Combine(destinationPath, "LumenWorks.Framework.IO.dll"), FileResource.LumenWorks_Framework_IO_dll); installProgressBar.PerformStep(); //Support files WriteFileAndSetPermissions(Path.Combine(destinationPath, "SupportFiles\\DtPad.exe.fv"), FileResource.DtPad_exe_fv, onlySetPermissions); WriteFileAndSetPermissions(Path.Combine(destinationPath, "SupportFiles\\DtPad.exe.ex"), FileResource.DtPad_exe_ex, onlySetPermissions); WriteFileAndSetPermissions(Path.Combine(destinationPath, "SupportFiles\\DtPad.exe.no"), FileResource.DtPad_exe_no, onlySetPermissions); WriteFileAndSetPermissions(Path.Combine(destinationPath, "SupportFiles\\DtPad.exe.rf"), FileResource.DtPad_exe_rf, onlySetPermissions); WriteFileAndSetPermissions(Path.Combine(destinationPath, "SupportFiles\\DtPad.exe.rs"), FileResource.DtPad_exe_rs, onlySetPermissions); WriteFileAndSetPermissions(Path.Combine(destinationPath, "SupportFiles\\DtPad.exe.rp"), FileResource.DtPad_exe_rp, onlySetPermissions); WriteFileAndSetPermissions(Path.Combine(destinationPath, "SupportFiles\\DtPad.exe.sh"), FileResource.DtPad_exe_sh, onlySetPermissions); WriteFileAndSetPermissions(Path.Combine(destinationPath, "SupportFiles\\DtPad.exe.to"), FileResource.DtPad_exe_to, onlySetPermissions); WriteFileAndSetPermissions(Path.Combine(destinationPath, "SupportFiles\\DtPad.exe.tm"), FileResource.DtPad_exe_tm, onlySetPermissions); WriteFileAndSetPermissions(Path.Combine(destinationPath, "SupportFiles\\DtPad.exe.cl"), FileResource.DtPad_exe_cl, onlySetPermissions); WriteFileAndSetPermissions(Path.Combine(destinationPath, "SupportFiles\\DtPad.exe.sf"), FileResource.DtPad_exe_sf, onlySetPermissions); WriteFileAndSetPermissions(Path.Combine(destinationPath, "SupportFiles\\DtPad.exe.ru"), FileResource.DtPad_exe_ru, onlySetPermissions); WriteFileAndSetPermissions(Path.Combine(destinationPath, "SupportFiles\\DtPad.exe.pw"), FileResource.DtPad_exe_pw, onlySetPermissions); installProgressBar.PerformStep(); //Language files WriteFileAndSetPermissions(Path.Combine(destinationPath, "Languages\\en.resources"), FileResource.en_resources); WriteFileAndSetPermissions(Path.Combine(destinationPath, "Languages\\it.resources"), FileResource.it_resources); WriteFileAndSetPermissions(Path.Combine(destinationPath, "Languages\\fr.resources"), FileResource.fr_resources); WriteFileAndSetPermissions(Path.Combine(destinationPath, "Languages\\es.resources"), FileResource.es_resources); WriteFileAndSetPermissions(Path.Combine(destinationPath, "Languages\\ru.resources"), FileResource.ru_resources); installProgressBar.PerformStep(); //Guides //WriteFileAndSetPermissions(Path.Combine(destinationPath, "Guides\\DtPadGuide-en.dhg"), GuideResource.DtPadGuide_en_dhg); //WriteFileAndSetPermissions(Path.Combine(destinationPath, "Guides\\DtPadGuide-it.dhg"), GuideResource.DtPadGuide_it_dhg); installProgressBar.PerformStep(); //Icons and txts WriteFileAndSetPermissions(Path.Combine(destinationPath, "Icons\\DtPad.ico"), FileResource.DtPad_ico); WriteFileAndSetPermissions(Path.Combine(destinationPath, "Icons\\DtPadUpdater.ico"), FileResource.DtPadUpdater_ico); WriteFileAndSetPermissions(Path.Combine(destinationPath, "Icons\\DtHelp.ico"), FileResource.DtHelp_ico); WriteFileAndSetPermissions(Path.Combine(destinationPath, "Icons\\DtPadUninstaller.ico"), FileResource.DtPadUninstaller_ico); WriteFileAndSetPermissions(Path.Combine(destinationPath, "Icons\\Dt.ico"), FileResource.Dt_ico); WriteFileAndSetPermissions(Path.Combine(destinationPath, "Icons\\JL\\WebSite.ico"), FileResource.WebSite_ico); WriteFileAndSetPermissions(Path.Combine(destinationPath, "Icons\\JL\\NewTab.ico"), FileResource.NewTab_ico); WriteFileAndSetPermissions(Path.Combine(destinationPath, "Icons\\JL\\OpenFile.ico"), FileResource.OpenFile_ico); WriteFileAndSetPermissions(Path.Combine(destinationPath, "Icons\\JL\\OpenSession.ico"), FileResource.OpenSession_ico); WriteFileAndSetPermissions(Path.Combine(destinationPath, "Icons\\JL\\SearchInFiles.ico"), FileResource.SearchInFiles_ico); WriteFileAndSetPermissions(Path.Combine(destinationPath, "Icons\\JL\\CheckNewVersion.ico"), FileResource.CheckNewVersion_ico); WriteFileAndSetPermissions(Path.Combine(destinationPath, "DtPad.exe.Config"), FileResource.DtPad_exe_config, onlySetPermissions); WriteFileAndSetPermissions(Path.Combine(destinationPath, "InternetCache\\Info.txt"), FileResource.Info_txt); WriteFileAndSetPermissions(Path.Combine(destinationPath, "License.txt"), FileResource.License_txt); installProgressBar.PerformStep(); //Shortcuts if (form.shortcutsCheckBox.Checked) { installTextBox.Text += Environment.NewLine + LanguageUtil.GetCurrentLanguageString("CreatingShortcut", className, culture); form.Refresh(); SetShortcuts(destinationPath, culture); } installProgressBar.PerformStep(); //Associations if (form.sendToCheckBox.Checked) { installTextBox.Text += Environment.NewLine + LanguageUtil.GetCurrentLanguageString("CreatingAssociation", className, culture); form.Refresh(); SetSendToAssociation(destinationPath, culture); } if (form.shellCheckBox.Checked) { installTextBox.Text += Environment.NewLine + LanguageUtil.GetCurrentLanguageString("IntegratingShell", className, culture); form.Refresh(); if (!SetShellIntegration(destinationPath, culture)) { installTextBox.Text += Environment.NewLine + LanguageUtil.GetCurrentLanguageString("IntegratingShellError", className, culture); } } installProgressBar.PerformStep(); //Settings (part 1) installTextBox.Text += Environment.NewLine + LanguageUtil.GetCurrentLanguageString("UpdatingSetting", className, culture); form.Refresh(); ConfigUtil.UpdateParameter("ProxyEnabled", form.enableProxySettingsCheckBox.Checked.ToString(), destinationPath); ConfigUtil.UpdateParameter("StayOnTopDisabled", (!form.stayOnTopCheckBox.Checked).ToString(), destinationPath); ConfigUtil.UpdateParameter("MinimizeOnTrayIconDisabled", (!form.minimizeOnTrayIconCheckBox.Checked).ToString(), destinationPath); String[] passwordNames = { "ProxyUsername", "ProxyPassword", "ProxyDomain" }; String[] passwordValues = { form.usernameTextBox.Text, CodingUtil.EncodeString(form.passwordTextBox.Text), form.domainTextBox.Text }; PasswordUtil.UpdateParameters(passwordNames, passwordValues, destinationPath); installProgressBar.PerformStep(); //Settings (part 2) if (form.dotNetRadioButton.Checked) { ConfigUtil.UpdateParameter("LookAndFeel", "0", destinationPath); } else if (form.windowsRadioButton.Checked) { ConfigUtil.UpdateParameter("LookAndFeel", "1", destinationPath); } ConfigUtil.UpdateParameter("Language", LanguageUtil.GetLongCulture(form.languageComboBox), destinationPath); installProgressBar.PerformStep(); installTextBox.Text += Environment.NewLine + LanguageUtil.GetCurrentLanguageString("InstallComplete", className, culture); installTextBox.Text += Environment.NewLine + Environment.NewLine + LanguageUtil.GetCurrentLanguageString("EndInfo", className, culture); return(true); } catch (Exception exception) { installProgressBar.Value = 0; installTextBox.Text += Environment.NewLine + LanguageUtil.GetCurrentLanguageString("Error1", className, culture) + Environment.NewLine + Environment.NewLine + LanguageUtil.GetCurrentLanguageString("Error2", className, culture); installTextBox.Text += Environment.NewLine + Environment.NewLine + LanguageUtil.GetCurrentLanguageString("Exception", className, culture) + " " + exception.Message; return(false); } }