public static EnsureAssociationsSet ( ) : void | ||
return | void |
static void Main(string[] args) { if (EnforceSingleInstance()) { return; } string filePath = string.Empty; if (args.Length > 0) { if (File.Exists(args[0]) && args[0].EndsWith(".bk")) { filePath = args[0]; } else { MessageBox.Show("Unrecognized file.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } FileAssociations.EnsureAssociationsSet(); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new BindKey(filePath)); }
public static void EnshurePckAssociations() { FileAssociation fa = new FileAssociation(); fa.ExecutableFilePath = Application.ExecutablePath; fa.FileTypeDescription = "Test"; fa.IsAdd = true; fa.Extension = ".pck"; fa.ProgId = "Perfect World Editor By JHS."; FileAssociations.EnsureAssociationsSet(fa); }
private void MainForm_Load(object sender, EventArgs e) { FileAssociations.EnsureAssociationsSet(); string[] args = Environment.GetCommandLineArgs(); if (args.Length > 1) { Open(args[1]); } }
public Form1(string file) { InitializeComponent(); FileAssociations.EnsureAssociationsSet(); using (ZipArchive archive = ZipFile.OpenRead(file)) { var info = archive.GetEntry("ExamReport.xml"); if (info != null) { using (var zipEntryStream = info.Open()) { XDocument xDocument = XDocument.Load(zipEntryStream); string name = string.Empty; if (xDocument.Root.Element("Patient").Element("Lastname") != null) { name = name + xDocument.Root.Element("Patient").Element("Lastname").Value; } if (xDocument.Root.Element("Patient").Element("Firstname") != null) { name = name + " " + xDocument.Root.Element("Patient").Element("Firstname").Value; } if (name == string.Empty) { name = $"Unknown"; } var pdf = archive.GetEntry("Report.pdf"); if (pdf != null) { using (var pdfstream = pdf.Open()) { saveFileDialog1.FileName = saveFileDialog1.InitialDirectory + name + ".pdf"; DialogResult save = saveFileDialog1.ShowDialog(); if (save == DialogResult.OK) { using (FileStream output = new FileStream(saveFileDialog1.FileName, FileMode.Create)) { try { pdfstream.CopyTo(output); outputLog.AppendText($"\nСоздан файл {saveFileDialog1.FileName}"); } catch (Exception ex) { outputLog.AppendText($"\nОшибка обработки файла {file}: {ex.Message}"); } } } } } } } } }
private void jButton1_Click(object sender, EventArgs e) { if (pref != null) { pref.registerPckExtension = jToggle1.Checked; PreferencesManager.Instance.Set(pref); } FileAssociation fa = new FileAssociation(); fa.ExecutableFilePath = Application.ExecutablePath; fa.FileTypeDescription = "Perfect World Editor By JHS."; fa.IsAdd = jToggle1.Checked; fa.Extension = ".pck"; fa.ProgId = "PckOpener"; fa.AppId = (int)EditorsColors.Pck_Editor; FileAssociations.EnsureAssociationsSet(fa); }
private App() { Instance = this; ConfigService.LoadConfig(); SetEnv(); var args = Environment.GetCommandLineArgs(); FileAssociations.EnsureAssociationsSet(); foreach (var arg in args) { var fileInfo = new FileInfo(arg); if (fileInfo.Extension.Equals(".torrent")) { torrentsToAdd.Add(fileInfo.FullName); } } var logRepo = LogManager.GetRepository(Assembly.GetEntryAssembly()); XmlConfigurator.Configure(logRepo, new FileInfo("log4net.config")); RenderOptions.ProcessRenderMode = RenderMode.SoftwareOnly; //log4net.Config.XmlConfigurator.Configure(null); AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; Current.DispatcherUnhandledException += Dispatcher_UnhandledException; if (Current.Dispatcher != null) { Current.Dispatcher.UnhandledException += Dispatcher_UnhandledException; } InitializeComponent(); }
private void jToggle1_CheckedChanged(object sender, EventArgs e) { if (locked) { return; } if (pref != null) { pref.registerDataExtension = jToggle1.Checked; PreferencesManager.Instance.Set(pref); } FileAssociation fa = new FileAssociation(); fa.ExecutableFilePath = Application.ExecutablePath; fa.FileTypeDescription = "Perfect World Editor By JHS."; fa.IsAdd = jToggle1.Checked; fa.Extension = ".data"; fa.ProgId = "DataFiles"; fa.AppId = 1985; FileAssociations.EnsureAssociationsSet(fa); }
public App() { RenderOptions.ProcessRenderMode = RenderMode.Default; Logger.Loggers.Add(new ConsoleLogger()); Logger.Loggers.Add(new TextFileLogger()); try { using (var mgr = UpdateManager.GitHubUpdateManager("https://github.com/Profound-Education-Centre/DeltaQuestionEditor-WPF").Result) { // Note, in most of these scenarios, the app exits after this method // completes! SquirrelAwareApp.HandleEvents( onInitialInstall: v => mgr.CreateShortcutForThisExe(), onAppUpdate: v => mgr.CreateShortcutForThisExe(), onAppUninstall: v => { mgr.RemoveShortcutForThisExe(); mgr.RemoveUninstallerRegistryEntry(); }, onFirstRun: () => { FileAssociations.EnsureAssociationsSet(); }); } } catch (Exception) { } }
public static void Main(string[] args) { if (IsDebugRelease) { MessageBox.Show("Code messed up somewhere, report this to the devs, PROGRAM RUN IN DEBUG"); } MainWindow.SetupSettings(); if (!ProcessHelpers.IsVC2019x64Installed() && !Storage.Settings.ShownVCScreen) { MessageBox.Show( "You do not have Visual C installed! Continue to install it.\nTHIS WILL NOT BE SHOWN AGAIN!\nDO NOT REPORT THE APP NOT RUNNING IF YOU DIDNT INSTALL THIS"); Process.Start("https://aka.ms/vs/16/release/VC_redist.x64.exe"); Storage.Settings.ShownVCScreen = true; throw new("Need Visual C Installed!"); } var mtr = new List <Mod>(); foreach (var a in (ModManifest.Instance * typeof(Mod))) { if (!File.Exists((ModManifest.Instance ^ a.Name).CanonicalLocation)) { mtr.Add(a); } } foreach (var remove in mtr) { ModManifest.Instance -= remove; } try { SteamClient.Init(960090); Storage.InstallDir = SteamApps.AppInstallDir(); MelonHandler.EnsureMelonInstalled(); FileAssociations.EnsureAssociationsSet(); } catch (Exception e) { MessageBox.Show("ERROR 0x3ef93 PLEASE REPORT IN THE DISCORD" + Environment.NewLine + "Please include this message in your support ticket: " + e.Message); Environment.Exit(1); } _ = Directory.CreateDirectory(Storage.InstallDir + @"\Mods\Inferno"); _ = Directory.CreateDirectory(Storage.InstallDir + @"\Mods\Inferno\Disabled"); _ = Directory.CreateDirectory(Storage.InstallDir + @"\Mods"); _ = Directory.CreateDirectory(Storage.InstallDir + @"\Mods\Disabled"); _ = Directory.CreateDirectory(Environment.ExpandEnvironmentVariables("%AppData%\\InfernoOmnia\\")); if (args.Length != 0) { foreach (var file in args) { if (!file.Contains(@"\Mods\Inferno")) { if (File.Exists(Storage.InstallDir + @"\Mods\Inferno\" + Path.GetFileName(file))) { File.Delete(Storage.InstallDir + @"\Mods\Inferno\" + Path.GetFileName(file)); } File.Move(file, Storage.InstallDir + @"\Mods\Inferno\" + Path.GetFileName(file)); } } } if (Directory.GetFiles(Storage.InstallDir + @"\Mods\Inferno") .Combine(Directory.GetFiles(Storage.InstallDir + @"\Mods\Inferno\Disabled")).Length > 0) { var flag = false; foreach (var file in Directory.GetFiles(Storage.InstallDir + @"\Mods", "*.dll") .Combine(Directory.GetFiles(Storage.InstallDir + @"\Mods\Inferno\Disabled"))) { MelonHandler.GetMelonAttrib(file, out var att); if (att != null) { flag |= att.Name.Equals("Inferno API Injector"); } } if (!flag) { File.Create(Storage.InstallDir + @"\Mods\Inferno API Injector.dll") .Write(Resources.Inferno_API_Injector, 0, Resources.Inferno_API_Injector.Length); } } var app = new App { ShutdownMode = ShutdownMode.OnMainWindowClose }; app.InitializeComponent(); app.Run(); }
public Form1() { InitializeComponent(); FileAssociations.EnsureAssociationsSet(); }
public void Associate() { Log0(3, this); FileAssociations.EnsureAssociationsSet(_extensions, _fileDesc, _assembly); }
public void Associate() => FileAssociations.EnsureAssociationsSet(_extensions, _fileDesc, _assembly);