예제 #1
0
        private void Init()
        {
            var configContent = ConfigHelper.GetTextFromFile(Path.Combine(_rootPath, GroupConfigFileName));

            Name        = ConfigHelper.GetValueRegex("<groupname>(.*)</groupname>", configContent);
            Tag         = ConfigHelper.GetValueRegex("<content>(.*)</content>", configContent);
            Visible     = ConfigHelper.GetValueRegex("<Visible>(.*)</Visible>", configContent) != "false";
            UserGranted = !configContent.ToLower().Contains("approvedusers") ||
                          ConfigHelper.GetValuesRegex("<user>(.*?)</user>", configContent)
                          .Any(user => user.Equals(Environment.UserName, StringComparison.OrdinalIgnoreCase));
            switch (Tag)
            {
            case "shortbutton":
                Type = TabGroupType.ShortButton;
                break;

            case "longbutton":
                Type = TabGroupType.LongButton;
                break;

            case "browsertoggle":
                Type = TabGroupType.BrowserPanel;
                break;

            case "settings":
                Type = TabGroupType.SettingsPanel;
                break;

            default:
                Type = TabGroupType.CustomControls;
                break;
            }
        }
        public static void EcfWrite(this StreamWriter writer, TabGroupType tabGroupType)
        {
            writer.Write($"{{ TabGroup Id: {tabGroupType.Id}\r\n");
            foreach (EcfAttribute attribute in tabGroupType.Attributes.Values)
            {
                writer.EcfWrite(attribute);
            }

            foreach (TabGroupGridType o in tabGroupType.Grids)
            {
                writer.Write($"  {{ Child {o.Name}\r\n");
                foreach (EcfAttribute attribute in o.Attributes.Values)
                {
                    writer.Write("  ");
                    writer.EcfWrite(attribute);
                }
                writer.Write("  }\r\n");
            }
            writer.Write("}\r\n");
        }
예제 #3
0
		private void Init()
		{
			var configContent = ConfigHelper.GetTextFromFile(Path.Combine(_rootPath, GroupConfigFileName));
			Name = ConfigHelper.GetValueRegex("<groupname>(.*)</groupname>", configContent);
			Tag = ConfigHelper.GetValueRegex("<content>(.*)</content>", configContent);
			switch (Tag)
			{
				case "shortbutton":
					Type = TabGroupType.ShortButton;
					break;
				case "longbutton":
					Type = TabGroupType.LongButton;
					break;
				case "browsertoggle":
					Type = TabGroupType.BrowserPanel;
					break;
				case "settings":
					Type = TabGroupType.SettingsPanel;
					break;
				default:
					Type = TabGroupType.CustomControls;
					break;
			}
		}