private void readSettings(Stream stream)
        {
            StartupPreferences startupPreferences = (StartupPreferences)StartupPreferences.serializer.Deserialize(stream);

            this.startMuted            = startupPreferences.startMuted;
            this.timesPlayed           = startupPreferences.timesPlayed + 1;
            this.levelTenCombat        = startupPreferences.levelTenCombat;
            this.levelTenFishing       = startupPreferences.levelTenFishing;
            this.levelTenForaging      = startupPreferences.levelTenForaging;
            this.levelTenMining        = startupPreferences.levelTenMining;
            this.skipWindowPreparation = startupPreferences.skipWindowPreparation;
            this.windowMode            = startupPreferences.windowMode;
            LocalizedContentManager.CurrentLanguageCode = startupPreferences.languageCode;
        }
        private void readSettings(Stream stream)
        {
            StartupPreferences p = (StartupPreferences)serializer.Deserialize(stream);

            startMuted            = p.startMuted;
            timesPlayed           = p.timesPlayed + 1;
            levelTenCombat        = p.levelTenCombat;
            levelTenFishing       = p.levelTenFishing;
            levelTenForaging      = p.levelTenForaging;
            levelTenMining        = p.levelTenMining;
            skipWindowPreparation = p.skipWindowPreparation;
            windowMode            = p.windowMode;
            playerLimit           = p.playerLimit;
            gamepadMode           = p.gamepadMode;
            fullscreenResolutionX = p.fullscreenResolutionX;
            fullscreenResolutionY = p.fullscreenResolutionY;
            languageCode          = p.languageCode;
            clientOptions         = p.clientOptions;
        }
        // Token: 0x060006FE RID: 1790 RVA: 0x000A527C File Offset: 0x000A347C
        public void loadPreferences()
        {
            string fullFilePath = Path.Combine(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "StardewValley"), StartupPreferences.filename);

            if (!File.Exists(fullFilePath))
            {
                Game1.debugOutput = "File does not exist (-_-)";
                return;
            }
            Stream stream = null;

            try
            {
                stream = File.Open(fullFilePath, FileMode.Open);
            }
            catch (IOException arg_3B_0)
            {
                Game1.debugOutput = Game1.parseText(arg_3B_0.Message);
                if (stream != null)
                {
                    stream.Close();
                }
                return;
            }
            StartupPreferences p = (StartupPreferences)StartupPreferences.serializer.Deserialize(stream);

            stream.Close();
            stream.Dispose();
            this.startWindowed         = p.startWindowed;
            this.startMuted            = p.startMuted;
            this.timesPlayed           = p.timesPlayed + 1;
            this.levelTenCombat        = p.levelTenCombat;
            this.levelTenFishing       = p.levelTenFishing;
            this.levelTenForaging      = p.levelTenForaging;
            this.levelTenMining        = p.levelTenMining;
            this.skipWindowPreparation = p.skipWindowPreparation;
        }
Beispiel #4
0
        public void setWindowedOption(int setting)
        {
            this.windowedBorderlessFullscreen = this.isCurrentlyWindowedBorderless();
            this.fullscreen = !this.windowedBorderlessFullscreen && Game1.graphics.IsFullScreen;
            int num1 = -1;

            switch (setting)
            {
            case 0:
                if (!this.windowedBorderlessFullscreen)
                {
                    this.windowedBorderlessFullscreen = true;
                    Game1.toggleFullscreen();
                    this.fullscreen = false;
                }
                num1 = 0;
                break;

            case 1:
                if (Game1.graphics.IsFullScreen && !this.windowedBorderlessFullscreen)
                {
                    Game1.toggleNonBorderlessWindowedFullscreen();
                    this.fullscreen = false;
                    this.windowedBorderlessFullscreen = false;
                }
                else if (this.windowedBorderlessFullscreen)
                {
                    this.fullscreen = false;
                    this.windowedBorderlessFullscreen = false;
                    Game1.toggleFullscreen();
                }
                num1 = 1;
                break;

            case 2:
                if (this.windowedBorderlessFullscreen)
                {
                    this.fullscreen = true;
                    this.windowedBorderlessFullscreen = false;
                    Game1.toggleFullscreen();
                }
                else if (!Game1.graphics.IsFullScreen)
                {
                    Game1.toggleNonBorderlessWindowedFullscreen();
                    this.fullscreen = true;
                    this.windowedBorderlessFullscreen = false;
                    this.hardwareCursor            = false;
                    Program.gamePtr.IsMouseVisible = false;
                }
                num1 = 2;
                break;
            }
            if ((int)Game1.gameMode == 3)
            {
                Game1.exitActiveMenu();
                Game1.activeClickableMenu = (IClickableMenu) new GameMenu(6, 6);
            }
            try
            {
                StartupPreferences startupPreferences = new StartupPreferences();
                startupPreferences.loadPreferences();
                int num2 = num1;
                startupPreferences.windowMode = num2;
                startupPreferences.savePreferences();
            }
            catch (Exception ex)
            {
            }
        }