public string ToString(ConfigObject BaseObject)
        {
            StringBuilder Result = new StringBuilder();

            Result.Append("(");
            foreach (KeyValuePair <string, string> Pair in Pairs)
            {
                if (BaseObject == null || BaseObject.GetValue(Pair.Key) != Pair.Value)
                {
                    if (Result.Length > 1)
                    {
                        Result.Append(", ");
                    }
                    Result.Append(Pair.Key);
                    Result.Append("=");
                    if (Pair.Value == null)
                    {
                        Result.Append("\"\"");
                    }
                    else
                    {
                        Result.AppendFormat("\"{0}\"", Pair.Value.Replace("\\", "\\\\").Replace("\"", "\\\""));
                    }
                }
            }
            Result.Append(")");
            return(Result.ToString());
        }
        public string ToConfigEntry()
        {
            ConfigObject Object = new ConfigObject();

            if (ServerAndPort != null)
            {
                Object.SetValue("ServerAndPort", ServerAndPort);
            }
            if (UserName != null)
            {
                Object.SetValue("UserName", UserName);
            }

            Object.SetValue("Type", Type.ToString());

            if (ClientPath != null)
            {
                Object.SetValue("ClientPath", ClientPath);
            }
            if (LocalPath != null)
            {
                Object.SetValue("LocalPath", LocalPath);
            }

            return(Object.ToString());
        }
Esempio n. 3
0
            public static bool TryParseConfigEntry(string Text, out ArchiveInfo Info)
            {
                ConfigObject Object = new ConfigObject(Text);

                string Name = Object.GetValue("Name", null);

                if (Name == null)
                {
                    Info = null;
                    return(false);
                }

                string DepotPath = Object.GetValue("DepotPath", null);

                if (DepotPath == null)
                {
                    Info = null;
                    return(false);
                }

                string Target = Object.GetValue("Target", null);

                string Type = Object.GetValue("Type", null) ?? Name;

                Info = new ArchiveInfo(Name, Type, DepotPath, Target);
                return(true);
            }
Esempio n. 4
0
        public ConfigObject ToConfigObject()
        {
            ConfigObject Result = new ConfigObject();

            Result["UniqueId"]          = UniqueId.ToString();
            Result["Description"]       = Description;
            Result["StatusText"]        = StatusText;
            Result["EstimatedDuration"] = EstimatedDuration.ToString();
            Result["Type"] = Type.ToString();
            switch (Type)
            {
            case BuildStepType.Compile:
                Result["Target"]        = Target;
                Result["Platform"]      = Platform;
                Result["Configuration"] = Configuration;
                Result["Arguments"]     = Arguments;
                break;

            case BuildStepType.Cook:
                Result["FileName"] = FileName;
                break;

            case BuildStepType.Other:
                Result["FileName"]      = FileName;
                Result["WorkingDir"]    = WorkingDir;
                Result["Arguments"]     = Arguments;
                Result["bUseLogWindow"] = bUseLogWindow.ToString();
                break;
            }
            Result["OrderIndex"]     = OrderIndex.ToString();
            Result["bNormalSync"]    = bNormalSync.ToString();
            Result["bScheduledSync"] = bScheduledSync.ToString();
            Result["bShowAsTool"]    = bShowAsTool.ToString();
            return(Result);
        }
Esempio n. 5
0
        public ConfigObject ToConfigObject(ConfigObject DefaultObject)
        {
            ConfigObject Result = new ConfigObject();

            Result[UniqueIdKey] = UniqueId.ToString();
            Result.AddOverrides(ToConfigObject(), DefaultObject);
            return((Result.Pairs.Count <= 1)? null : Result);
        }
        public string ToConfigEntry()
        {
            ConfigObject Object = new ConfigObject();

            Object.SetValue("Enabled", bEnabled ? 1 : 0);
            Object.SetValue("Type", Type);
            Object.SetValue("Order", String.Join(";", Order));

            return(Object.ToString());
        }
 public void SetDefaults(ConfigObject Other)
 {
     foreach (KeyValuePair <string, string> Pair in Other.Pairs)
     {
         if (GetValue(Pair.Key) == null)
         {
             SetValue(Pair.Key, Pair.Value);
         }
     }
 }
 public void AddOverrides(ConfigObject Object, ConfigObject DefaultObject)
 {
     foreach (KeyValuePair <string, string> Pair in Object.Pairs)
     {
         if (DefaultObject == null || DefaultObject.GetValue(Pair.Key) != Pair.Value)
         {
             SetValue(Pair.Key, Pair.Value);
         }
     }
 }
        static string FormatRectangleValue(Rectangle Value)
        {
            ConfigObject Object = new ConfigObject();

            Object.SetValue("X", Value.X);
            Object.SetValue("Y", Value.Y);
            Object.SetValue("W", Value.Width);
            Object.SetValue("H", Value.Height);

            return(Object.ToString());
        }
Esempio n. 10
0
        public BuildStep(ConfigObject Object)
        {
            if (!Guid.TryParse(Object.GetValue(UniqueIdKey, ""), out UniqueId))
            {
                UniqueId = Guid.NewGuid();
            }
            if (!Int32.TryParse(Object.GetValue("OrderIndex", ""), out OrderIndex))
            {
                OrderIndex = -1;
            }

            Description = Object.GetValue("Description", "Untitled");
            StatusText  = Object.GetValue("StatusText", "Untitled");

            if (!int.TryParse(Object.GetValue("EstimatedDuration", ""), out EstimatedDuration) || EstimatedDuration < 1)
            {
                EstimatedDuration = 1;
            }

            if (!Enum.TryParse(Object.GetValue("Type", ""), true, out Type))
            {
                Type = BuildStepType.Other;
            }

            Target        = Object.GetValue("Target");
            Platform      = Object.GetValue("Platform");
            Configuration = Object.GetValue("Configuration");
            FileName      = Object.GetValue("FileName");
            WorkingDir    = Object.GetValue("WorkingDir");
            Arguments     = Object.GetValue("Arguments");

            if (!Boolean.TryParse(Object.GetValue("bUseLogWindow", ""), out bUseLogWindow))
            {
                bUseLogWindow = true;
            }
            if (!Boolean.TryParse(Object.GetValue("bNormalSync", ""), out bNormalSync))
            {
                bNormalSync = true;
            }
            if (!Boolean.TryParse(Object.GetValue("bScheduledSync", ""), out bScheduledSync))
            {
                bScheduledSync = bNormalSync;
            }
            if (!Boolean.TryParse(Object.GetValue("bShowAsTool", ""), out bShowAsTool))
            {
                bShowAsTool = false;
            }
        }
        public static bool TryParseConfigEntry(string Text, out UserSelectedProjectSettings Project)
        {
            ConfigObject Object = new ConfigObject(Text);

            UserSelectedProjectType Type;

            if (Enum.TryParse(Object.GetValue("Type", ""), out Type))
            {
                string ServerAndPort = Object.GetValue("ServerAndPort", null);
                if (String.IsNullOrWhiteSpace(ServerAndPort))
                {
                    ServerAndPort = null;
                }

                // Fixup for code that was saving server host name rather than DNS entry
                if (ServerAndPort != null && ServerAndPort.Equals("p4-nodeb.epicgames.net:1666", StringComparison.OrdinalIgnoreCase))
                {
                    ServerAndPort = "perforce:1666";
                }

                string UserName = Object.GetValue("UserName", null);
                if (String.IsNullOrWhiteSpace(UserName))
                {
                    UserName = null;
                }

                string LocalPath = Object.GetValue("LocalPath", null);
                if (String.IsNullOrWhiteSpace(LocalPath))
                {
                    LocalPath = null;
                }

                string ClientPath = Object.GetValue("ClientPath", null);
                if (String.IsNullOrWhiteSpace(ClientPath))
                {
                    ClientPath = null;
                }

                if ((Type == UserSelectedProjectType.Client && ClientPath != null) || (Type == UserSelectedProjectType.Local && LocalPath != null))
                {
                    Project = new UserSelectedProjectSettings(ServerAndPort, UserName, Type, ClientPath, LocalPath);
                    return(true);
                }
            }

            Project = null;
            return(false);
        }
