예제 #1
0
        public bool LoadConfig()
        {
            OpenConfigDialog OCD = new OpenConfigDialog(Settings);
            if (OCD.ShowDialog() == DialogResult.OK)
            {
                if (Pinball != null)
                {
                    Pinball.Finish();
                }


                Pinball = new Pinball();
                Pinball.Init(OCD.GlobalConfigFilename, OCD.TableFilename, OCD.RomName);

                DisplayTableElements();


                return true;
            }
            else
            {

                return false;
            }
        }
예제 #2
0
        /// <summary>
        /// Initializes the Plugin.<br/>
        /// The IPlugin interface requires the implementation of this method.<br/>
        /// </summary>
        /// <param name="HostingApplicationName">Name of the hosting application.</param>
        /// <param name="TableFilename">The table filename.<br>If no table filename is available, it is best to provide a path and name of a non existing dummy file, since the plugins might use this path to identify the directories where the store logs, load configs from and so on.</br></param>
        /// <param name="GameName">Name of the game.<br/>If the game is a SS pinball table it is highly recommanded to provide the name of the game rom, otherwise any other name which identifiey to game uniquely will be fine as well.</param>
        public void PluginInit(string HostingApplicationName, string TableFilename, string GameName)
        {
            string HostAppFilename = HostingApplicationName.Replace(".", "");
            foreach (char C in Path.GetInvalidFileNameChars() )
            {
                HostAppFilename=HostAppFilename.Replace(""+C,"");
            }
            foreach (char C in Path.GetInvalidPathChars())
            {
                HostAppFilename = HostAppFilename.Replace("" + C, "");
            }
            HostAppFilename = "GlobalConfig_{0}".Build(HostAppFilename);

            //Check config dir for global config file
            FileInfo F = new FileInfo(Path.Combine(new FileInfo(Assembly.GetExecutingAssembly().Location).Directory.FullName, "config", HostAppFilename+".xml"));
            if (!F.Exists)
            {
                //Check if a shortcut to the config dir exists
                FileInfo LnkFile = new FileInfo(Path.Combine(new FileInfo(Assembly.GetExecutingAssembly().Location).Directory.FullName, "config", HostAppFilename + ".lnk"));
                if (LnkFile.Exists)
                {
                    string ConfigDirPath = ResolveShortcut(LnkFile);
                    if (Directory.Exists(ConfigDirPath))
                    {
                        F = new FileInfo(Path.Combine(ConfigDirPath, HostAppFilename+".xml"));
                    }
                }
               
            }

            Pinball = new Pinball();
            Pinball.Init(F.FullName,TableFilename,GameName );

        }