Exemple #1
0
        public MainWindow(string[] args)
        {
            InitializeComponent();

            launchParameters = new LaunchParameters(args);

            // Настройки лаунчера
            launcherSettings = Registry.CurrentUser.OpenSubKey("RoELauncher", true);
            if (launcherSettings == null)
            {
                launcherSettings = Registry.CurrentUser.CreateSubKey("RoELauncher", RegistryKeyPermissionCheck.ReadWriteSubTree);

                launcherSettings.SetValue("Token", "", RegistryValueKind.String);
                launcherSettings.SetValue("Uid", "", RegistryValueKind.String);
                launcherSettings.SetValue("Language", "", RegistryValueKind.String);
                launcherSettings.SetValue("Server", "", RegistryValueKind.String);

                PlayButton.IsEnabled = false;
                PlayButton.Content   = Properties.Resources.SelectPath;

                SettingsGrid.Visibility  = Visibility.Visible;
                SettingsButton.IsEnabled = false;
            }
            else
            {
                PathToGame = launcherSettings.GetValue("PathToGame").ToString();

                if (launchParameters.IsEmpty())
                {
                    string token    = launcherSettings.GetValue("Token").ToString();
                    string uid      = launcherSettings.GetValue("Uid").ToString();
                    string language = launcherSettings.GetValue("Language").ToString();
                    string server   = launcherSettings.GetValue("Server").ToString();
                    launchParameters = new LaunchParameters(token, uid, language, server);

                    if (launchParameters.IsEmpty())
                    {
                        PlayButton.IsEnabled = false;
                        PlayButton.Content   = Properties.Resources.StartupGarena;
                    }
                }
                else
                {
                    if (launchParameters.Language == "th")
                    {
                        launchParameters.Language = "en";
                    }

                    launcherSettings.SetValue("Token", launchParameters.Token, RegistryValueKind.String);
                    launcherSettings.SetValue("Uid", launchParameters.Uid, RegistryValueKind.String);
                    launcherSettings.SetValue("Language", launchParameters.Language, RegistryValueKind.String);
                    launcherSettings.SetValue("Server", launchParameters.Server, RegistryValueKind.String);
                }
            }

            LanguageTexBox.Text = launchParameters.Language;

            // Пинг
            PingAsync("203.205.147.187", 1000, 500);
        }
Exemple #2
0
        // Выбор пути к игре
        private void PathButton_Click(object sender, RoutedEventArgs e)
        {
            OpenFileDialog ofd = new OpenFileDialog();

            ofd.Filter = "Ring of Elysium Client | roe_game.exe";
            if (ofd.ShowDialog() == true)
            {
                PathToGame = ofd.FileName;

                launcherSettings.SetValue("PathToGame", ofd.FileName, RegistryValueKind.String);

                if (launchParameters.IsEmpty())
                {
                    PlayButton.Content = Properties.Resources.StartupGarena;
                }
                else
                {
                    PlayButton.IsEnabled = true;
                    PlayButton.Content   = Properties.Resources.Play;
                }
            }
        }