Beispiel #1
0
        private void DataReload()
        {
            _assoc = FileAssociations.GetAssociations();

            //////////////////////////////////
            // Types List

            __typesList.BeginUpdate();
            __typesList.Items.Clear();

            foreach (FileType type in _assoc.AllTypes)
            {
                ListViewItem item = CreateItemForType(type);

                __typesList.Items.Add(item);
            }

            __typesList.EndUpdate();

            //////////////////////////////////
            // Extensions List

            __extsList.BeginUpdate();
            __extsList.Items.Clear();

            foreach (FileExtension ext in _assoc.AllExtensions)
            {
                ListViewItem item = CreateItemForExt(ext);

                __extsList.Items.Add(item);
            }

            __extsList.EndUpdate();
        }
Beispiel #2
0
        /// <summary>
        /// File list view dobule click event handler
        /// </summary>
        /// <summary xml:lang="ru">
        /// Обработчик события двойного нажатия на файл
        /// </summary>
        /// <param name="sender">Component that emitted the event</param>
        /// <param name="e">Event arguments</param>
        /// <param name="sender" xml:lang="ru">Указатель на компонент, который отправил событие</param>
        /// <param name="e" xml:lang="ru">Аргументы события</param>
        private void OnFileListViewDoubleClick(object sender, EventArgs e)
        {
            if (mode == FileBrowserWindowMode.FILE_BROWSER)
            {
                // If browsing directory
                if (fileListView.SelectedItems.Count == 1)
                {
                    FileSystemElement resource = (FileSystemElement)fileListView.SelectedItems[0].Tag;

                    if (resource is GameDirectory)
                    {
                        OpenDir((GameDirectory)resource, true);
                    }
                    else
                    {
                        FileAssociations.OpenFile((GameFile)resource);
                    }
                }
            }
            else
            {
                // If browsing archive
                OnExtractFromArchiveClick(this, new EventArgs());
            }
        }
Beispiel #3
0
        private void CheckFileAssociations()
        {
            try
            {
                if (FileAssociations == null)
                {
                    return;
                }

                var startupPath        = Application.StartupPath;
                var str1               = FileAssociations.ExtensionOpenWith(".stl");
                var str2               = FileAssociations.ExtensionOpenWith(".obj");
                var associationsDialog = settingsManager.Settings.miscSettings.FileAssociations.ShowFileAssociationsDialog;
                if (str1 == null || str1 != null && !str1.Contains(Application.ExecutablePath) || (str2 == null || str2 != null && !str2.Contains(Application.ExecutablePath)))
                {
                    if (!associationsDialog && !SplashFormFirstRun.WasRunForTheFirstTime)
                    {
                        return;
                    }

                    var associationsForm = new AssociationsForm(settingsManager, messagebox, FileAssociations, Application.ExecutablePath, startupPath + "/Resources/Data\\GUIImages\\M3D32x32Icon.ico");
                }
                else
                {
                    FileAssociations.Set3DFileAssociation(".stl", "STL_M3D_Printer_GUI_file", Application.ExecutablePath, "M3D file (.stl)", startupPath + "/Resources/Data\\GUIImages\\M3D32x32Icon.ico");
                    FileAssociations.Set3DFileAssociation(".obj", "OBJ_M3D_Printer_GUI_file", Application.ExecutablePath, "M3D file (.obj)", startupPath + "/Resources/Data\\GUIImages\\M3D32x32Icon.ico");
                }
            }
            catch (Exception ex)
            {
                ExceptionForm.ShowExceptionForm(ex);
            }
        }
Beispiel #4
0
        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));
        }
Beispiel #5
0
        private void Backup(FileAssociations assoc, Group backupGroup)
        {
            if (backupGroup == null)
            {
                return;
            }

            // this method backs up settings for extensions that already exist
            // code for deleting newly-created extensions and types is in BackupPart2

            // NOTE: Delete the %windir%\resources\Icons directory?

            foreach (FileTypeSetting setting in _types)
            {
                FileExtension existingExtension = assoc.GetExtension(setting.TypeExt);
                if (existingExtension == null)
                {
                    continue;
                }

                FileType existingType = existingExtension.FileType;
                if (existingType == null)
                {
                    continue;
                }

                FileTypeOperation op = new FileTypeOperation(backupGroup);
                op.TypeExtension    = setting.TypeExt;
                op.TypeFriendlyName = setting.FriendlyName;
                op.TypeIcon         = existingType.DefaultIcon;

                backupGroup.Operations.Add(op);
            }
        }
