private void associateExts(string dir) { if (!FileAssociation.IsAssociated(".mp3")) { FileAssociation.Associate(".mp3", "urMusik.mp3", ResolveExt(0), System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + "\\icon.ico", dir + "\\urMusik.exe"); } if (!FileAssociation.IsAssociated(".wav")) { FileAssociation.Associate(".wav", "urMusik.wav", ResolveExt(1), System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + "\\icon.ico", dir + "\\urMusik.exe"); } if (!FileAssociation.IsAssociated(".pcm")) { FileAssociation.Associate(".pcm", "urMusik.pcm", ResolveExt(2), System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + "\\icon.ico", dir + "\\urMusik.exe"); } if (!FileAssociation.IsAssociated(".aac")) { FileAssociation.Associate(".aac", "urMusik.aac", ResolveExt(3), System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + "\\icon.ico", dir + "\\urMusik.exe"); } if (!FileAssociation.IsAssociated(".m4a")) { FileAssociation.Associate(".m4a", "urMusik.m4a", ResolveExt(3), System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + "\\icon.ico", dir + "\\urMusik.exe"); } if (!FileAssociation.IsAssociated(".flac")) { FileAssociation.Associate(".flac", "urMusik.flac", ResolveExt(4), System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + "\\icon.ico", dir + "\\urMusik.exe"); } }
public SettingsDlg(AlvSettings alvSettings, bool firstTimeShown) { log.Debug("Creating SettingsDlg form"); InitializeComponent(); this.settings = alvSettings; this.totalCmd = new TotalCmdIntegration(); this.logBrowser = LogBrowserSettings.Instance; //Load values from filter entry this.showMarkersCheckBox.Checked = this.settings.MainFormUI.ShowMarkers; this.exitAppOnESCCheckBox.Checked = this.settings.MainFormUI.ExitAppOnESC; this.autoScrollCheckBox.Checked = this.settings.MainFormUI.AutoScrollWhenAutoRefresh; this.autoScrollShowTwoItemsCheckBox.Checked = this.settings.MainFormUI.AutoScrollShowTwoItems; this.autoRefreshPeriodEdit.Value = this.settings.MainFormUI.AutoRefreshPeriod; this.addOnlyBaseNameInRecentListCheckBox.Checked = this.settings.MainFormUI.AddOnlyBaseNameInRecentList; this.rememberFiltersEnabledCheckBox.Checked = this.settings.MainFormUI.RememberFiltersEnabled; this.trimClassColumnFromLeftCheckBox.Checked = this.settings.MainFormUI.TrimClassColumnFromLeft; this.showLogIconsCheckBox.Checked = this.settings.MainFormUI.ShowLogIcons; this.extDiffPathEdit.Text = settings.TextDiff.DiffPath; this.extDiffParametersEdit.Text = settings.TextDiff.DiffParameters; this.extTextEditPathEdit.Text = settings.TextEditor.TextEditorPath; this.extTextEditParametersEdit.Text = settings.TextEditor.TextEditorParameteres; this.topLevelFolders.Text = this.logBrowser.TopLevelFolders; this.openAndExitOnDoubleClickCheckBox.Checked = this.logBrowser.ShowAndCloseOnDoubleClick; this.integrateWithTotalCmdCheckBox.Checked = this.totalCmd.IsLogViewerIntegrated; if (this.totalCmd.IsInstalled) { this.integrateWithTotalCmdCheckBox.Enabled = true; this.totalCmdStatusLabel.Text = "Total Commander is installed on this computer."; } else { this.integrateWithTotalCmdCheckBox.Enabled = false; this.totalCmdStatusLabel.Text = "Total Commander wasn't found on this computer."; } try { alvWasAssociated = FileAssociation.IsAssociated(".log", "AdvancedLogViewer"); associateWithAlvCheckBox.Checked = alvWasAssociated || firstTimeShown; } catch { MessageBox.Show("Can't get information about associated application with LOG extension. Run ALV as Administrator.", "Administration rights required", MessageBoxButtons.OK, MessageBoxIcon.Error); associateWithAlvCheckBox.Enabled = false; } this.automaticUpdateEnabledCheckBox.Checked = this.settings.AutomaticUpdates.EnableAutomaticCheck; this.automaticUpdateCheckPeriodEdit.Value = this.settings.AutomaticUpdates.CheckInterval; log.Debug("SettingsDlg form created"); }
//public class Instruction: Dictionary<CompilerProperty, string> {} #endregion public MainWindow() { InitializeComponent(); System.Threading.Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.GetCultureInfo("es-AR"); // Asocio tipo de archivo if (!FileAssociation.IsAssociated(".h5c")) { FileAssociation.Associate(".h5c", "ghApps.HTML5Compiler", "HTML5 Compiler Proyect", "H5Clogo-256.ico", AppDomain.CurrentDomain.DomainManager.EntryAssembly.Location); } // Chequeo si abrio un proyecto desde un archivo // Environment.GetCommandLineArgs() //if (AppDomain.CurrentDomain.SetupInformation.ActivationArguments != null) //{ string[] arguments = Environment.GetCommandLineArgs(); if (arguments.Length > 1) { // Cargar poryecto try { string filePath = arguments[1]; // string.Empty; //filePath = @"C:\Proyectos\Mobile\gecommerce\trunk\src\MobileViews\mobileView.h5c"; string JSONProject = File.ReadAllText(filePath, Encoding.Default); var oProject = JSONHelper.Deserialize <Project>(JSONProject); // Chequear si los paths de oProject son relativos y modificarlos el path pasaría a estar en "filePath" if (oProject != null && oProject.Configs != null && oProject.Configs.Count > 0) { LoadProject(oProject); if (arguments.Length > 2) { // TODO: leer el comando y ejecutar (probablemente el unico comando sea "compilar" asi que ewjecutar compilar) } } else { SetDevice(DeviceConfig.Devices.html5); SaveDevice(SelectedDevice); } } catch (Exception ex) { SetDevice(DeviceConfig.Devices.html5); SaveDevice(SelectedDevice); txtResult.Text = "Se produjo un error al cargar el proyecto, recuerde escapar caracteres como \"\\\", etc. El log indica: " + ex.Message + Environment.NewLine; } } else { SetDevice(DeviceConfig.Devices.html5); SaveDevice(SelectedDevice); } //} }
private void btnRemoveBackup_Click(object sender, EventArgs e) { if (FileAssociation.IsAssociated(".bk")) { FileAssociation.Remove(".bk", "Firebird database backup"); MessageBox.Show("Association removed!"); } else { MessageBox.Show("Not associated!"); } }
private void CmdAssocToPdf_Click(object sender, EventArgs e) { string exeFilePath = Application.ExecutablePath; if (FileAssociation.IsAssociated(FileExt, ProgMenuItem, exeFilePath)) { MessageBox.Show($"Приложение '{exeFilePath}' уже связано с расширением '{FileExt}'", "Проверка связи расширения с приложением", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { bool result = FileAssociation.Associate(FileExt, ProgID, ProgMenuItem, exeFilePath); if (result) { MessageBox.Show($"Приложение '{exeFilePath}' успешно ассоциаровано с расширением '{FileExt}'", "Установка связи расширения с приложением", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show($"Приложение '{exeFilePath}' НЕ ассоциировано с расширением '{FileExt}'\n\nError: " + FileAssociation.ErrorMessage, "Установка связи расширения с приложением", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
//Kopieren der Dateien beendet private void bgwCopy_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { taskBarManager.Instance.setTaskBarProgressState(taskBarProgressState.NoProgress); if (e.Result == null) { // mit Erfolg try { //Verknüpfungen erstellen string administrationPath = Path.Combine(Context.installationDirectory, Context.Product.mainExecutable); // Auf dem Desktop if (Context.createDesktopShortcut) { var shortcutDesktop = new ShellShortcut(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), "updateSystem.NET Administration.lnk")) { IconIndex = 0, IconPath = administrationPath, Path = administrationPath }; shortcutDesktop.Save(); } //Im Startmenu if (Context.createStartMenuShortcut) { var shortcutStartMenu = new ShellShortcut(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Programs), "updateSystem.NET Administration.lnk")) { IconIndex = 0, IconPath = administrationPath, Path = administrationPath }; shortcutStartMenu.Save(); } //Uninstalldaten in die Registry schreiben if (IsUserAnAdmin()) { ProgramsAndFeaturesHelper.Add(Context); } //Installer zwecks deinstallation ins Programmverzeichnis kopieren File.Copy(Application.ExecutablePath, Path.Combine(Context.installationDirectory, Context.Product.setupName), true); //Nur in Releaseversion Dateitypen registrieren if (Context.Product.GetType() == typeof(productRTM)) { //Neuen UDPROJX-Type registrieren FileAssociation.Associate( ".udprojx", Context.Product.applicationID, "updateSystem.NET Projektdatei", Path.Combine(Context.installationDirectory, "Project.ico"), administrationPath); //Alten UDPROJ-Type registrieren wenn dieser nicht bereits von der alten Installation registriert wurde if (!FileAssociation.IsAssociated(".udproj")) { FileAssociation.Associate( ".udproj", Context.Product.applicationID, "Alte updateSystem.NET Projektdatei", Path.Combine(Context.installationDirectory, "Project.ico"), administrationPath); } //Shell aktualisieren FileAssociation.refreshDesktop(); } //"Fertig"-Seite anzeigen onChangePage(new changePageEventArgs(typeof(stpInstalled))); } catch (Exception exc) { Context.setupException = exc; onChangePage(new changePageEventArgs(typeof(stpInterrupted))); } } else { // mit Exception Context.setupException = (e.Result as Exception); onChangePage(new changePageEventArgs(typeof(stpInterrupted))); } }
private void bgwUninstall_DoWork(object sender, DoWorkEventArgs e) { var context = (e.Argument as setupContext); try { string baseDir = AppDomain.CurrentDomain.BaseDirectory; //Zu entfernende Dateien ermitteln string[] files = Directory.GetFiles(baseDir, "*", SearchOption.AllDirectories); int currentFile = 0; //Versuchen Dateien zu löschen foreach (string file in files) { try { //Versuchen das native Abbild der Datei zu entfernen if (file.EndsWith(".exe") || file.EndsWith(".dll")) { nativeImages.Uninstall(file); } File.Delete(file); currentFile++; bgwUninstall.ReportProgress(Percent(currentFile, files.Length)); } catch { } } //Programm aus der Systemregistrierung entfernen ProgramsAndFeaturesHelper.Remove(context.Product); //Settings löschen if (context.removeSettings) { string settingsPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "updateSystem.NET"); if (Directory.Exists(settingsPath)) { Directory.Delete(settingsPath, true); } } //Verknüpfungen entfernen string scDesktop = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), "updateSystem.NET Administration.lnk"); string scStartMenu = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Programs), "updateSystem.NET Administration.lnk"); if (File.Exists(scDesktop)) { File.Delete(scDesktop); } if (File.Exists(scStartMenu)) { File.Delete(scStartMenu); } //Dateitypeverknüpfungen entfernen (nur in Releaseversion) if (context.Product.GetType() == typeof(productRTM)) { if (FileAssociation.IsAssociated(".udprojx")) { FileAssociation.DeleteAssociation(".udprojx"); } if (FileAssociation.IsAssociated(".udproj")) { FileAssociation.DeleteAssociation(".udproj"); } FileAssociation.refreshDesktop(); } } catch (Exception exc) { e.Result = exc; } }
public SettingsDlg(AlvSettings alvSettings, bool firstTimeShown) { log.Debug("Creating SettingsDlg form"); InitializeComponent(); this.settings = alvSettings; this.totalCmd = new TotalCmdIntegration(); this.logBrowser = LogBrowserSettings.Instance; //Load values from filter entry this.showMarkersCheckBox.Checked = this.settings.MainFormUI.ShowMarkers; this.exitAppOnESCCheckBox.Checked = this.settings.MainFormUI.ExitAppOnESC; this.autoScrollCheckBox.Checked = this.settings.MainFormUI.AutoScrollWhenAutoRefresh; this.autoScrollShowTwoItemsCheckBox.Checked = this.settings.MainFormUI.AutoScrollShowTwoItems; this.autoRefreshPeriodEdit.Value = this.settings.MainFormUI.AutoRefreshPeriod; this.addOnlyBaseNameInRecentListCheckBox.Checked = this.settings.MainFormUI.AddOnlyBaseNameInRecentList; this.rememberFiltersEnabledCheckBox.Checked = this.settings.MainFormUI.RememberFiltersEnabled; this.trimClassColumnFromLeftCheckBox.Checked = this.settings.MainFormUI.TrimClassColumnFromLeft; this.showLogIconsCheckBox.Checked = this.settings.MainFormUI.ShowLogIcons; this.messageWordWrapCheckBox.Checked = this.settings.MainFormUI.MessageWordWrap; foreach (FontFamily font in FontFamily.Families) { FontComboBox.Items.Add(font.Name); } FontComboBox.SelectedItem = this.settings.MainFormUI.MessageFontFamily; MessageFontSize.Value = (decimal)this.settings.MainFormUI.MessageFontSize; this.extDiffPathEdit.Text = settings.TextDiff.DiffPath; this.extDiffParametersEdit.Text = settings.TextDiff.DiffParameters; this.extTextEditPathEdit.Text = settings.TextEditor.TextEditorPath; this.extTextEditParametersEdit.Text = settings.TextEditor.TextEditorParameteres; this.topLevelFolders.Text = this.logBrowser.TopLevelFolders; this.openAndExitOnDoubleClickCheckBox.Checked = this.logBrowser.ShowAndCloseOnDoubleClick; this.integrateWithTotalCmdCheckBox.Checked = this.totalCmd.IsLogViewerIntegrated; if (this.totalCmd.IsInstalled) { this.integrateWithTotalCmdCheckBox.Enabled = true; this.totalCmdStatusLabel.Text = "Total Commander is installed on this computer."; } else { this.integrateWithTotalCmdCheckBox.Enabled = false; this.totalCmdStatusLabel.Text = "Total Commander wasn't found on this computer."; } try { alvWasAssociated = FileAssociation.IsAssociated(".log", "AdvancedLogViewer"); associateWithAlvCheckBox.Checked = alvWasAssociated || firstTimeShown; } catch { MessageBox.Show("Can't get information about associated application with LOG extension. Run ALV as Administrator.", "Administration rights required", MessageBoxButtons.OK, MessageBoxIcon.Error); associateWithAlvCheckBox.Enabled = false; } try { explorerContextMenuWasPresent = Registry.GetValue(@"HKEY_CURRENT_USER\SOFTWARE\Classes\Folder\Shell\Browse for Logs\command", null, null) != null; showBrowseWithAlvCheckBox.Checked = explorerContextMenuWasPresent; } catch { MessageBox.Show("Can't get information about explorer context menu. Run ALV as Administrator.", "Administration rights required", MessageBoxButtons.OK, MessageBoxIcon.Error); showBrowseWithAlvCheckBox.Enabled = false; } this.automaticUpdateEnabledCheckBox.Checked = this.settings.AutomaticUpdates.EnableAutomaticCheck; this.automaticUpdateCheckPeriodEdit.Value = this.settings.AutomaticUpdates.CheckInterval; log.Debug("SettingsDlg form created"); }