Exemple #1
0
        public static GameConfigXml Load(string configXml, params object[] param)
        {
            GameConfigXml config = null;

            if (File.Exists(configXml))
            {
                Stream stream = null;
                try
                {
                    stream = new FileStream(configXml, FileMode.Open, FileAccess.Read);
                    XmlSerializer serializer = new XmlSerializer(typeof(GameConfigXml));
                    config = serializer.Deserialize(stream) as GameConfigXml;
                }
                catch
                {
                }
                finally
                {
                    if (stream != null)
                    {
                        stream.Close();
                    }
                }
            }
            else
            {
                config = new GameConfigXml();
                config.GenerateDefaultConfig(param);
            }
            return(config);
        }
Exemple #2
0
        public void Run()
        {
            string modArg = gameArgument.GetArgValue("Engine.Mod");

            string showConfigArg = gameArgument.GetArgValue("Engine.ShowConfig");

            if (string.IsNullOrEmpty(showConfigArg) || showConfigArg == "yes")
            {
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);
                frmConfigureController controller = new frmConfigureController(new frmConfigure(modArg));
                controller.form.ShowDialog();
            }
            else
            {
                Root    root = new Root();
                GameApp app  = new GameApp(GameConfigXml.Load("game.xml", root), modArg);
                app.Run();
            }
        }
Exemple #3
0
        public static GameConfigXml Load(string configXml)
        {
            GameConfigXml config = new GameConfigXml();
            Stream        stream = null;

            try
            {
                stream = new FileStream(configXml, FileMode.Open, FileAccess.Read);
                XmlSerializer serializer = new XmlSerializer(typeof(GameConfigXml));
                config = serializer.Deserialize(stream) as GameConfigXml;
            }
            catch
            {
            }
            finally
            {
                if (stream != null)
                {
                    stream.Close();
                }
            }
            return(config);
        }