Esempio n. 12
0
		public BuildStep(ConfigObject Object)
		{
			if(!Guid.TryParse(Object.GetValue(UniqueIdKey, ""), out UniqueId))
			{
				UniqueId = Guid.NewGuid();
			}
			if(!Int32.TryParse(Object.GetValue("OrderIndex", ""), out OrderIndex))
			{
				OrderIndex = -1;
			}

			Description = Object.GetValue("Description", "Untitled");
			StatusText = Object.GetValue("StatusText", "Untitled");

			if(!int.TryParse(Object.GetValue("EstimatedDuration", ""), out EstimatedDuration) || EstimatedDuration < 1)
			{
				EstimatedDuration = 1;
			}

			if(!Enum.TryParse(Object.GetValue("Type", ""), true, out Type))
			{
				Type = BuildStepType.Other;
			}

			Target = Object.GetValue("Target");
			Platform = Object.GetValue("Platform");
			Configuration = Object.GetValue("Configuration");
			FileName = Object.GetValue("FileName");
			Arguments = Object.GetValue("Arguments");

			if(!Boolean.TryParse(Object.GetValue("bUseLogWindow", ""), out bUseLogWindow))
			{
				bUseLogWindow = true;
			}
			if(!Boolean.TryParse(Object.GetValue("bNormalSync", ""), out bNormalSync))
			{
				bNormalSync = true;
			}
			if(!Boolean.TryParse(Object.GetValue("bScheduledSync", ""), out bScheduledSync))
			{
				bScheduledSync = bNormalSync;
			}
			if(!Boolean.TryParse(Object.GetValue("bShowAsTool", ""), out bShowAsTool))
			{
				bShowAsTool = false;
			}
		}
        static Rectangle?ParseRectangleValue(string Text)
        {
            ConfigObject Object = new ConfigObject(Text);

            int X = Object.GetValue("X", -1);
            int Y = Object.GetValue("Y", -1);
            int W = Object.GetValue("W", -1);
            int H = Object.GetValue("H", -1);

            if (X == -1 || Y == -1 || W == -1 || H == -1)
            {
                return(null);
            }
            else
            {
                return(new Rectangle(X, Y, W, H));
            }
        }
Esempio n. 14
0
        public static bool TryParseConfigEntry(string Text, out UserSelectedProjectSettings Project)
        {
            ConfigObject Object = new ConfigObject(Text);

            UserSelectedProjectType Type;

            if (Enum.TryParse(Object.GetValue("Type", ""), out Type))
            {
                string ServerAndPort = Object.GetValue("ServerAndPort", null);
                if (String.IsNullOrWhiteSpace(ServerAndPort))
                {
                    ServerAndPort = null;
                }

                string UserName = Object.GetValue("UserName", null);
                if (String.IsNullOrWhiteSpace(UserName))
                {
                    UserName = null;
                }

                string LocalPath = Object.GetValue("LocalPath", null);
                if (String.IsNullOrWhiteSpace(LocalPath))
                {
                    LocalPath = null;
                }

                string ClientPath = Object.GetValue("ClientPath", null);
                if (String.IsNullOrWhiteSpace(ClientPath))
                {
                    ClientPath = null;
                }

                if ((Type == UserSelectedProjectType.Client && ClientPath != null) || (Type == UserSelectedProjectType.Local && LocalPath != null))
                {
                    Project = new UserSelectedProjectSettings(ServerAndPort, UserName, Type, ClientPath, LocalPath);
                    return(true);
                }
            }

            Project = null;
            return(false);
        }
        public static bool TryParseConfigEntry(string Text, out ArchiveSettings Settings)
        {
            ConfigObject Object = new ConfigObject(Text);

            string Type = Object.GetValue("Type", null);

            if (Type == null)
            {
                Settings = null;
                return(false);
            }
            else
            {
                string[] Order    = Object.GetValue("Order", "").Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
                bool     bEnabled = Object.GetValue("Enabled", 0) != 0;

                Settings = new ArchiveSettings(bEnabled, Type, Order);
                return(true);
            }
        }
