Пример #1
0
 public SessionVariables NewSessionVariables()
 {
     return(new SessionVariables
     {
         LocalUserName = "",
         LocalUserID = 0,
         LocalLanguage = "English",
         LogFileLocation = "",
         CODriverLocation = "",
         HistoricFileLocation = "",
         LiveFileLocation = "",
         StreamFileLocation = "",
         ConfigFileLocation = "",
         DataFileLocation = "",
         ScreenshotFileLocation = "",
         MarketDataLocation = "",
         ErrorLogLocation = "",
         EngineerLevel = 30,
         LunaticsLevel = 15,
         NomadsLevel = 15,
         ScavengersLevel = 15,
         SteppenWolfLevel = 15,
         DawnsChildrenLevel = 15,
         FireStartersLevel = 15,
         FoundersLevel = 75,
         UploadData = false,
         SaveCaptures = true,
         TwitchMode = false,
         EndorseCODriver = true,
         ActionConfiguration = Overlay.DefaultOverlaySetup(),
         TwitchSettings = Overlay.DefaultTwitchSettings(),
         BundleRamMode = true,
         UploadPostMatch = true,
         SelectedTheme = "Terminal",
         BackColor = Color.Black,
         ForeColor = Color.Lime,
         IncludePresitgueParts = true,
         ClientVersion = GlobalData.CURRENT_VERSION,
         PrimaryDisplay = Screen.PrimaryScreen.DeviceName,
         ParsedLogs = new List <string> {
         },
         UIDLookup = new Dictionary <string, int> {
         },
         ValidUsers = new Dictionary <string, int> {
         }
     });
 }
Пример #2
0
        public SessionVariables LoadPreviousSession(SessionVariables session)
        {
            if (!File.Exists(session.ConfigFileLocation + @"\config.json"))
            {
                return(session);
            }

            SessionVariables loaded_session = NewSessionVariables();

            try
            {
                using (StreamReader file = File.OpenText(session.ConfigFileLocation + @"\config.json"))
                {
                    JsonSerializer serializer = new JsonSerializer();
                    loaded_session            = (SessionVariables)serializer.Deserialize(file, typeof(SessionVariables));
                    loaded_session.ValidUsers = session.ValidUsers;

                    if (!Screen.AllScreens.Any(x => x.DeviceName == loaded_session.PrimaryDisplay))
                    {
                        loaded_session.PrimaryDisplay = session.PrimaryDisplay;
                    }

                    if (String.IsNullOrEmpty(loaded_session.ActionConfiguration))
                    {
                        loaded_session.ActionConfiguration = Overlay.DefaultOverlaySetup();
                    }

                    if (String.IsNullOrEmpty(loaded_session.TwitchSettings))
                    {
                        loaded_session.TwitchSettings = Overlay.DefaultTwitchSettings();
                    }

                    if (ValidUserSession(loaded_session))
                    {
                        return(loaded_session);
                    }
                }
            }
            catch (Exception ex)
            {
            }
            return(session);
        }
Пример #3
0
        private void restore_default_settings(object sender, EventArgs e)
        {
            bool prompt_restart = false;

            if (session.LocalUserName != session.ValidUsers.Aggregate((l, r) => l.Value > r.Value ? l : r).Key)
            {
                DialogResult dialogResult = MessageBox.Show("Reseting will reset user name and require restart. Continue?", "Save Settings", MessageBoxButtons.YesNo);
                if (dialogResult == DialogResult.No)
                {
                    return;
                }
                prompt_restart     = true;
                session.ParsedLogs = new List <string> {
                };
            }

            log_file_manager.FindLocalUserName(session);
            log_file_manager.GetLiveFileLocation(session);

            session.LogFileLocation       = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + @"\my games\Crossout\logs";
            session.LocalLanguage         = "English";
            session.PrimaryDisplay        = Screen.PrimaryScreen.DeviceName;
            session.EngineerLevel         = 30;
            session.LunaticsLevel         = 15;
            session.NomadsLevel           = 15;
            session.ScavengersLevel       = 15;
            session.SteppenWolfLevel      = 15;
            session.DawnsChildrenLevel    = 15;
            session.FireStartersLevel     = 15;
            session.FoundersLevel         = 75;
            session.IncludePresitgueParts = true;
            session.SelectedTheme         = "Terminal";
            session.ForeColor             = Color.Lime;
            session.BackColor             = Color.Black;
            session.SaveCaptures          = true;
            session.TwitchMode            = false;
            session.BundleRamMode         = true;
            session.UploadPostMatch       = true;
            session.UploadData            = false;
            session.ActionConfiguration   = Overlay.DefaultOverlaySetup();
            session.TwitchSettings        = Overlay.DefaultTwitchSettings();

            if (reload_all_themes != null)
            {
                reload_all_themes(this, EventArgs.Empty);
            }

            if (session.LogFileLocation != txt_log_file_location.Text)
            {
                DialogResult dialogResult = MessageBox.Show("Some changes require restart. Continue?", "Save Settings", MessageBoxButtons.YesNo);
                if (dialogResult == DialogResult.No)
                {
                    return;
                }
                prompt_restart     = true;
                session.ParsedLogs = new List <string> {
                };
            }

            log_file_manager.SaveSessionConfig(session);

            if (prompt_restart)
            {
                Application.Restart();
            }

            cmb_user_names.SelectedItem         = session.LocalUserName;
            txt_log_file_location.Text          = session.LogFileLocation;
            txt_historic_log_location.Text      = session.HistoricFileLocation;
            cmb_language_drop_down.SelectedItem = session.LocalLanguage;
            cmb_fullscreen_monitor.SelectedItem = session.PrimaryDisplay;
            num_engineer_level.Value            = session.EngineerLevel;
            num_lunatic_level.Value             = session.LunaticsLevel;
            num_nomad_level.Value                = session.NomadsLevel;
            num_scavenger_level.Value            = session.ScavengersLevel;
            num_steppenwolf_level.Value          = session.SteppenWolfLevel;
            num_dawns_children_level.Value       = session.DawnsChildrenLevel;
            num_firestarter_level.Value          = session.FireStartersLevel;
            num_founders_level.Value             = session.FoundersLevel;
            chk_prestigue_parts.Checked          = session.IncludePresitgueParts;
            cmb_themes.SelectedItem              = "Terminal";
            chk_save_screen_shots.Checked        = session.SaveCaptures;
            chk_upload_post_match.Checked        = session.UploadData;
            chk_update.Checked                   = session.UploadPostMatch;
            cmb_themes.SelectedIndex             = 0;
            cmb_fullscreen_monitor.SelectedIndex = cmb_fullscreen_monitor.Items.IndexOf(session.PrimaryDisplay);
            chk_twitch_mode.Checked              = session.TwitchMode;
            chk_group_ram.Checked                = session.BundleRamMode;
        }