Ejemplo n.º 1
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);
        }
Ejemplo n.º 2
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);
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Initializes the Plugin.<br/>
        /// The IHyperpinPlugin interface requires the implementation of this method.<br/>
        /// DirectOutput likes to receive a global config filename, a table file name and a romname when it is initialized. <br/>
        /// The global config file for the HyperPinPlugin is called GlobalConfig_Hyperpin.xml and should reside in the config subdirectory of the directory containing the DirectOutput.dll or there can be a shortcut named config pointing to the directory containg the config file.<br/>
        /// For the tablename the name of a file named Hyperpin.tmp located in the config dir of DirectOutput is supplied to DirectOutput. This file does/must not exist.<br/>
        /// For the RomName the value Hyperpin is provided to DOF to allow for configuratiojn through LedControl files.
        /// </summary>
        public void PluginInit()
        {
            //Check config dir for global config file
            FileInfo F = new FileInfo(Path.Combine(new FileInfo(Assembly.GetExecutingAssembly().Location).Directory.FullName, "config", "GlobalConfig_Hyperpin.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", "GlobalConfig_Hyperpin.lnk"));
                if (LnkFile.Exists)
                {
                    string ConfigDirPath = ResolveShortcut(LnkFile);
                    if (Directory.Exists(ConfigDirPath))
                    {
                        F = new FileInfo(Path.Combine(ConfigDirPath, "GlobalConfig_Hyperpin.xml"));
                    }
                }
            }

            Pinball.Init(F.FullName, Path.Combine(new FileInfo(Assembly.GetExecutingAssembly().Location).Directory.FullName, "config", "Hyperpin.tmp"), "Hyperpin");
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Initializes the Plugin.<br/>
        /// The IDirectPlugin interface requires the implementation of this method.<br/>
        /// </summary>
        /// <param name="TableFilename">The table filename.</param>
        /// <param name="RomName">Name of the rom.</param>
        public void PluginInit(string TableFilename, string RomName)
        {
            //Check config dir for global config file
            FileInfo F = new FileInfo(Path.Combine(new FileInfo(Assembly.GetExecutingAssembly().Location).Directory.FullName, "config", "GlobalConfig_B2SServer.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", "GlobalConfig_B2SServer.lnk"));
                if (LnkFile.Exists)
                {
                    string ConfigDirPath = ResolveShortcut(LnkFile);
                    if (Directory.Exists(ConfigDirPath))
                    {
                        F = new FileInfo(Path.Combine(ConfigDirPath, "GlobalConfig_B2SServer.xml"));
                    }
                }
                if (!F.Exists)
                {
                    //Check table dir for global config file
                    F = new FileInfo("GlobalConfig_B2SServer.xml");
                    if (!F.Exists)
                    {
                        //Check dll dir for global config file
                        F = new FileInfo(Path.Combine(new FileInfo(Assembly.GetExecutingAssembly().Location).Directory.FullName, "GlobalConfig_B2SServer.xml"));
                        if (!F.Exists)
                        {
                            //if global config file does not exist, set filename to config directory.
                            F = new FileInfo(Path.Combine(new FileInfo(Assembly.GetExecutingAssembly().Location).Directory.FullName, "config", "GlobalConfig_B2SServer.xml"));
                        }
                    }
                }
            }

            Pinball.Setup(F.FullName, TableFilename, RomName);
            Pinball.Init();

            // PluginShowFrontend();
        }