Esempio n. 16
0
        public SdkInfoWindow(string[] SdkInfoEntries, Dictionary <string, string> Variables, Font BadgeFont)
        {
            InitializeComponent();

            this.BadgeFont = BadgeFont;

            Dictionary <string, ConfigObject> UniqueIdToObject = new Dictionary <string, ConfigObject>(StringComparer.InvariantCultureIgnoreCase);

            foreach (string SdkInfoEntry in SdkInfoEntries)
            {
                ConfigObject Object = new ConfigObject(SdkInfoEntry);

                string UniqueId = Object.GetValue("UniqueId", Guid.NewGuid().ToString());

                ConfigObject ExistingObject;
                if (UniqueIdToObject.TryGetValue(UniqueId, out ExistingObject))
                {
                    ExistingObject.AddOverrides(Object, null);
                }
                else
                {
                    UniqueIdToObject.Add(UniqueId, Object);
                }
            }

            List <SdkItem> Items = new List <SdkItem>();

            foreach (ConfigObject Object in UniqueIdToObject.Values)
            {
                SdkItem Item = new SdkItem();
                Item.Category    = Object.GetValue("Category", "Other");
                Item.Description = Object.GetValue("Description", "");

                Item.Install = Utility.ExpandVariables(Object.GetValue("Install", ""), Variables);
                if (Item.Install.Contains("$("))
                {
                    Item.Install = null;
                }

                Item.Browse = Utility.ExpandVariables(Object.GetValue("Browse", ""), Variables);
                if (Item.Browse.Contains("$("))
                {
                    Item.Browse = null;
                }

                if (!String.IsNullOrEmpty(Item.Install) && String.IsNullOrEmpty(Item.Browse))
                {
                    try
                    {
                        Item.Browse = Path.GetDirectoryName(Item.Install);
                    }
                    catch
                    {
                        Item.Browse = null;
                    }
                }

                Items.Add(Item);
            }

            foreach (IGrouping <string, SdkItem> ItemGroup in Items.GroupBy(x => x.Category).OrderBy(x => x.Key))
            {
                ListViewGroup Group = new ListViewGroup(ItemGroup.Key);
                SdkListView.Groups.Add(Group);

                foreach (SdkItem Item in ItemGroup)
                {
                    ListViewItem NewItem = new ListViewItem(Group);
                    NewItem.SubItems.Add(Item.Description);
                    NewItem.SubItems.Add(new ListViewItem.ListViewSubItem()
                    {
                        Tag = Item
                    });
                    SdkListView.Items.Add(NewItem);
                }
            }

            System.Reflection.PropertyInfo DoubleBufferedProperty = typeof(Control).GetProperty("DoubleBuffered", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance);
            DoubleBufferedProperty.SetValue(SdkListView, true, null);

            if (SdkListView.Items.Count > 0)
            {
                int ItemsHeight = SdkListView.Items[SdkListView.Items.Count - 1].Bounds.Bottom + 20;
                Height = SdkListView.Top + ItemsHeight + (Height - SdkListView.Bottom);
            }
        }
Esempio n. 17
0
		public ConfigObject ToConfigObject()
		{
			ConfigObject Result = new ConfigObject();
			Result["UniqueId"] = UniqueId.ToString();
			Result["Description"] = Description;
			Result["StatusText"] = StatusText;
			Result["EstimatedDuration"] = EstimatedDuration.ToString();
			Result["Type"] = Type.ToString();
			switch(Type)
			{
				case BuildStepType.Compile:
					Result["Target"] = Target;
					Result["Platform"] = Platform;
					Result["Configuration"] = Configuration;
					Result["Arguments"] = Arguments;
					break;
				case BuildStepType.Cook:
					Result["FileName"] = FileName;
					break;
				case BuildStepType.Other:
					Result["FileName"] = FileName;
					Result["Arguments"] = Arguments;
					Result["bUseLogWindow"] = bUseLogWindow.ToString();
					break;
			}
			Result["OrderIndex"] = OrderIndex.ToString();
			Result["bNormalSync"] = bNormalSync.ToString();
			Result["bScheduledSync"] = bScheduledSync.ToString();
			Result["bShowAsTool"] = bShowAsTool.ToString();
			return Result;
		}
 public ConfigObject(ConfigObject Other)
 {
     Pairs = new List <KeyValuePair <string, string> >(Other.Pairs);
 }
Esempio n. 19
0
		public void SetDefaults(ConfigObject Other)
		{
			foreach(KeyValuePair<string, string> Pair in Other.Pairs)
			{
				if(GetValue(Pair.Key) == null)
				{
					SetValue(Pair.Key, Pair.Value);
				}
			}
		}