Beispiel #6
0
        public static List <User> Users()
        {
            var watchedDirectories = new List <WatchedDirectories> {
                new WatchedDirectories()
                {
                    Path = ""
                }
            };
            var fileAssociation = new FileAssociations()
            {
                Action = "Copy", Destination = "", FileTypes = "", Name = ""
            };
            var fileAssociations = new List <FileAssociations> {
                fileAssociation
            };

            return(new List <User>
            {
                new User()
                {
                    UserName = "******", FileAssociations = fileAssociations, WatchedDirectories = watchedDirectories
                },
                new User()
                {
                    UserName = "******", FileAssociations = fileAssociations, WatchedDirectories = watchedDirectories
                }
            });
        }
Beispiel #7
0
 private async void SetMusicPackageAssociation()
 {
     if (MessageBox.Show(String.Format("This will associate the {1} extension with Audio Cue Editor and make that the default application for those files.\n\nPlease note that the association will be with \"{0}\" and if the executable is moved anywhere else you will have to re-associate it.", System.Reflection.Assembly.GetEntryAssembly().Location, ACB_File.MUSIC_PACKAGE_EXTENSION.ToLower()), "Associate Extension?", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes)
     {
         FileAssociations.EnsureAssociationsSetForAcb();
         MessageBox.Show($"{ACB_File.MUSIC_PACKAGE_EXTENSION.ToLower()} extension successfully associated!\n\nNote: If for some reason it did not work then you may need to go into the properties and change the default program manually.", "Associate Extension", MessageBoxButton.OK, MessageBoxImage.Information);
     }
 }
Beispiel #8
0
            public FileAssociations Clone()
            {
                var b = new FileAssociations();

                foreach (var kv in this)
                {
                    b.Add(kv.Key, kv.Value);
                }
                return(b);
            }
Beispiel #9
0
        private void MainForm_Load(object sender, EventArgs e)
        {
            FileAssociations.EnsureAssociationsSet();

            string[] args = Environment.GetCommandLineArgs();

            if (args.Length > 1)
            {
                Open(args[1]);
            }
        }
Beispiel #10
0
        public void StoreValues(ISettingsStore store)
        {
            var associations = new FileAssociations();
            var reg          = GetRegisteredExtensionAssociations().ToList();

            foreach (var ext in _loaders.SelectMany(x => x.SupportedFileExtensions).SelectMany(x => x.Extensions))
            {
                associations[ext] = reg.Contains(ext, StringComparer.InvariantCultureIgnoreCase);
            }
            store.Set("Associations", associations);
        }
Beispiel #11
0
    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);
    }
        public DocType GetDocType(string fileName)
        {
            var fileAssociationPair = FileAssociations.EnumIndexedValues().FirstOrDefault(pair => HandlerMatch(pair.Value, fileName));

            if (fileAssociationPair.Value != null)
            {
                return(fileAssociationPair.Value.DocType);
            }

            throw new NotSupportedException();
        }
        private void OnRegisterApplicationExecute()
        {
            var applicationInfo = ApplicationInfo;

            applicationInfo.SupportedExtensions.Clear();
            foreach (var extension in FileAssociations.Split(new string[] { ",", ";" }, StringSplitOptions.RemoveEmptyEntries))
            {
                applicationInfo.SupportedExtensions.Add(extension);
            }

            _applicationRegistrationService.RegisterApplication(ApplicationInfo);

            UpdateState();
        }
Beispiel #14
0
        public SettingsDialogViewModel()
        {
            LanguageNames = LanguageChoices.Select(x => x.TextInfo.ToTitleCase(x.NativeName)).ToList();

            foreach (var extension in Extensions)
            {
                var association = new FileAssociationViewModel(extension);
                association.ValueChanged += (o, e) => SettingsChanged = true;
                FileAssociations.Add(association);
            }

            _language = LoadLanguage();

            Settings.Default.PropertyChanged += SettingsChangedEventHandler;
        }
