示例#1
0
        void ProfileSwitch(object sender)
        {
            string newProfile = sender.ToString();

            SaveSettings(false);

            var newGameData = Settings.data.Games[newProfile];

            if (newGameData.Name != gameData.Name)
            {
                if (string.IsNullOrWhiteSpace(newGameData.Path))
                {
                    var dialog = new VistaFolderBrowserDialog
                    {
                        Description            = $"Select userdata folder for {newGameData.Name}",
                        UseDescriptionForTitle = true
                    };
                    if (dialog.ShowDialog(this) == true)
                    {
                        newGameData.Path = dialog.SelectedPath;
                    }
                }

                if (!string.IsNullOrWhiteSpace(newGameData.Path)) // check if paths in category exist here
                {
                    TabScene.StopThread();
                    TabChara1.StopThread();
                    TabChara2.StopThread();
                    TabOutfit1.StopThread();
                    TabOutfit2.StopThread();

                    Settings.data.LastProfile = newProfile;
                    SaveSettings(false);
                    gameData = newGameData;

                    ProcessList.Clear();
                    gameData.SceneList.ForEach((y) => ProcessList.Add(y.Name));
                    var scene = gameData.SceneList[gameData.SavedScene];
                    currentTarget               = scene.Name;
                    WindowTitle.Value           = $"{defaultTitle} - {gameData.Name} - {currentTarget}";
                    PartialReplaceEnabled.Value = scene.PartialReplaceEnabled;
                    SpecialLoadEnabled.Value    = scene.SpecialLoadEnabled;

                    TabScene.SetGame(gameData, gameData.Category.Scene);
                    TabChara1.SetGame(gameData, gameData.Category.Chara1);
                    TabChara2.SetGame(gameData, gameData.Category.Chara2);
                    TabOutfit1.SetGame(gameData, gameData.Category.Outfit1);
                    TabOutfit2.SetGame(gameData, gameData.Category.Outfit2);

                    ImageMultiplier.Value = SelectedTab.ImageMultiplier;
                    SavedTab.Value        = gameData.Tab != -1 ? gameData.Tab : 0;
                }
            }
        }
示例#2
0
        void Window_Loaded(object sender, RoutedEventArgs e)
        {
            if (!string.IsNullOrWhiteSpace(Settings.data.LastProfile))
            {
                gameData = Settings.data.Games[Settings.data.LastProfile];
            }

            if (gameData == null)
            {
                var list = new SelectList("Choose a profile", Settings.data.Games.Keys);
                list.Top  = Top + (Height / 2) - (list.Height / 2);
                list.Left = Left + (Width / 2) - (list.Width / 2);

                if (list.ShowDialog() == true)
                {
                    gameData = Settings.data.Games[list.Selected];
                    Settings.data.LastProfile = list.Selected;
                }
            }

            if (gameData != null)
            {
                if (string.IsNullOrWhiteSpace(gameData.Path))
                {
                    var dialog = new VistaFolderBrowserDialog
                    {
                        Description            = $"Select userdata folder for {gameData.Name}",
                        UseDescriptionForTitle = true
                    };

                    if (dialog.ShowDialog(this) == true)
                    {
                        gameData.Path = dialog.SelectedPath;
                    }
                }

                if (!string.IsNullOrWhiteSpace(gameData.Path)) // check if paths in category exist here
                {
                    RPCServer.Start(serverName, serverPort);
                    RPCClient_UI.Start(serverName, serverPort);

                    gameData.SceneList.ForEach((x) => ProcessList.Add(x.Name));
                    var scene = gameData.SceneList[gameData.SavedScene];
                    currentTarget               = scene.Name;
                    WindowTitle.Value           = $"{defaultTitle} - {gameData.Name} - {currentTarget}";
                    PartialReplaceEnabled.Value = scene.PartialReplaceEnabled;
                    SpecialLoadEnabled.Value    = scene.SpecialLoadEnabled;

                    TabScene.SetGame(gameData, gameData.Category.Scene);
                    TabChara1.SetGame(gameData, gameData.Category.Chara1);
                    TabChara2.SetGame(gameData, gameData.Category.Chara2);
                    TabOutfit1.SetGame(gameData, gameData.Category.Outfit1);
                    TabOutfit2.SetGame(gameData, gameData.Category.Outfit2);

                    ImageMultiplier.Value = SelectedTab.ImageMultiplier;
                    SavedTab.Value        = gameData.Tab != -1 ? gameData.Tab : 0;

                    Closing += Window_Closing;

                    return;
                }
            }

            Close();
        }