Esempio n. 20
0
		public ConfigObject ToConfigObject(ConfigObject DefaultObject)
		{
			ConfigObject Result = new ConfigObject();
			Result[UniqueIdKey] = UniqueId.ToString();
			Result.AddOverrides(ToConfigObject(), DefaultObject);
			return (Result.Pairs.Count <= 1)? null : Result;
		}
        public UserWorkspaceSettings FindOrAddWorkspace(string ClientBranchPath)
        {
            // Update the current workspace
            string CurrentWorkspaceKey = ClientBranchPath.Trim('/');

            UserWorkspaceSettings CurrentWorkspace;

            if (!WorkspaceKeyToSettings.TryGetValue(CurrentWorkspaceKey, out CurrentWorkspace))
            {
                // Create a new workspace settings object
                CurrentWorkspace = new UserWorkspaceSettings();
                WorkspaceKeyToSettings.Add(CurrentWorkspaceKey, CurrentWorkspace);

                // Read the workspace settings
                ConfigSection WorkspaceSection = ConfigFile.FindSection(CurrentWorkspaceKey);
                if (WorkspaceSection == null)
                {
                    string LegacyBranchAndClientKey = ClientBranchPath.Trim('/');

                    int SlashIdx = LegacyBranchAndClientKey.IndexOf('/');
                    if (SlashIdx != -1)
                    {
                        LegacyBranchAndClientKey = LegacyBranchAndClientKey.Substring(0, SlashIdx) + "$" + LegacyBranchAndClientKey.Substring(SlashIdx + 1);
                    }

                    string CurrentSync = ConfigFile.GetValue("Clients." + LegacyBranchAndClientKey, null);
                    if (CurrentSync != null)
                    {
                        int AtIdx = CurrentSync.LastIndexOf('@');
                        if (AtIdx != -1)
                        {
                            int ChangeNumber;
                            if (int.TryParse(CurrentSync.Substring(AtIdx + 1), out ChangeNumber))
                            {
                                CurrentWorkspace.CurrentProjectIdentifier = CurrentSync.Substring(0, AtIdx);
                                CurrentWorkspace.CurrentChangeNumber      = ChangeNumber;
                            }
                        }
                    }

                    string LastUpdateResultText = ConfigFile.GetValue("Clients." + LegacyBranchAndClientKey + "$LastUpdate", null);
                    if (LastUpdateResultText != null)
                    {
                        int ColonIdx = LastUpdateResultText.LastIndexOf(':');
                        if (ColonIdx != -1)
                        {
                            int ChangeNumber;
                            if (int.TryParse(LastUpdateResultText.Substring(0, ColonIdx), out ChangeNumber))
                            {
                                WorkspaceUpdateResult Result;
                                if (Enum.TryParse(LastUpdateResultText.Substring(ColonIdx + 1), out Result))
                                {
                                    CurrentWorkspace.LastSyncChangeNumber = ChangeNumber;
                                    CurrentWorkspace.LastSyncResult       = Result;
                                }
                            }
                        }
                    }

                    CurrentWorkspace.SyncView = new string[0];
                    CurrentWorkspace.SyncIncludedCategories        = new Guid[0];
                    CurrentWorkspace.SyncExcludedCategories        = new Guid[0];
                    CurrentWorkspace.bSyncAllProjects              = null;
                    CurrentWorkspace.bIncludeAllProjectsInSolution = null;
                }
                else
                {
                    CurrentWorkspace.CurrentProjectIdentifier = WorkspaceSection.GetValue("CurrentProjectPath");
                    CurrentWorkspace.CurrentChangeNumber      = WorkspaceSection.GetValue("CurrentChangeNumber", -1);
                    CurrentWorkspace.CurrentSyncFilterHash    = WorkspaceSection.GetValue("CurrentSyncFilterHash", null);
                    foreach (string AdditionalChangeNumberString in WorkspaceSection.GetValues("AdditionalChangeNumbers", new string[0]))
                    {
                        int AdditionalChangeNumber;
                        if (int.TryParse(AdditionalChangeNumberString, out AdditionalChangeNumber))
                        {
                            CurrentWorkspace.AdditionalChangeNumbers.Add(AdditionalChangeNumber);
                        }
                    }
                    Enum.TryParse(WorkspaceSection.GetValue("LastSyncResult", ""), out CurrentWorkspace.LastSyncResult);
                    CurrentWorkspace.LastSyncResultMessage = UnescapeText(WorkspaceSection.GetValue("LastSyncResultMessage"));
                    CurrentWorkspace.LastSyncChangeNumber  = WorkspaceSection.GetValue("LastSyncChangeNumber", -1);

                    DateTime LastSyncTime;
                    if (DateTime.TryParse(WorkspaceSection.GetValue("LastSyncTime", ""), out LastSyncTime))
                    {
                        CurrentWorkspace.LastSyncTime = LastSyncTime;
                    }

                    CurrentWorkspace.LastSyncDurationSeconds = WorkspaceSection.GetValue("LastSyncDuration", 0);
                    CurrentWorkspace.LastBuiltChangeNumber   = WorkspaceSection.GetValue("LastBuiltChangeNumber", 0);
                    CurrentWorkspace.ExpandedArchiveTypes    = WorkspaceSection.GetValues("ExpandedArchiveName", new string[0]);

                    CurrentWorkspace.SyncView = WorkspaceSection.GetValues("SyncFilter", new string[0]);
                    CurrentWorkspace.SyncIncludedCategories = WorkspaceSection.GetValues("SyncIncludedCategories", new Guid[0]);
                    CurrentWorkspace.SyncExcludedCategories = WorkspaceSection.GetValues("SyncExcludedCategories", new Guid[0]);

                    int SyncAllProjects = WorkspaceSection.GetValue("SyncAllProjects", -1);
                    CurrentWorkspace.bSyncAllProjects = (SyncAllProjects == 0)? (bool?)false : (SyncAllProjects == 1)? (bool?)true : (bool?)null;

                    int IncludeAllProjectsInSolution = WorkspaceSection.GetValue("IncludeAllProjectsInSolution", -1);
                    CurrentWorkspace.bIncludeAllProjectsInSolution = (IncludeAllProjectsInSolution == 0)? (bool?)false : (IncludeAllProjectsInSolution == 1)? (bool?)true : (bool?)null;

                    string[] BisectEntries = WorkspaceSection.GetValues("Bisect", new string[0]);
                    foreach (string BisectEntry in BisectEntries)
                    {
                        ConfigObject BisectEntryObject = new ConfigObject(BisectEntry);

                        int ChangeNumber = BisectEntryObject.GetValue("Change", -1);
                        if (ChangeNumber != -1)
                        {
                            BisectState State;
                            if (Enum.TryParse(BisectEntryObject.GetValue("State", ""), out State))
                            {
                                CurrentWorkspace.ChangeNumberToBisectState[ChangeNumber] = State;
                            }
                        }
                    }
                }
            }
            return(CurrentWorkspace);
        }
        public void Save()
        {
            // General settings
            ConfigSection GeneralSection = ConfigFile.FindOrAddSection("General");

            GeneralSection.Clear();
            GeneralSection.SetValue("Version", (int)Version);
            GeneralSection.SetValue("BuildAfterSync", bBuildAfterSync);
            GeneralSection.SetValue("RunAfterSync", bRunAfterSync);
            GeneralSection.SetValue("SyncPrecompiledEditor", bSyncPrecompiledEditor);
            GeneralSection.SetValue("OpenSolutionAfterSync", bOpenSolutionAfterSync);
            GeneralSection.SetValue("ShowLogWindow", bShowLogWindow);
            GeneralSection.SetValue("AutoResolveConflicts", bAutoResolveConflicts);
            GeneralSection.SetValue("IncrementalBuilds", bUseIncrementalBuilds);
            GeneralSection.SetValue("ShowUnreviewed", bShowUnreviewedChanges);
            GeneralSection.SetValue("ShowAutomated", bShowAutomatedChanges);
            GeneralSection.SetValue("ShowLocalTimes", bShowLocalTimes);
            if (LastProject != null)
            {
                GeneralSection.SetValue("LastProject", LastProject.ToConfigEntry());
            }
            GeneralSection.SetValues("OpenProjects", OpenProjects.Select(x => x.ToConfigEntry()).ToArray());
            GeneralSection.SetValue("KeepInTray", bKeepInTray);
            GeneralSection.SetValue("FilterIndex", FilterIndex);
            GeneralSection.SetValues("RecentProjects", RecentProjects.Select(x => x.ToConfigEntry()).ToArray());
            GeneralSection.SetValues("SyncFilter", SyncView);
            GeneralSection.SetValues("SyncExcludedCategories", SyncExcludedCategories);
            GeneralSection.SetValue("SyncAllProjects", bSyncAllProjects);
            GeneralSection.SetValue("IncludeAllProjectsInSolution", bIncludeAllProjectsInSolution);
            GeneralSection.SetValue("SyncType", SyncType.ToString());

            // Build configuration
            GeneralSection.SetValue("BuildConfig", CompiledEditorBuildConfig.ToString());

            // Tab labels
            GeneralSection.SetValue("TabLabels", TabLabels.ToString());

            // Editor arguments
            List <string> EditorArgumentList = new List <string>();

            foreach (Tuple <string, bool> EditorArgument in EditorArguments)
            {
                EditorArgumentList.Add(String.Format("{0}:{1}", EditorArgument.Item2? 1 : 0, EditorArgument.Item1));
            }
            GeneralSection.SetValues("EditorArguments", EditorArgumentList.ToArray());
            GeneralSection.SetValue("EditorArgumentsPrompt", bEditorArgumentsPrompt);

            // Schedule settings
            ConfigSection ScheduleSection = ConfigFile.FindOrAddSection("Schedule");

            ScheduleSection.Clear();
            ScheduleSection.SetValue("Enabled", bScheduleEnabled);
            ScheduleSection.SetValue("Time", ScheduleTime.ToString());
            ScheduleSection.SetValue("Change", ScheduleChange.ToString());
            ScheduleSection.SetValue("AnyOpenProject", ScheduleAnyOpenProject);
            ScheduleSection.SetValues("Projects", ScheduleProjects.Select(x => x.ToConfigEntry()).ToArray());

            // Window settings
            ConfigSection WindowSection = ConfigFile.FindOrAddSection("Window");

            WindowSection.Clear();
            WindowSection.SetValue("Visible", bWindowVisible);
            WindowSection.SetValue("State", WindowState.ToString());
            if (WindowBounds != null)
            {
                WindowSection.SetValue("Bounds", FormatRectangleValue(WindowBounds.Value));
            }

            // Notification settings
            ConfigSection NotificationSection = ConfigFile.FindOrAddSection("Notifications");

            NotificationSection.Clear();
            if (NotifyUnassignedMinutes != -1)
            {
                NotificationSection.SetValue("NotifyUnassignedMinutes", NotifyUnassignedMinutes);
            }
            if (NotifyUnacknowledgedMinutes != -1)
            {
                NotificationSection.SetValue("NotifyUnacknowledgedMinutes", NotifyUnacknowledgedMinutes);
            }
            if (NotifyUnresolvedMinutes != -1)
            {
                NotificationSection.SetValue("NotifyUnresolvedMinutes", NotifyUnresolvedMinutes);
            }

            // Current workspace settings
            foreach (KeyValuePair <string, UserWorkspaceSettings> Pair in WorkspaceKeyToSettings)
            {
                string CurrentWorkspaceKey             = Pair.Key;
                UserWorkspaceSettings CurrentWorkspace = Pair.Value;

                ConfigSection WorkspaceSection = ConfigFile.FindOrAddSection(CurrentWorkspaceKey);
                WorkspaceSection.Clear();
                WorkspaceSection.SetValue("CurrentProjectPath", CurrentWorkspace.CurrentProjectIdentifier);
                WorkspaceSection.SetValue("CurrentChangeNumber", CurrentWorkspace.CurrentChangeNumber);
                if (CurrentWorkspace.CurrentSyncFilterHash != null)
                {
                    WorkspaceSection.SetValue("CurrentSyncFilterHash", CurrentWorkspace.CurrentSyncFilterHash);
                }
                WorkspaceSection.SetValues("AdditionalChangeNumbers", CurrentWorkspace.AdditionalChangeNumbers.Select(x => x.ToString()).ToArray());
                WorkspaceSection.SetValue("LastSyncResult", CurrentWorkspace.LastSyncResult.ToString());
                WorkspaceSection.SetValue("LastSyncResultMessage", EscapeText(CurrentWorkspace.LastSyncResultMessage));
                WorkspaceSection.SetValue("LastSyncChangeNumber", CurrentWorkspace.LastSyncChangeNumber);
                if (CurrentWorkspace.LastSyncTime.HasValue)
                {
                    WorkspaceSection.SetValue("LastSyncTime", CurrentWorkspace.LastSyncTime.ToString());
                }
                if (CurrentWorkspace.LastSyncDurationSeconds > 0)
                {
                    WorkspaceSection.SetValue("LastSyncDuration", CurrentWorkspace.LastSyncDurationSeconds);
                }
                WorkspaceSection.SetValue("LastBuiltChangeNumber", CurrentWorkspace.LastBuiltChangeNumber);
                WorkspaceSection.SetValues("ExpandedArchiveName", CurrentWorkspace.ExpandedArchiveTypes);
                WorkspaceSection.SetValues("SyncFilter", CurrentWorkspace.SyncView);
                WorkspaceSection.SetValues("SyncIncludedCategories", CurrentWorkspace.SyncIncludedCategories);
                WorkspaceSection.SetValues("SyncExcludedCategories", CurrentWorkspace.SyncExcludedCategories);
                if (CurrentWorkspace.bSyncAllProjects.HasValue)
                {
                    WorkspaceSection.SetValue("SyncAllProjects", CurrentWorkspace.bSyncAllProjects.Value);
                }
                if (CurrentWorkspace.bIncludeAllProjectsInSolution.HasValue)
                {
                    WorkspaceSection.SetValue("IncludeAllProjectsInSolution", CurrentWorkspace.bIncludeAllProjectsInSolution.Value);
                }

                List <ConfigObject> BisectEntryObjects = new List <ConfigObject>();
                foreach (KeyValuePair <int, BisectState> BisectPair in CurrentWorkspace.ChangeNumberToBisectState)
                {
                    ConfigObject BisectEntryObject = new ConfigObject();
                    BisectEntryObject.SetValue("Change", BisectPair.Key);
                    BisectEntryObject.SetValue("State", BisectPair.Value.ToString());
                    BisectEntryObjects.Add(BisectEntryObject);
                }
                WorkspaceSection.SetValues("Bisect", BisectEntryObjects.Select(x => x.ToString()).ToArray());
            }

            // Current project settings
            foreach (KeyValuePair <string, UserProjectSettings> Pair in ProjectKeyToSettings)
            {
                string CurrentProjectKey           = Pair.Key;
                UserProjectSettings CurrentProject = Pair.Value;

                ConfigSection ProjectSection = ConfigFile.FindOrAddSection(CurrentProjectKey);
                ProjectSection.Clear();
                ProjectSection.SetValues("BuildStep", CurrentProject.BuildSteps.Select(x => x.ToString()).ToArray());
                if (CurrentProject.FilterType != FilterType.None)
                {
                    ProjectSection.SetValue("FilterType", CurrentProject.FilterType.ToString());
                }
                ProjectSection.SetValues("FilterBadges", CurrentProject.FilterBadges.ToArray());
            }

            // Perforce settings
            ConfigSection PerforceSection = ConfigFile.FindOrAddSection("Perforce");

            PerforceSection.Clear();
            if (SyncOptions.NumRetries > 0)
            {
                PerforceSection.SetValue("NumRetries", SyncOptions.NumRetries);
            }
            if (SyncOptions.NumThreads > 0)
            {
                PerforceSection.SetValue("NumThreads", SyncOptions.NumThreads);
            }
            if (SyncOptions.TcpBufferSize > 0)
            {
                PerforceSection.SetValue("TcpBufferSize", SyncOptions.TcpBufferSize);
            }

            // Save the file
            ConfigFile.Save(FileName);
        }
        public void Save()
        {
            // General settings
            ConfigSection GeneralSection = ConfigFile.FindOrAddSection("General");

            GeneralSection.Clear();
            GeneralSection.SetValue("BuildAfterSync", bBuildAfterSync);
            GeneralSection.SetValue("RunAfterSync", bRunAfterSync);
            GeneralSection.SetValue("SyncPrecompiledEditor", bSyncPrecompiledEditor);
            GeneralSection.SetValue("OpenSolutionAfterSync", bOpenSolutionAfterSync);
            GeneralSection.SetValue("ShowLogWindow", bShowLogWindow);
            GeneralSection.SetValue("AutoResolveConflicts", bAutoResolveConflicts);
            GeneralSection.SetValue("IncrementalBuilds", bUseIncrementalBuilds);
            GeneralSection.SetValue("ShowLocalTimes", bShowLocalTimes);
            GeneralSection.SetValue("ShowAllStreams", bShowAllStreams);
            GeneralSection.SetValue("LastProjectFileName", LastProjectFileName);
            GeneralSection.SetValues("OpenProjectFileNames", OpenProjectFileNames);
            GeneralSection.SetValue("KeepInTray", bKeepInTray);
            GeneralSection.SetValue("FilterIndex", FilterIndex);
            GeneralSection.SetValues("OtherProjectFileNames", OtherProjectFileNames);
            GeneralSection.SetValues("SyncFilter", SyncView);
            GeneralSection.SetValues("SyncExcludedCategories", SyncExcludedCategories);
            GeneralSection.SetValue("SyncType", SyncType.ToString());

            // Build configuration
            GeneralSection.SetValue("BuildConfig", CompiledEditorBuildConfig.ToString());

            // Tab names
            GeneralSection.SetValue("TabNames", TabLabels.ToString());

            // Editor arguments
            List <string> EditorArgumentList = new List <string>();

            foreach (Tuple <string, bool> EditorArgument in EditorArguments)
            {
                EditorArgumentList.Add(String.Format("{0}:{1}", EditorArgument.Item2? 1 : 0, EditorArgument.Item1));
            }
            GeneralSection.SetValues("EditorArguments", EditorArgumentList.ToArray());

            // Schedule settings
            ConfigSection ScheduleSection = ConfigFile.FindOrAddSection("Schedule");

            ScheduleSection.Clear();
            ScheduleSection.SetValue("Enabled", bScheduleEnabled);
            ScheduleSection.SetValue("Time", ScheduleTime.ToString());
            ScheduleSection.SetValue("Change", ScheduleChange.ToString());

            // Window settings
            if (bHasWindowSettings)
            {
                ConfigSection WindowSection = ConfigFile.FindOrAddSection("Window");
                WindowSection.Clear();
                WindowSection.SetValue("X", WindowRectangle.X);
                WindowSection.SetValue("Y", WindowRectangle.Y);
                WindowSection.SetValue("Width", WindowRectangle.Width);
                WindowSection.SetValue("Height", WindowRectangle.Height);

                ConfigObject ColumnWidthsObject = new ConfigObject();
                foreach (KeyValuePair <string, int> ColumnWidthPair in ColumnWidths)
                {
                    ColumnWidthsObject.SetValue(ColumnWidthPair.Key, ColumnWidthPair.Value.ToString());
                }
                WindowSection.SetValue("ColumnWidths", ColumnWidthsObject.ToString());

                WindowSection.SetValue("Visible", bWindowVisible);
            }

            // Current workspace settings
            foreach (KeyValuePair <string, UserWorkspaceSettings> Pair in WorkspaceKeyToSettings)
            {
                string CurrentWorkspaceKey             = Pair.Key;
                UserWorkspaceSettings CurrentWorkspace = Pair.Value;

                ConfigSection WorkspaceSection = ConfigFile.FindOrAddSection(CurrentWorkspaceKey);
                WorkspaceSection.Clear();
                WorkspaceSection.SetValue("CurrentProjectPath", CurrentWorkspace.CurrentProjectIdentifier);
                WorkspaceSection.SetValue("CurrentChangeNumber", CurrentWorkspace.CurrentChangeNumber);
                WorkspaceSection.SetValues("AdditionalChangeNumbers", CurrentWorkspace.AdditionalChangeNumbers.Select(x => x.ToString()).ToArray());
                WorkspaceSection.SetValue("LastSyncResult", CurrentWorkspace.LastSyncResult.ToString());
                WorkspaceSection.SetValue("LastSyncResultMessage", EscapeText(CurrentWorkspace.LastSyncResultMessage));
                WorkspaceSection.SetValue("LastSyncChangeNumber", CurrentWorkspace.LastSyncChangeNumber);
                if (CurrentWorkspace.LastSyncTime.HasValue)
                {
                    WorkspaceSection.SetValue("LastSyncTime", CurrentWorkspace.LastSyncTime.ToString());
                }
                if (CurrentWorkspace.LastSyncDurationSeconds > 0)
                {
                    WorkspaceSection.SetValue("LastSyncDuration", CurrentWorkspace.LastSyncDurationSeconds);
                }
                WorkspaceSection.SetValue("LastBuiltChangeNumber", CurrentWorkspace.LastBuiltChangeNumber);
                WorkspaceSection.SetValues("ExpandedArchiveName", CurrentWorkspace.ExpandedArchiveTypes);
                WorkspaceSection.SetValues("SyncFilter", CurrentWorkspace.SyncView);
                WorkspaceSection.SetValues("SyncExcludedCategories", CurrentWorkspace.SyncExcludedCategories);
            }

            // Current project settings
            foreach (KeyValuePair <string, UserProjectSettings> Pair in ProjectKeyToSettings)
            {
                string CurrentProjectKey           = Pair.Key;
                UserProjectSettings CurrentProject = Pair.Value;

                ConfigSection ProjectSection = ConfigFile.FindOrAddSection(CurrentProjectKey);
                ProjectSection.Clear();
                ProjectSection.SetValues("BuildStep", CurrentProject.BuildSteps.Select(x => x.ToString()).ToArray());
            }

            // Perforce settings
            ConfigSection PerforceSection = ConfigFile.FindOrAddSection("Perforce");

            PerforceSection.Clear();
            if (SyncOptions.NumRetries > 0)
            {
                PerforceSection.SetValue("NumRetries", SyncOptions.NumRetries);
            }
            if (SyncOptions.NumThreads > 0)
            {
                PerforceSection.SetValue("NumThreads", SyncOptions.NumThreads);
            }
            if (SyncOptions.TcpBufferSize > 0)
            {
                PerforceSection.SetValue("TcpBufferSize", SyncOptions.TcpBufferSize);
            }

            // Save the file
            ConfigFile.Save(FileName);
        }
