예제 #1
0
 void SaveCardData()
 {
     TabScene.SaveCardData();
     TabChara1.SaveCardData();
     TabChara2.SaveCardData();
     TabOutfit1.SaveCardData();
     TabOutfit2.SaveCardData();
 }
예제 #2
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;
                }
            }
        }
예제 #3
0
        void SaveSettings(bool saveFile)
        {
            var data = Settings.data;

            if (WindowState == WindowState.Maximized)
            {
                // Use the RestoreBounds as the current values will be 0, 0 and the size of the screen
                data.Window.Top       = RestoreBounds.Top;
                data.Window.Left      = RestoreBounds.Left;
                data.Window.Height    = RestoreBounds.Height;
                data.Window.Width     = RestoreBounds.Width;
                data.Window.Maximized = true;
            }
            else
            {
                data.Window.Top       = Top;
                data.Window.Left      = Left;
                data.Window.Height    = Height;
                data.Window.Width     = Width;
                data.Window.Maximized = false;
            }

            gameData.Tab        = tabControlMain.SelectedIndex;
            gameData.SavedScene = ProcessList.IndexOf(currentTarget);

            TabScene.SaveSettingsData();
            TabChara1.SaveSettingsData();
            TabChara2.SaveSettingsData();
            TabOutfit1.SaveSettingsData();
            TabOutfit2.SaveSettingsData();

            if (saveFile)
            {
                Settings.Save();
            }
        }
예제 #4
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();
        }