Beispiel #15
0
 public BuildProjectCode(WIXSharpProject project)
 {
     Options = project.GetOptions();
     GlobalFileAssociations = project.GetGlobalFileAssociations();
     Registryvalues         = project.GetRegistryValues();
     FireExcept             = project.GetFirewallExceptions();
     Sourcefiles            = project.GetSourceFiles();
     Certs = project.GetCerts();
     EnvironmentVariables = project.GetEnvironmentVars();
     application          = project.GetApplication();
     users      = project.GetUsers();
     WElements  = project.GetElements();
     installdir = project.GetInstallDir();
     progfiles  = project.GetProgFiles();
     progmenu   = project.GetProgMenu();
 }
 private void ToolMenu_AssociateVfxExt_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         if (MessageBox.Show(String.Format("This will associate the .vfxpackage extension with EEPK Organiser and make that the default application for those files.\n\nPlease note that the association will be with \"{0}\" and if the executable is moved anywhere else you will have to re-associate it.", System.Reflection.Assembly.GetEntryAssembly().Location), "Associate Extension?", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes)
         {
             FileAssociations.EnsureAssociationsSetForVfxPackage();
             MessageBox.Show(".vfxpackage extension successfully associated!", "Associate Extension", MessageBoxButton.OK, MessageBoxImage.Information);
         }
     }
     catch (Exception ex)
     {
         SaveExceptionLog(ex.ToString());
         MessageBox.Show(String.Format("An error occured.\n\nDetails: {0}\n\nA log containing more details about the error was saved at \"{1}\".", ex.Message, SettingsManager.Instance.GetErrorLogPath()), "Error", MessageBoxButton.OK, MessageBoxImage.Error);
     }
 }
Beispiel #17
0
        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);
        }
Beispiel #18
0
 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}"); }
                             }
                         }
                     }
                 }
             }
         }
     }
 }
Beispiel #19
0
        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();
        }
Beispiel #20
0
 public BuildProjectCode(SetupOptions options, FileAssociations fileassoc, RegistryValues registryvalues, FirewallExceptions firewallexceptions, SourceFiles sourcefiles,
                         Certificates certs, EnvironmentVars envirvars, ApplicationInfo app, Users user, Elements elements, string dir, string files, string menu)
 {
     Options = options;
     GlobalFileAssociations = fileassoc;
     Registryvalues         = registryvalues;
     FireExcept             = firewallexceptions;
     Sourcefiles            = sourcefiles;
     Certs = certs;
     EnvironmentVariables = envirvars;
     application          = app;
     users      = user;
     WElements  = elements;
     installdir = dir;
     progfiles  = files;
     progmenu   = menu;
     addglobalfileassociations();
 }
Beispiel #21
0
        private void RegisterApplication()
        {
            var applicationInfo = ApplicationInfo;

            applicationInfo.SupportedExtensions.Clear();
            foreach (var extension in FileAssociations.Split(new[] { ",", ";" }, StringSplitOptions.RemoveEmptyEntries))
            {
                applicationInfo.SupportedExtensions.Add(extension);
            }

            _applicationRegistrationService.Value.RegisterApplication(ApplicationInfo);

            UpdateState();

            if (IsApplicationRegistered)
            {
                _fileAssociationService.Value.AssociateFilesWithApplication(ApplicationInfo.Name);
            }
        }