Esempio n. 24
0
		public void AddOverrides(ConfigObject Object, ConfigObject DefaultObject)
		{
			foreach(KeyValuePair<string, string> Pair in Object.Pairs)
			{
				if(DefaultObject == null || DefaultObject.GetValue(Pair.Key) != Pair.Value)
				{
					SetValue(Pair.Key, Pair.Value);
				}
			}
		}
 public ConfigObject(ConfigObject BaseObject, string Text)
 {
     Pairs = new List <KeyValuePair <string, string> >(BaseObject.Pairs);
     ParseConfigString(Text);
 }
Esempio n. 26
0
		public UserSettings(string InFileName)
		{
			FileName = InFileName;
			if(File.Exists(FileName))
			{
				ConfigFile.Load(FileName);
			}

			// General settings
			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);
			bShowLocalTimes = ConfigFile.GetValue("General.ShowLocalTimes", false);
			bKeepInTray = ConfigFile.GetValue("General.KeepInTray", true);
			LastProjectFileName = ConfigFile.GetValue("General.LastProjectFileName", null);
			OtherProjectFileNames = ConfigFile.GetValues("General.OtherProjectFileNames", new string[0]);
			SyncFilter = ConfigFile.GetValues("General.SyncFilter", new string[0]);
			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;
			}

			// 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));
				}
			}

			// Window settings
			ConfigSection WindowSection = ConfigFile.FindSection("Window");
			if(WindowSection != null)
			{
				bHasWindowSettings = true;

				int X = WindowSection.GetValue("X", -1);
				int Y = WindowSection.GetValue("Y", -1);
				int Width = WindowSection.GetValue("Width", -1);
				int Height = WindowSection.GetValue("Height", -1);
				WindowRectangle = new Rectangle(X, Y, Width, Height);

				ConfigObject ColumnWidthObject = new ConfigObject(WindowSection.GetValue("ColumnWidths", ""));
				foreach(KeyValuePair<string, string> ColumnWidthPair in ColumnWidthObject.Pairs)
				{
					int Value;
					if(int.TryParse(ColumnWidthPair.Value, out Value))
					{
						ColumnWidths[ColumnWidthPair.Key] = Value;
					}
				}

				bWindowVisible = WindowSection.GetValue("Visible", true);
			}

			// 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;
			}
		}
