示例#1
0
        private void ChangeServerButtonClick(object sender, RoutedEventArgs e)
        {
            if (!this.CheckIsUserAndServerListSelected())
            {
                MessageBox.Show("エラーが発生しました\nユーザー、もしくはサーバーを選択してください");
                return;
            }

            if (FileController.SaveChangedServerData(this.GetPathData()[this.ItemPropertyName[0]], this.GetSelectedUserName(), this.GetSelectedServerName()))
            {
                this.UpdateUserNavigationText(true);
            }
        }
示例#2
0
        private void UplayUserChangeButtonClick(object sender, RoutedEventArgs e)
        {
            if (!this.CheckIsUserDataSelected())
            {
                MessageBox.Show("ユーザーを選択してください");
                return;
            }

            if (!FileController.OpenApp(this.UplayAppFileDirectoryTextBox.Text))
            {
                MessageBox.Show("Uplayの正しいパスが設定されていません");
                return;
            }

            System.Threading.Thread.Sleep(3000);
            this.WindowState = WindowState.Minimized;

            // もう少しなんとかしたい
            if (!UplayController.SendUplayLogoutMessage())
            {
                this.WindowState = WindowState.Normal;
                this.Activate();
                MessageBox.Show("Failed to Logout.\nPlease try again.");
                return;
            }

            if (!UplayController.ActivateUplay())
            {
                this.WindowState = WindowState.Normal;
                this.Activate();
                MessageBox.Show("Failed to Activate.\nPlease try again.");
                return;
            }

            var userName = this.GetSelectedUserName();

            if (!UplayController.SendUserLoginMessage(
                    this.UserData[userName][this.UserDataPropertyName[1]],
                    this.UserData[userName][this.UserDataPropertyName[2]]))
            {
                this.WindowState = WindowState.Normal;
                this.Activate();
                MessageBox.Show("Failed to Login.\nPlease try again.");
            }
        }
示例#3
0
        private void ServerAndR6SStartButtonClick(object sender, RoutedEventArgs e)
        {
            if (!this.CheckIsUserAndServerListSelected())
            {
                MessageBox.Show("エラーが発生しました\nユーザー、もしくはサーバーを選択してください");
                return;
            }

            if (FileController.SaveChangedServerData(this.GetPathData()[this.ItemPropertyName[0]], this.GetSelectedUserName(), this.GetSelectedServerName()))
            {
                this.UpdateUserNavigationText(true);
            }

            if (!FileController.OpenApp(this.AppFileDirectoryTextBox.Text))
            {
                MessageBox.Show("R6Sの正しいパスが設定されていません");
                return;
            }

            this.WindowState = WindowState.Minimized;
        }
示例#4
0
        /// <summary>
        /// The main window closed.
        /// </summary>
        /// <param name="sender">
        /// The sender.
        /// </param>
        /// <param name="e">
        /// The e.
        /// </param>
        private void MainWindowClosed(object sender, EventArgs e)
        {
            var items = new Dictionary <string, string>();

            if (!this.CheckIsUserDataSelected() && !this.CheckIsServerListSelected())
            {
                return;
            }

            if (this.CheckIsUserDataSelected())
            {
                items.Add(this.LastSelectionPropertyName[0], this.GetSelectedUserName());
            }

            if (this.CheckIsServerListSelected())
            {
                items.Add(this.LastSelectionPropertyName[1], this.GetSelectedServerName());
            }

            FileController.SaveApplicationDirectoryInfo(items, this.LastSelectionPropertyName, R6SServerChangerTextContainer.LastSelectionItemsName);
        }
示例#5
0
        private void UserDataSaveButtonClick(object sender, RoutedEventArgs e)
        {
            var parentWindow = GetWindow((System.Windows.Controls.Button)sender);

            if (parentWindow?.Tag == null)
            {
                return;
            }

            var userName = parentWindow.Tag.ToString();
            var udiw     = (UserDataInputWindow)parentWindow;

            var data = udiw.GetUserData(this.UserDataPropertyName);

            // アプリ中に保存
            if (this.UserData.ContainsKey(userName))
            {
                this.UserData[userName] = data;
            }
            else
            {
                this.UserData.Add(userName, data);
            }

            var userItemsName = new List <string>();

            userItemsName.AddRange(this.UserDataPropertyName.Select(item => userName + item + "="));

            // ファイル中に保存
            // これはUserDataInputWindowがFileControllerとかかわっていることになる?
            FileController.SaveUserInfo(
                userName,
                data,
                this.UserDataPropertyName,
                userItemsName.ToArray());

            this.UpdateUserDataField();

            udiw.Close();
        }
