Beispiel #1
0
 public static void SaveConfig(string filename, Configuration config)
 {
     try
     {
         var serializer = new XmlSerializer(typeof(Configuration));
         TextWriter textWriter = new StreamWriter(filename);
         serializer.Serialize(textWriter, config);
         textWriter.Close();
     }
     catch (Exception)
     {
         MessageBox.Show("Error Saving " + filename);
     }
 }
Beispiel #2
0
        static void Main()
        {
            Config = new Configuration();
            LoadConfig(ConfigurationFilename);
            #if !DEBUG
            AppDomain.CurrentDomain.UnhandledException += OnUnhandledException;
            #endif
            //new update server - Forced change to prevent reseting a users config
            Config.UpdaterAddress = "/launcher/version.php";
            Config.ServerInfoAddress = "/launcher/server.php";

            LanguageManager = new LanguageManager();
            //LanguageManager.Save("English");
            LanguageManager.Load(Config.Language);

            if (LauncherHelper.CheckInstance())
                if (MessageBox.Show(LanguageManager.Translation.pmsbProgRun) == DialogResult.OK)
                    return;

            ChatServer = new ChatClient();
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            CheckmateServerList.Add("Checkmate USA+CN", new ServerInfo("Checkmate USA+CN", "173.224.211.158", 21001));
            CheckmateServerList.Add("Checkmate EU",new ServerInfo("Checkmate EU", "94.247.40.146", 7980));

            if (LauncherHelper.TestConnection())
            {
            #if !DEBUG
                if (NewUpdateCheck())
                    return;
                if (!CheckServerInfo("http://91.250.87.52"))
                    CheckServerInfo("http://ygopro.de");
            #endif
            }
            else MessageBox.Show("An internet connection is required to play online.");
            #if DEBUG
            Config.ServerAddress = "86.0.24.143";
            Config.ChatPort = 8933;
            Server = new ServerInfo("DevPro", "86.0.24.143", 3333);
            #endif

            MainForm = new MainFrm();
            Application.Run(MainForm);
        }
Beispiel #3
0
 public static void LoadConfig(string filename)
 {
     if (!File.Exists(filename))
     {
         SaveConfig(filename, new Configuration());
     }
     try
     {
         var deserializer = new XmlSerializer(typeof(Configuration));
         TextReader textReader = new StreamReader(filename);
         Config = (Configuration)deserializer.Deserialize(textReader);
         textReader.Close();
     }
     catch (Exception)
     {
         MessageBox.Show("Error Loading " + filename);
     }
 }
Beispiel #4
0
        static void Main()
        {
            Config = new Configuration();
            LoadConfig(ConfigurationFilename);
            #if !DEBUG
            AppDomain.CurrentDomain.UnhandledException += OnUnhandledException;
            #endif
            //new update server - Forced change to prevent resting a users config
            Config.UpdaterAddress = "http://ygopro.de/launcher/version.php";
            Config.ServerInfoAddress = "http://ygopro.de/launcher/server.php";

            LanguageManager = new LanguageManager();
            //LanguageManager.Save("English");
            LanguageManager.Load(Config.Language);

            if (LauncherHelper.CheckInstance())
                if (MessageBox.Show(LanguageManager.Translation.pmsbProgRun) == DialogResult.OK)
                    return;

            UserInfo = new UserData();
            ChatServer = new ChatClient();
            DuelServer = new DuelServerClient();
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            if (CheckUpdates())
                return;
            CheckServerInfo();
            #if DEBUG
            Config.ServerAddress = "86.0.24.143";
            Config.ChatPort = 9999;
            Config.GamePort = 6666;
            Server = new ServerInfo("DevPro", "86.0.24.143", 3333);
            #endif

            MainForm = new MainFrm();
            Application.Run(MainForm);
        }