Esempio n. 27
0
		public void Save()
		{
			// General settings
			ConfigSection GeneralSection = ConfigFile.FindOrAddSection("General");
			GeneralSection.Clear();
			GeneralSection.SetValue("BuildAfterSync", bBuildAfterSync);
			GeneralSection.SetValue("RunAfterSync", bRunAfterSync);
			GeneralSection.SetValue("SyncPrecompiledEditor", bSyncPrecompiledEditor);
			GeneralSection.SetValue("OpenSolutionAfterSync", bOpenSolutionAfterSync);
			GeneralSection.SetValue("ShowLogWindow", bShowLogWindow);
			GeneralSection.SetValue("AutoResolveConflicts", bAutoResolveConflicts);
			GeneralSection.SetValue("IncrementalBuilds", bUseIncrementalBuilds);
			GeneralSection.SetValue("ShowLocalTimes", bShowLocalTimes);
			GeneralSection.SetValue("LastProjectFileName", LastProjectFileName);
			GeneralSection.SetValue("KeepInTray", bKeepInTray);
			GeneralSection.SetValues("OtherProjectFileNames", OtherProjectFileNames);
			GeneralSection.SetValues("SyncFilter", SyncFilter);
			GeneralSection.SetValue("SyncType", SyncType.ToString());

			// Build configuration
			GeneralSection.SetValue("BuildConfig", CompiledEditorBuildConfig.ToString());

			// Editor arguments
			List<string> EditorArgumentList = new List<string>();
			foreach(Tuple<string, bool> EditorArgument in EditorArguments)
			{
				EditorArgumentList.Add(String.Format("{0}:{1}", EditorArgument.Item2? 1 : 0, EditorArgument.Item1));
			}
			GeneralSection.SetValues("EditorArguments", EditorArgumentList.ToArray());

			// Schedule settings
			ConfigSection ScheduleSection = ConfigFile.FindOrAddSection("Schedule");
			ScheduleSection.Clear();
			ScheduleSection.SetValue("Enabled", bScheduleEnabled);
			ScheduleSection.SetValue("Time", ScheduleTime.ToString());
			ScheduleSection.SetValue("Change", ScheduleChange.ToString());

			// Window settings
			if(bHasWindowSettings)
			{
				ConfigSection WindowSection = ConfigFile.FindOrAddSection("Window");
				WindowSection.Clear();
				WindowSection.SetValue("X", WindowRectangle.X);
				WindowSection.SetValue("Y", WindowRectangle.Y);
				WindowSection.SetValue("Width", WindowRectangle.Width);
				WindowSection.SetValue("Height", WindowRectangle.Height);

				ConfigObject ColumnWidthsObject = new ConfigObject();
				foreach(KeyValuePair<string, int> ColumnWidthPair in ColumnWidths)
				{
					ColumnWidthsObject.SetValue(ColumnWidthPair.Key, ColumnWidthPair.Value.ToString());
				}
				WindowSection.SetValue("ColumnWidths", ColumnWidthsObject.ToString());

				WindowSection.SetValue("Visible", bWindowVisible);
			}

			// Current workspace settings
			if(CurrentWorkspace != null)
			{
				ConfigSection WorkspaceSection = ConfigFile.FindOrAddSection(CurrentWorkspaceKey);
				WorkspaceSection.Clear();
				WorkspaceSection.SetValue("CurrentProjectPath", CurrentWorkspace.CurrentProjectIdentifier);
				WorkspaceSection.SetValue("CurrentChangeNumber", CurrentWorkspace.CurrentChangeNumber);
				WorkspaceSection.SetValues("AdditionalChangeNumbers", CurrentWorkspace.AdditionalChangeNumbers.Select(x => x.ToString()).ToArray());
				WorkspaceSection.SetValue("LastSyncResult", CurrentWorkspace.LastSyncResult.ToString());
				WorkspaceSection.SetValue("LastSyncResultMessage", EscapeText(CurrentWorkspace.LastSyncResultMessage));
				WorkspaceSection.SetValue("LastSyncChangeNumber", CurrentWorkspace.LastSyncChangeNumber);
				if(CurrentWorkspace.LastSyncTime.HasValue)
				{
					WorkspaceSection.SetValue("LastSyncTime", CurrentWorkspace.LastSyncTime.ToString());
				}
				if(CurrentWorkspace.LastSyncDurationSeconds > 0)
				{
					WorkspaceSection.SetValue("LastSyncDuration", CurrentWorkspace.LastSyncDurationSeconds);
				}
				WorkspaceSection.SetValue("LastBuiltChangeNumber", CurrentWorkspace.LastBuiltChangeNumber);
				WorkspaceSection.SetValues("ExpandedArchiveName", CurrentWorkspace.ExpandedArchiveTypes);
			}

			// Current project settings
			if(CurrentProject != null)
			{
				ConfigSection ProjectSection = ConfigFile.FindOrAddSection(CurrentProjectKey);
				ProjectSection.Clear();
				ProjectSection.SetValues("BuildStep", CurrentProject.BuildSteps.Select(x => x.ToString()).ToArray());
			}

			// Save the file
			ConfigFile.Save(FileName);
		}