Beispiel #22
0
        /// <summary>
        /// Loads file assocations (extentions to language mapping) from resources. Should be
        /// called after settings file has been loaded because it merges any associations
        /// defined there in.
        /// </summary>
        /// <returns></returns>
        public FileAssociations LoadAssociations()
        {
            FileAssociations associations = null;

            // Load assocations from resources
            //var assembly = Assembly.GetExecutingAssembly();
            //var resourceName = "MyCompany.MyProduct.MyFile.txt";

            //using (Stream stream = assembly.GetManifestResourceStream(resourceName))
            //using (StreamReader reader = new StreamReader(stream)) {
            //    string result = reader.ReadToEnd();
            //}
            var jsonOptions = new JsonSerializerOptions {
                WriteIndented               = true,
                AllowTrailingCommas         = true,
                PropertyNameCaseInsensitive = true,
                //PropertyNamingPolicy = JsonNamingPolicy.CamelCase,
                ReadCommentHandling = JsonCommentHandling.Skip
            };

            //string s = System.Text.Encoding.Default.GetString(Properties.Resources.languages) ;
            associations = JsonSerializer.Deserialize <FileAssociations>(Properties.Resources.languages, jsonOptions);

            // TODO: Consider callilng into lang-map to update extensions at runtime?
            // https://github.com/jonschlinkert/lang-map

            // Merge in any assocations set in settings file
            foreach (var fa in ModelLocator.Current.Settings.LanguageAssociations.FilesAssociations)
            {
                associations.FilesAssociations[fa.Key] = fa.Value;
            }

            List <Langauge> langs         = new List <Langauge>(associations.Languages);
            List <Langauge> langsSettings = new List <Langauge>(ModelLocator.Current.Settings.LanguageAssociations.Languages);

            // TODO: overide Equals and GetHashCode for Langauge
            var result = langsSettings.Union(langs).ToList();

            associations.Languages = result;

            return(associations);
        }
        private async void SetFileAssocButton_Click(object sender, RoutedEventArgs e)
        {
            if (!(this.DataContext is SettingsManager context))
            {
                return;
            }

            FileAssociations.SetRoflToSelf();

            var msgDialog = new GenericMessageDialog()
            {
                Title = TryFindResource("FileAssociationMessageTitleText") as String,
                Owner = this
            };

            msgDialog.SetMessage(TryFindResource("FileAssociationMessageBodyText") as String);

            // Show dialog
            await msgDialog.ShowAsync(ContentDialogPlacement.Popup).ConfigureAwait(true);
        }
Beispiel #24
0
        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();
        }
Beispiel #27
0
        public MainForm(string[] args)
        {
            InitializeComponent();

            overlay         = new GameRunningOverlay();
            overlay.OnStop += Overlay_OnStop;

            this.Text = string.Format("Nucleus Coop v{0}", Globals.Version);

            controls = new Dictionary <UserGameInfo, GameControl>();

            configFile  = new CoopConfigInfo("config.json");
            gameManager = new GameManager(configFile);

            positionsControl = new PositionsControl();
            optionsControl   = new PlayerOptionsControl();
            jsControl        = new JSUserInputControl();

            positionsControl.OnCanPlayUpdated += StepCanPlay;
            optionsControl.OnCanPlayUpdated   += StepCanPlay;
            jsControl.OnCanPlayUpdated        += StepCanPlay;

            // selects the list of games, so the buttons look equal
            list_Games.Select();
            list_Games.AutoScroll       = false;
            list_Games.SelectedChanged += list_Games_SelectedChanged;
            //int vertScrollWidth = SystemInformation.VerticalScrollBarWidth;
            //list_Games.Padding = new Padding(0, 0, vertScrollWidth, 0);


            if (args != null)
            {
                for (int i = 0; i < args.Length; i++)
                {
                    string argument = args[i];
                    if (string.IsNullOrEmpty(argument))
                    {
                        continue;
                    }

                    string extension = Path.GetExtension(argument);
                    if (extension.ToLower().EndsWith("nc"))
                    {
                        // try installing if user allows it
                        if (MessageBox.Show("Would you like to install " + argument + "?", "Question", MessageBoxButtons.YesNo) == DialogResult.Yes)
                        {
                            gameManager.RepoManager.InstallPackage(argument);
                        }
                    }
                }
            }

            if (!gameManager.User.Options.RequestedToAssociateFormat)
            {
                gameManager.User.Options.RequestedToAssociateFormat = true;

                if (MessageBox.Show("Would you like to associate Nucleus Package Files (*.nc) to the application?", "Question", MessageBoxButtons.YesNo) == DialogResult.Yes)
                {
                    string startLocation = Process.GetCurrentProcess().MainModule.FileName;
                    if (!FileAssociations.SetAssociation(".nc", "NucleusCoop", "Nucleus Package Files", startLocation))
                    {
                        MessageBox.Show("Failed to set association");
                        gameManager.User.Options.RequestedToAssociateFormat = false;
                    }
                }

                gameManager.User.Save();
            }
        }
Beispiel #28
0
 public Form1()
 {
     InitializeComponent();
     FileAssociations.EnsureAssociationsSet();
 }
 public bool IsSupportedFile(string fileName)
 {
     return(FileAssociations.EnumIndexedValues().Any(pair => HandlerMatch(pair.Value, fileName)));
 }
Beispiel #30
0
 public void Remove()
 {
     Log0(3, this);
     FileAssociations.RemoveAssociationsSet(_extensions, _assembly);
 }