Example #1
0
        //script to change client settings
        private void ScreenMode_DropDownClosed(object sender, EventArgs e)
        {
            // 0 no changes, 1 Fullscreen, 2 Borderless, 3 Windowed //
            int i = ScreenMode.SelectedIndex;

            if (i != 0)
            {
                laucherSettings.SetScreenMode(i);
                string testDir = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + @"\Escape from Tarkov\";
                if (!Directory.Exists(testDir))
                {
                    MyDocumentsEFTSettings = testDir + @"local.ini";
                    using (StreamReader sr = new StreamReader(MyDocumentsEFTSettings))
                    {
                        string json = sr.ReadToEnd();
                        profile_content = JsonConvert.DeserializeObject(json);
                    }
                    bool changedFullScreen = true;
                    if (i == 3 || i == 2) // for Windowed and Borderless
                    {
                        changedFullScreen = false;
                    }

                    if (i != 0)
                    {
                        profile_content.IsFullscreen = changedFullScreen;
                    }

                    JsonSerializer serializer = new JsonSerializer
                    {
                        NullValueHandling = NullValueHandling.Ignore
                    };
                    using (StreamWriter sw = new StreamWriter(MyDocumentsEFTSettings))
                    {
                        serializer.Serialize(sw, profile_content);
                    }
                }
            }
        }