Esempio n. 1
0
 public Configuration()
 {
     RecentFiles = new RecentItems();
     Debug       = new DebugInfo();
     Video       = new VideoConfig();
     Audio       = new AudioConfig();
     Input       = new InputConfig();
     Emulation   = new EmulationConfig();
     Preferences = new PreferencesConfig();
     AviRecord   = new AviRecordConfig();
 }
Esempio n. 2
0
 public Configuration()
 {
     RecentFiles = new RecentItems();
     Debug       = new DebugInfo();
     Video       = new VideoConfig();
     Audio       = new AudioConfig();
     Input       = new InputConfig();
     Emulation   = new EmulationConfig();
     Preferences = new PreferencesConfig();
     AviRecord   = new AviRecordConfig();
     MovieRecord = new MovieRecordConfig();
     Cheats      = new CheatWindowConfig();
     Netplay     = new NetplayConfig();
 }
Esempio n. 3
0
        static public void ConfigureLinuxMimeTypes()
        {
            PreferencesConfig cfg = ConfigManager.Config.Preferences;

            string baseFolder    = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), ".local", "share");
            string desktopFolder = Path.Combine(baseFolder, "applications");
            string mimeFolder    = Path.Combine(baseFolder, "mime");
            string iconFolder    = Path.Combine(baseFolder, "icons");

            if (!Directory.Exists(mimeFolder))
            {
                Directory.CreateDirectory(mimeFolder);
            }
            if (!Directory.Exists(iconFolder))
            {
                Directory.CreateDirectory(iconFolder);
            }
            if (!Directory.Exists(desktopFolder))
            {
                Directory.CreateDirectory(desktopFolder);
            }


            //Use a GUID to get a unique filename and then delete old files to force a reset of file associations
            //Otherwise they are sometimes not refreshed properly
            string desktopFilename = "mesen-s." + Guid.NewGuid().ToString() + ".desktop";
            string desktopFile     = Path.Combine(desktopFolder, desktopFilename);

            foreach (string file in Directory.GetFiles(desktopFolder, "mesen-s.*.desktop"))
            {
                if (File.Exists(file))
                {
                    try {
                        File.Delete(file);
                    } catch { }
                }
            }

            List <string> mimeTypes = new List <string>();

            CreateMimeType("x-mesen-nes", "sfc", "SNES Rom", mimeTypes, cfg.AssociateRomFiles);
            CreateMimeType("x-mesen-nes", "smc", "SNES Rom", mimeTypes, cfg.AssociateRomFiles);
            CreateMimeType("x-mesen-nes", "swc", "SNES Rom", mimeTypes, cfg.AssociateRomFiles);
            CreateMimeType("x-mesen-nes", "fig", "SNES Rom", mimeTypes, cfg.AssociateRomFiles);
            CreateMimeType("x-mesen-mss", "mss", "Mesen-S Save State", mimeTypes, cfg.AssociateMssFiles);
            CreateMimeType("x-mesen-msm", "msm", "Mesen-S Movie File", mimeTypes, cfg.AssociateMsmFiles);

            //Icon used for shortcuts
            //TOOD
            //Mesen.GUI.Properties.Resources.MesenIcon.Save(Path.Combine(iconFolder, "MesenSIcon.png"), ImageFormat.Png);

            CreateShortcutFile(desktopFile, mimeTypes);

            //Update databases
            try {
                System.Diagnostics.Process.Start("update-mime-database", mimeFolder).WaitForExit();
                System.Diagnostics.Process.Start("update-desktop-database", desktopFolder);
            } catch {
                try {
                    EmuApi.WriteLogEntry("An error occurred while updating file associations");
                } catch {
                    //For some reason, Mono crashes when trying to call this if libMesenCore.dll was not already next to the .exe before the process starts?
                    //This causes a "MesenCore.dll not found" popup, so catch it here and ignore it.
                }
            }
        }