Esempio n. 28
0
		public string ToString(ConfigObject BaseObject)
		{
			StringBuilder Result = new StringBuilder();
			Result.Append("(");
			foreach(KeyValuePair<string, string> Pair in Pairs)
			{
				if(BaseObject == null || BaseObject.GetValue(Pair.Key) != Pair.Value)
				{
					if(Result.Length > 1)
					{
						Result.Append(", ");
					}
					Result.Append(Pair.Key);
					Result.Append("=");
					if(Pair.Value == null)
					{
						Result.Append("\"\"");
					}
					else
					{
						Result.AppendFormat("\"{0}\"", Pair.Value.Replace("\\", "\\\\").Replace("\"", "\\\""));
					}
				}
			}
			Result.Append(")");
			return Result.ToString();
		}
Esempio n. 29
0
        public UserSettings(string InFileName)
        {
            FileName = InFileName;
            if (File.Exists(FileName))
            {
                ConfigFile.Load(FileName);
            }

            // General settings
            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);
            bShowLocalTimes        = ConfigFile.GetValue("General.ShowLocalTimes", false);
            bKeepInTray            = ConfigFile.GetValue("General.KeepInTray", true);
            LastProjectFileName    = ConfigFile.GetValue("General.LastProjectFileName", null);
            OtherProjectFileNames  = ConfigFile.GetValues("General.OtherProjectFileNames", new string[0]);
            SyncFilter             = ConfigFile.GetValues("General.SyncFilter", new string[0]);
            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;
            }

            // 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));
                }
            }

            // Window settings
            ConfigSection WindowSection = ConfigFile.FindSection("Window");

            if (WindowSection != null)
            {
                bHasWindowSettings = true;

                int X      = WindowSection.GetValue("X", -1);
                int Y      = WindowSection.GetValue("Y", -1);
                int Width  = WindowSection.GetValue("Width", -1);
                int Height = WindowSection.GetValue("Height", -1);
                WindowRectangle = new Rectangle(X, Y, Width, Height);

                ConfigObject ColumnWidthObject = new ConfigObject(WindowSection.GetValue("ColumnWidths", ""));
                foreach (KeyValuePair <string, string> ColumnWidthPair in ColumnWidthObject.Pairs)
                {
                    int Value;
                    if (int.TryParse(ColumnWidthPair.Value, out Value))
                    {
                        ColumnWidths[ColumnWidthPair.Key] = Value;
                    }
                }

                bWindowVisible = WindowSection.GetValue("Visible", true);
            }

            // 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;
            }
        }