示例#6
0
        /// <summary>
        /// ユーザー名が記載されたスタックパネルの要素を削除、与えられたパス(SettingFileDirectoryTextBox.Text)を元にユーザー名を新規追加する
        /// </summary>
        private void UpdateUserDataField()
        {
            if (this.UserDataStackPanel.Children.Count > 0)
            {
                this.UserDataStackPanel.Children.Clear();
            }

            var dir       = this.SettingFileDirectoryTextBox.Text;
            var userNames = FileController.GetUserNames(dir);

            foreach (var item in userNames)
            {
                var rb = new RadioButton
                {
                    Style    = this.ToggleStyledRadioButton.Style,
                    Template = this.ToggleStyledRadioButton.Template,
                    Tag      = item,

                    // 画像サイズ:200*160
                    Width    = this.UserDataStackPanel.ActualWidth / 4,
                    Height   = this.UserDataStackPanel.ActualWidth / 5,
                    FontSize = this.UserDataStackPanel.ActualWidth / 40
                };
                if (this.UserData[item][this.UserDataPropertyName[0]] != string.Empty)
                {
                    rb.Content = this.UserData[item][this.UserDataPropertyName[0]];
                }
                else
                {
                    rb.Content = item.Substring(0, 12) + "...";
                }

                rb.Checked += this.RbChecked;
                rb.MouseRightButtonDown += this.RbRightButtonDown;
                this.UserDataStackPanel.Children.Add(rb);
            }
        }
示例#7
0
        /// <summary>
        /// メインウィンドウのロード完了時に実行されるメソッド
        /// </summary>
        /// <param name="sender">
        /// The sender.
        /// </param>
        /// <param name="e">
        /// The e.
        /// </param>
        private void MainWindowLoaded(object sender, RoutedEventArgs e)
        {
            // アプリの設定ファイルを読み込み、以前設定したパスがあるなら読み込む
            var pathData = FileController.ReadApplicationDirectoryInfo(this.ItemPropertyName);

            // game setting path
            if (Directory.Exists(pathData[this.ItemPropertyName[0]]))
            {
                this.SettingFileDirectoryTextBox.Text = pathData[this.ItemPropertyName[0]];
            }
            else
            {
                var dir = Environment.GetFolderPath(Environment.SpecialFolder.Personal) + @"\My Games\Rainbow Six - Siege";
                if (Directory.Exists(dir))
                {
                    this.SettingFileDirectoryTextBox.Text = dir;
                }
            }

            // R6S path
            if (File.Exists(pathData[this.ItemPropertyName[1]]))
            {
                this.AppFileDirectoryTextBox.Text = pathData[this.ItemPropertyName[1]];
            }
            else
            {
                var dir = Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData);
                if (Directory.Exists(dir))
                {
                    this.AppFileDirectoryTextBox.Text = dir;
                }
            }

            // uplay path
            if (File.Exists(pathData[this.ItemPropertyName[2]]))
            {
                this.UplayAppFileDirectoryTextBox.Text = pathData[this.ItemPropertyName[2]];
            }
            else
            {
                var dir = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86) + @"\Ubisoft\Ubisoft Game Launcher";
                if (Directory.Exists(dir))
                {
                    this.UplayAppFileDirectoryTextBox.Text = dir;
                    if (File.Exists(dir + @"\Uplay.exe"))
                    {
                        this.UplayAppFileDirectoryTextBox.Text += @"\Uplay.exe";
                    }
                }
            }

            // アプリの設定ファイルを読み込み、以前設定したユーザーデータが存在するなら読み込む
            var settingFileDir = this.SettingFileDirectoryTextBox.Text;
            var userNames      = FileController.GetUserNames(settingFileDir);

            foreach (var userName in userNames)
            {
                var data = FileController.ReadUserInfo(userName, this.UserDataPropertyName);
                this.UserData.Add(userName, data);
            }

            this.UpdateUserDataField();
            this.InitializeServerList();

            var ls = FileController.ReadApplicationDirectoryInfo(this.LastSelectionPropertyName);

            foreach (var item in this.UserDataStackPanel.Children)
            {
                if (((RadioButton)item).Tag.ToString() != ls[this.LastSelectionPropertyName[0]])
                {
                    continue;
                }

                ((RadioButton)item).IsChecked = true;
                break;
            }

            foreach (var item in this.ServerListBox.Items)
            {
                if (((TextBlock)item).Tag.ToString() != ls[this.LastSelectionPropertyName[1]])
                {
                    continue;
                }

                this.ServerListBox.SelectedItem = item;
                break;
            }

            this.UpdateUserNavigationText(false);
        }
示例#8
0
 /// <summary>
 /// パスを取得し、そのままそのデータを保存
 /// </summary>
 private void GetandSavePathData()
 {
     FileController.SaveApplicationDirectoryInfo(this.GetPathData(), this.ItemPropertyName, R6SServerChangerTextContainer.SettingItemsName);
 }