private List <UserSelectedProjectSettings> ReadProjectList(string SettingName, string LegacySettingName)
        {
            List <UserSelectedProjectSettings> Projects = new List <UserSelectedProjectSettings>();

            string[] ProjectStrings = ConfigFile.GetValues(SettingName, null);
            if (ProjectStrings != null)
            {
                foreach (string ProjectString in ProjectStrings)
                {
                    UserSelectedProjectSettings Project;
                    if (UserSelectedProjectSettings.TryParseConfigEntry(ProjectString, out Project))
                    {
                        Projects.Add(Project);
                    }
                }
            }
            else if (LegacySettingName != null)
            {
                string[] LegacyProjectStrings = ConfigFile.GetValues(LegacySettingName, null);
                if (LegacyProjectStrings != null)
                {
                    foreach (string LegacyProjectString in LegacyProjectStrings)
                    {
                        if (!String.IsNullOrWhiteSpace(LegacyProjectString))
                        {
                            Projects.Add(new UserSelectedProjectSettings(null, null, UserSelectedProjectType.Local, null, LegacyProjectString));
                        }
                    }
                }
            }

            return(Projects);
        }
        public UserSettings(string InFileName)
        {
            FileName = InFileName;
            if (File.Exists(FileName))
            {
                ConfigFile.Load(FileName);
            }

            // General settings
            Version                = (UserSettingsVersion)ConfigFile.GetValue("General.Version", (int)UserSettingsVersion.Initial);
            bBuildAfterSync        = (ConfigFile.GetValue("General.BuildAfterSync", "1") != "0");
            bRunAfterSync          = (ConfigFile.GetValue("General.RunAfterSync", "1") != "0");
            bSyncPrecompiledEditor = (ConfigFile.GetValue("General.SyncPrecompiledEditor", "0") != "0");
            bOpenSolutionAfterSync = (ConfigFile.GetValue("General.OpenSolutionAfterSync", "0") != "0");
            bShowLogWindow         = (ConfigFile.GetValue("General.ShowLogWindow", false));
            bAutoResolveConflicts  = (ConfigFile.GetValue("General.AutoResolveConflicts", "1") != "0");
            bUseIncrementalBuilds  = ConfigFile.GetValue("General.IncrementalBuilds", true);
            bShowUnreviewedChanges = ConfigFile.GetValue("General.ShowUnreviewed", true);
            bShowAutomatedChanges  = ConfigFile.GetValue("General.ShowAutomated", false);
            bShowLocalTimes        = ConfigFile.GetValue("General.ShowLocalTimes", false);
            bKeepInTray            = ConfigFile.GetValue("General.KeepInTray", true);
            int.TryParse(ConfigFile.GetValue("General.FilterIndex", "0"), out FilterIndex);

            string LastProjectString = ConfigFile.GetValue("General.LastProject", null);

            if (LastProjectString != null)
            {
                UserSelectedProjectSettings.TryParseConfigEntry(LastProjectString, out LastProject);
            }
            else
            {
                string LastProjectFileName = ConfigFile.GetValue("General.LastProjectFileName", null);
                if (LastProjectFileName != null)
                {
                    LastProject = new UserSelectedProjectSettings(null, null, UserSelectedProjectType.Local, null, LastProjectFileName);
                }
            }

            OpenProjects   = ReadProjectList("General.OpenProjects", "General.OpenProjectFileNames");
            RecentProjects = ReadProjectList("General.RecentProjects", "General.OtherProjectFileNames");

            SyncView = ConfigFile.GetValues("General.SyncFilter", new string[0]);
            SyncExcludedCategories        = ConfigFile.GetGuidValues("General.SyncExcludedCategories", new Guid[0]);
            bSyncAllProjects              = ConfigFile.GetValue("General.SyncAllProjects", false);
            bIncludeAllProjectsInSolution = ConfigFile.GetValue("General.IncludeAllProjectsInSolution", false);
            if (!Enum.TryParse(ConfigFile.GetValue("General.SyncType", ""), out SyncType))
            {
                SyncType = LatestChangeType.Good;
            }

            // Build configuration
            string CompiledEditorBuildConfigName = ConfigFile.GetValue("General.BuildConfig", "");

            if (!Enum.TryParse(CompiledEditorBuildConfigName, true, out CompiledEditorBuildConfig))
            {
                CompiledEditorBuildConfig = BuildConfig.DebugGame;
            }

            // Tab names
            string TabLabelsValue = ConfigFile.GetValue("General.TabLabels", "");

            if (!Enum.TryParse(TabLabelsValue, true, out TabLabels))
            {
                TabLabels = TabLabels.Stream;
            }

            // Editor arguments
            string[] Arguments = ConfigFile.GetValues("General.EditorArguments", new string[] { "0:-log", "0:-fastload" });
            foreach (string Argument in Arguments)
            {
                if (Argument.StartsWith("0:"))
                {
                    EditorArguments.Add(new Tuple <string, bool>(Argument.Substring(2), false));
                }
                else if (Argument.StartsWith("1:"))
                {
                    EditorArguments.Add(new Tuple <string, bool>(Argument.Substring(2), true));
                }
                else
                {
                    EditorArguments.Add(new Tuple <string, bool>(Argument, true));
                }
            }
            bEditorArgumentsPrompt = ConfigFile.GetValue("General.EditorArgumentsPrompt", false);

            // Window settings
            bWindowVisible = ConfigFile.GetValue("Window.Visible", true);
            if (!Enum.TryParse(ConfigFile.GetValue("Window.State", ""), true, out WindowState))
            {
                WindowState = FormWindowState.Normal;
            }
            WindowBounds = ParseRectangleValue(ConfigFile.GetValue("Window.Bounds", ""));

            // Schedule settings
            bScheduleEnabled = ConfigFile.GetValue("Schedule.Enabled", false);
            if (!TimeSpan.TryParse(ConfigFile.GetValue("Schedule.Time", ""), out ScheduleTime))
            {
                ScheduleTime = new TimeSpan(6, 0, 0);
            }
            if (!Enum.TryParse(ConfigFile.GetValue("Schedule.Change", ""), out ScheduleChange))
            {
                ScheduleChange = LatestChangeType.Good;
            }
            ScheduleAnyOpenProject = ConfigFile.GetValue("Schedule.AnyOpenProject", true);
            ScheduleProjects       = ReadProjectList("Schedule.Projects", "Schedule.ProjectFileNames");

            // Notification settings
            NotifyUnassignedMinutes     = ConfigFile.GetValue("Notifications.NotifyUnassignedMinutes", -1);
            NotifyUnacknowledgedMinutes = ConfigFile.GetValue("Notifications.NotifyUnacknowledgedMinutes", -1);
            NotifyUnresolvedMinutes     = ConfigFile.GetValue("Notifications.NotifyUnresolvedMinutes", -1);

            // Perforce settings
            if (!int.TryParse(ConfigFile.GetValue("Perforce.NumRetries", "0"), out SyncOptions.NumRetries))
            {
                SyncOptions.NumRetries = 0;
            }
            if (!int.TryParse(ConfigFile.GetValue("Perforce.NumThreads", "0"), out SyncOptions.NumThreads))
            {
                SyncOptions.NumThreads = 0;
            }
            if (!int.TryParse(ConfigFile.GetValue("Perforce.TcpBufferSize", "0"), out SyncOptions.TcpBufferSize))
            {
                SyncOptions.TcpBufferSize = 0;
            }
        }