Esempio n. 30
0
		public ConfigObject(ConfigObject Other)
		{
			Pairs = new List<KeyValuePair<string,string>>(Other.Pairs);
		}
        public UserSettings(string InFileName)
        {
            FileName = InFileName;
            if (File.Exists(FileName))
            {
                ConfigFile.Load(FileName);
            }

            // General settings
            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);
            bShowLocalTimes        = ConfigFile.GetValue("General.ShowLocalTimes", false);
            bShowAllStreams        = ConfigFile.GetValue("General.ShowAllStreams", false);
            bKeepInTray            = ConfigFile.GetValue("General.KeepInTray", true);
            int.TryParse(ConfigFile.GetValue("General.FilterIndex", "0"), out FilterIndex);
            LastProjectFileName = ConfigFile.GetValue("General.LastProjectFileName", null);

            OpenProjectFileNames = ConfigFile.GetValues("General.OpenProjectFileNames", new string[0]);
            if (LastProjectFileName != null && !OpenProjectFileNames.Any(x => x.Equals(LastProjectFileName, StringComparison.InvariantCultureIgnoreCase)))
            {
                OpenProjectFileNames = OpenProjectFileNames.Concat(new string[] { LastProjectFileName }).ToArray();
            }

            OtherProjectFileNames = ConfigFile.GetValues("General.OtherProjectFileNames", new string[0]);
            SyncView = ConfigFile.GetValues("General.SyncFilter", new string[0]);
            SyncExcludedCategories = ConfigFile.GetGuidValues("General.SyncExcludedCategories", new Guid[0]);
            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 TabNamesValue = ConfigFile.GetValue("General.TabNames", "");

            if (!Enum.TryParse(TabNamesValue, true, out TabLabels))
            {
                TabLabels = TabLabels.ProjectFile;
            }

            // 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));
                }
            }

            // Window settings
            ConfigSection WindowSection = ConfigFile.FindSection("Window");

            if (WindowSection != null)
            {
                bHasWindowSettings = true;

                int X      = WindowSection.GetValue("X", -1);
                int Y      = WindowSection.GetValue("Y", -1);
                int Width  = WindowSection.GetValue("Width", -1);
                int Height = WindowSection.GetValue("Height", -1);
                WindowRectangle = new Rectangle(X, Y, Width, Height);

                ConfigObject ColumnWidthObject = new ConfigObject(WindowSection.GetValue("ColumnWidths", ""));
                foreach (KeyValuePair <string, string> ColumnWidthPair in ColumnWidthObject.Pairs)
                {
                    int Value;
                    if (int.TryParse(ColumnWidthPair.Value, out Value))
                    {
                        ColumnWidths[ColumnWidthPair.Key] = Value;
                    }
                }

                bWindowVisible = WindowSection.GetValue("Visible", true);
            }

            // 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;
            }

            // 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;
            }
        }
Esempio n. 32
0
		public ConfigObject(ConfigObject BaseObject, string Text)
		{
			Pairs = new List<KeyValuePair<string,string>>(BaseObject.Pairs);
			ParseConfigString(Text);
		}
Esempio n. 33
0
		private void AddOrUpdateBuildStep(Dictionary<Guid, ConfigObject> Steps, ConfigObject Object)
		{
			Guid UniqueId;
			if(Guid.TryParse(Object.GetValue(BuildStep.UniqueIdKey, ""), out UniqueId))
			{
				ConfigObject DefaultObject;
				if(Steps.TryGetValue(UniqueId, out DefaultObject))
				{
					Object.SetDefaults(DefaultObject);
				}
				Steps[UniqueId] = Object;
			}
		}