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 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); } //} }
void onFileAssosiate(object sender, RoutedEventArgs e) { /* * if (!FileAssociation.IsAssociated(".tmc")) * { * * } */ string myExe = Process.GetCurrentProcess().MainModule.FileName; FileAssociation.Associate(".tmc", "tmcfile", "tmc File", myExe, myExe); }
private void cmdAssociateCRF_Click(object sender, EventArgs e) { if (isAssociated) { FileAssociation.deleteAssociation(Program.extension); } else { FileAssociation.Associate(Program.extension, Program.executablePath); } isAssociated = FileAssociation.isAssociated(Program.extension, Program.executablePath); }
static void Main(string[] args) { string exec = string.Empty; string icon = string.Empty; string progID = string.Empty; string[] videoExtensions = new string[0]; string[] audioExtensions = new string[0]; int x = 0; while (x < args.Length) { string key = args[x++]; string value = args[x++]; switch (key) { case "-progID": progID = value; break; case "-executable": exec = value; break; case "-icon": icon = value; break; case "-videoExtensions": videoExtensions = value.Split(' '); break; case "-audioExtensions": audioExtensions = value.Split(' '); break; } } foreach (string videoExtension in videoExtensions) { FileAssociation.Associate('.' + videoExtension, progID, exec, videoExtension.ToUpper( ) + " File", icon); } foreach (string audioExtension in audioExtensions) { FileAssociation.Associate('.' + audioExtension, progID, exec, audioExtension.ToUpper( ) + " File", icon); } FileAssociation.NotifyFileExplorer( ); }
private void btnAssociateStlViewer_Click(object sender, EventArgs e) { string stlViewerExe = Path.GetDirectoryName(Application.ExecutablePath); if (stlViewerExe != null) { stlViewerExe = Path.Combine(stlViewerExe, "Marlin3DprinterStlViewer.exe"); FileAssociation.Associate(".stl", "Marlin3DprinterToolSTLviewer", "MarlinSTLviewer", "Marlin3DprinterTool.ico", stlViewerExe); MessageBox.Show(@"STL viewer is now the prefered stl-application", @"Assign STL Viewer", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
private void btnAssociateBackup_Click(object sender, EventArgs e) { string regtext = "\"" + Application.ExecutablePath + "\" \"%1\""; string gedeminDir = System.IO.Path.GetDirectoryName(Application.ExecutablePath) + "\\"; string icoFilePath = gedeminDir + "BK.ico"; using (FileStream fs = new FileStream(icoFilePath, FileMode.Create)) Properties.Resources.ged_bk.Save(fs); FileAssociation.Associate(".bk", regtext, "gedemin database", icoFilePath, "Firebird database backup"); MessageBox.Show("Successfully associated!\n\n" + regtext + '\n' + icoFilePath); }
public frm_main(string[] args) { InitializeComponent(); if (!FileAssociation.IsAssociated) { try { FileAssociation.Associate("Зашифрованные данные", null); } catch { MessageBox.Show("Не удалось установить ассоциацию для файлов, пожалуйста запустите программу от имени администратора", "Внимание", MessageBoxButtons.OK, MessageBoxIcon.Error); } } this.args = args; }
private void BtnAssociate_Click(object sender, EventArgs e) { string regtext = ""; string gedeminDir = System.IO.Path.GetDirectoryName(tbGedeminPath.Text) + "\\"; if (tbGedeminPath.Text.Length > 0) { regtext = '"' + tbGedeminPath.Text.Trim('"').Trim(' ') + '"'; } else { MessageBox.Show("Gedemin path error"); return; } if (cbServerType.SelectedIndex == 0) { //Default regtext += " /sn "; if (tbServer.Text.Length > 0) { regtext += '"' + tbServer.Text + '/' + numPort.Value + ":%1"+ '"'; } else { MessageBox.Show("Server error"); return; } } regtext += cbUseCredentials.Checked ? " /user "+ tbUsername.Text + " /password " + tbUsername.Text : ""; //regtext += " /user Administrator /password Administrator"; // Проверить на правильность пути к gedemin.exe string icoFilePath = gedeminDir + "FDB.ico"; using (FileStream fs = new FileStream(icoFilePath, FileMode.Create)) Properties.Resources.ged_fdb.Save(fs); FileAssociation.Associate(".fdb", regtext, "gedemin database", icoFilePath, "Firebird database"); MessageBox.Show("Successfully associated!\n\n" + regtext + '\n'+ icoFilePath); }
/// <summary> /// Associates application extension with files /// </summary> public static void AssociateExtension() { if (!IsAdministrator()) { MessageBox.Show ( "Application has to be run with administrator rights to associate its file extension with itself.", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1, MessageBoxOptions.DefaultDesktopOnly ); return; } if (!FileAssociation.IsAssociated) { FileAssociation.Associate("Graph Builder File", Application.ExecutablePath); } }
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); } } }
public void Save() { log.Debug("Saving data..."); //Save values from UI this.settings.MainFormUI.ShowMarkers = this.ShowMarkersCheckBox.IsChecked.GetValueOrDefault(); this.settings.MainFormUI.ExitAppOnESC = this.ExitAppOnEscCheckBox.IsChecked.GetValueOrDefault(); this.settings.MainFormUI.AutoScrollWhenAutoRefresh = this.AutoScrollCheckBox.IsChecked.GetValueOrDefault(); this.settings.MainFormUI.AutoScrollShowTwoItems = this.AutoScrollShowTwoItemsCheckBox.IsChecked.GetValueOrDefault(); this.settings.MainFormUI.AutoRefreshPeriod = Convert.ToInt32(this.AutoRefreshPeriodEdit.Value); this.settings.MainFormUI.AddOnlyBaseNameInRecentList = this.AddOnlyBaseNameInRecentListCheckBox.IsChecked.GetValueOrDefault(); this.settings.MainFormUI.RememberFiltersEnabled = this.RememberFiltersEnabledCheckBox.IsChecked.GetValueOrDefault(); this.settings.MainFormUI.TrimClassColumnFromLeft = this.TrimClassColumnFromLeftCheckBox.IsChecked.GetValueOrDefault(); this.settings.MainFormUI.ShowLogIcons = this.ShowLogIconsCheckBox.IsChecked.GetValueOrDefault(); this.settings.MainFormUI.MessageWordWrap = this.MessageWordWrapCheckBox.IsChecked.GetValueOrDefault(); this.settings.MainFormUI.MessageFontFamily = this.FontComboBox.SelectedValue.ToString(); this.settings.MainFormUI.MessageFontSize = (float)this.MessageFontSize.Value.GetValueOrDefault(); this.settings.TextDiff.DiffPath = this.ExtDiffPathEdit.Text; this.settings.TextDiff.DiffParameters = this.ExtDiffParametersEdit.Text; this.settings.TextEditor.TextEditorPath = this.ExtTextEditPathEdit.Text; this.settings.TextEditor.TextEditorParameteres = this.ExtTextEditParametersEdit.Text; this.settings.AutomaticUpdates.EnableAutomaticCheck = this.AutomaticUpdateEnabledCheckBox.IsChecked.GetValueOrDefault(); this.settings.AutomaticUpdates.CheckInterval = Convert.ToInt32(this.AutomaticUpdateCheckPeriodEdit.Value); this.settings.Save(); //Browse for logs around this.logBrowser.TopLevelFolders = this.TopLevelFolders.Text; this.logBrowser.ShowAndCloseOnDoubleClick = this.OpenAndExitOnDoubleClickCheckBox.IsChecked.GetValueOrDefault(); this.logBrowser.Save(); log.Debug("Data saved..."); if (this.totalCmd.IsInstalled && this.totalCmd.IsLogViewerIntegrated != this.IntegrateWithTotalCmdCheckBox.IsChecked) { log.Debug("Saving TotalCmd settings"); log.Debug("Checking if TotalCmd is running..."); bool totalCmdRunning = false; while (Process.GetProcessesByName("TOTALCMD").Count(p => p.MainModule.ModuleName.Equals("TOTALCMD.EXE", StringComparison.OrdinalIgnoreCase)) > 0) { if (MessageBox.Show("Total Commander is running, please close it and then click on Retry. Isn't possible to save Total Commander configuration when is running.", "Total Commander", MessageBoxButton.OKCancel, MessageBoxImage.Warning) != MessageBoxResult.OK) { totalCmdRunning = true; break; } } if (!totalCmdRunning) { if (this.IntegrateWithTotalCmdCheckBox.IsChecked.GetValueOrDefault()) { this.totalCmd.IntegrateLogViewer(); } else { this.totalCmd.UnIntegrateLogViewer(); } log.Debug("TotalCmd settigns saved"); } else { MessageBox.Show("Total Commander configuration wasn't saved because Total Commander is running. Rest of the configuration was saved successfuly.", "Warning", MessageBoxButton.OK, MessageBoxImage.Warning); log.Debug("TotalCmd isn't saved because Total Commander is running"); } } if (this.AssociateWithAlvCheckBox.IsEnabled && this.AssociateWithAlvCheckBox.IsChecked != alvWasAssociated) { try { string executable = Assembly.GetExecutingAssembly().Location; if (this.AssociateWithAlvCheckBox.IsChecked.GetValueOrDefault()) { FileAssociation.Associate(".log", "AdvancedLogViewer", "Log file", executable, 0, executable); } else { FileAssociation.Remove(".log", "AdvancedLogViewer"); } } catch { MessageBox.Show("Can'setassociation for the LOG extension. Run ALV as Administrator.", "Administration rights required", MessageBoxButton.OK, MessageBoxImage.Warning); } } }
//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 Btn_associate_Click(object sender, EventArgs e) { FileAssociation.Associate("Зашифрованные данные", null); }
private void okButton_Click(object sender, EventArgs e) { log.Debug("Saving data..."); //Save values from UI this.settings.MainFormUI.ShowMarkers = this.showMarkersCheckBox.Checked; this.settings.MainFormUI.ExitAppOnESC = this.exitAppOnESCCheckBox.Checked; this.settings.MainFormUI.AutoScrollWhenAutoRefresh = this.autoScrollCheckBox.Checked; this.settings.MainFormUI.AutoScrollShowTwoItems = this.autoScrollShowTwoItemsCheckBox.Checked; this.settings.MainFormUI.AutoRefreshPeriod = Convert.ToInt32(this.autoRefreshPeriodEdit.Value); this.settings.MainFormUI.AddOnlyBaseNameInRecentList = this.addOnlyBaseNameInRecentListCheckBox.Checked; this.settings.MainFormUI.RememberFiltersEnabled = this.rememberFiltersEnabledCheckBox.Checked; this.settings.MainFormUI.TrimClassColumnFromLeft = this.trimClassColumnFromLeftCheckBox.Checked; this.settings.MainFormUI.ShowLogIcons = this.showLogIconsCheckBox.Checked; this.settings.MainFormUI.MessageWordWrap = this.messageWordWrapCheckBox.Checked; this.settings.MainFormUI.MessageFontFamily = this.FontComboBox.SelectedItem.ToString(); this.settings.MainFormUI.MessageFontSize = (float)this.MessageFontSize.Value; this.settings.TextDiff.DiffPath = this.extDiffPathEdit.Text; this.settings.TextDiff.DiffParameters = this.extDiffParametersEdit.Text; this.settings.TextEditor.TextEditorPath = this.extTextEditPathEdit.Text; this.settings.TextEditor.TextEditorParameteres = this.extTextEditParametersEdit.Text; this.settings.AutomaticUpdates.EnableAutomaticCheck = this.automaticUpdateEnabledCheckBox.Checked; this.settings.AutomaticUpdates.CheckInterval = Convert.ToInt32(this.automaticUpdateCheckPeriodEdit.Value); this.settings.Save(); //Browse for logs around this.logBrowser.TopLevelFolders = this.topLevelFolders.Text; this.logBrowser.ShowAndCloseOnDoubleClick = this.openAndExitOnDoubleClickCheckBox.Checked; this.logBrowser.Save(); log.Debug("Data saved..."); if (this.totalCmd.IsInstalled && this.totalCmd.IsLogViewerIntegrated != this.integrateWithTotalCmdCheckBox.Checked) { log.Debug("Saving TotalCmd settings"); log.Debug("Checking if TotalCmd is running..."); bool totalCmdRunning = false; try { while (Process.GetProcessesByName("TOTALCMD").Where(p => p.MainModule.ModuleName.Equals("TOTALCMD.EXE", StringComparison.OrdinalIgnoreCase)).Count() > 0) { if (MessageBox.Show("Total Commander is running, please close it and then click on Retry. Isn't possible to save Total Commander configuration when is running.", "Total Commander", MessageBoxButtons.RetryCancel, MessageBoxIcon.Warning) != DialogResult.Retry) { totalCmdRunning = true; break; } } if (!totalCmdRunning) { if (this.integrateWithTotalCmdCheckBox.Checked) { this.totalCmd.IntegrateLogViewer(); } else { this.totalCmd.UnIntegrateLogViewer(); } log.Debug("TotalCmd settigns saved"); } else { MessageBox.Show("Total Commander configuration wasn't saved because Total Commander is running. Rest of the configuration was saved successfuly.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); log.Debug("TotalCmd isn't saved because Total Commander is running"); } } catch (Exception ex) { var msg = "Error while setting integration with TotalCmd: " + ex.Message; MessageBox.Show(msg, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); log.Error(msg); } } if (this.associateWithAlvCheckBox.Enabled && this.associateWithAlvCheckBox.Checked != alvWasAssociated) { try { string executable = Process.GetCurrentProcess().MainModule.FileName; if (this.associateWithAlvCheckBox.Checked) { FileAssociation.Associate(".log", "AdvancedLogViewer", "Log file", executable, 0, executable); } else { FileAssociation.Remove(".log", "AdvancedLogViewer"); } } catch { var msg = "Can'set association for the LOG extension. Run ALV as Administrator."; MessageBox.Show(msg, "Administration rights required", MessageBoxButtons.OK, MessageBoxIcon.Error); log.Error(msg); } } if (this.showBrowseWithAlvCheckBox.Enabled && this.showBrowseWithAlvCheckBox.Checked != explorerContextMenuWasPresent) { try { if (this.showBrowseWithAlvCheckBox.Checked) { //C:\Program Files (x86)\AdvancedLogViewer\AdvancedLogViewer.exe "%1\\" Registry.SetValue(@"HKEY_CURRENT_USER\SOFTWARE\Classes\Folder\Shell\Browse for Logs\command", "", $"{System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName} \"%1\\\\\""); } else { Registry.CurrentUser.DeleteSubKeyTree(@"SOFTWARE\Classes\Folder\Shell\Browse for Logs"); } } catch (System.Exception) { var msg = "Can'set explorer's context menu. Run ALV as Administrator."; MessageBox.Show(msg, "Administration rights required", MessageBoxButtons.OK, MessageBoxIcon.Error); log.Error(msg); } } }