void IVisitorWithContext.Visit(UIOptionSubCategoryType subCategory, object context) { XmlNode subCategoryNode = (XmlNode) context; subCategory.Name = subCategoryNode.Name; subCategory.DisplayText = subCategoryNode.Attributes["DisplayText"].Value; foreach (XmlNode node in subCategoryNode.ChildNodes) { // group nodes can only have one child if the child is just the template default, but the child will not be text // for all other nodes the single child will be text if (node.ChildNodes.Count > 1 || node.ChildNodes.Count == 1 && !(node.FirstChild is XmlText)) // Group Option Type { UIOptionGroupType groupOption = new UIOptionGroupType(); subCategory.Options.Add(groupOption); groupOption.CategoryRef = subCategoryNode.ParentNode.Name; groupOption.SubCategoryRef = subCategoryNode.Name; groupOption.Accept(this, node); } else { UIOptionType option = new UIOptionType(); subCategory.Options.Add(option); option.CategoryRef = subCategoryNode.ParentNode.Name; option.SubCategoryRef = subCategoryNode.Name; option.Accept(this, node); } } }
void IVisitorWithContext.Visit(UIOptionType option, object context) { XmlNode subCategoryNode = (XmlNode) context; XmlNode optionNode = _xmlDoc.CreateNode(XmlNodeType.Element, option.Name, this._namespaceURI); XmlAttribute Deploy = _xmlDoc.CreateAttribute("Deployed"); Deploy.Value = option.Deploy.ToString(); optionNode.Attributes.Append(Deploy); VisitOptionDefType(option, optionNode); subCategoryNode.AppendChild(optionNode); }
void IVisitor.Visit(UIOptionType option) { throw new NotImplementedException(); }
public void Visit(UIOptionType option, object context) { }
void IVisitor.Visit(UIOptionType option) { UpdateOption(option); }
public static IOption CreateShellOption(Category shellSubCategory, UIOptionType option, string defaultValue) { return CreateShellOptionInternal(shellSubCategory, option, defaultValue); }
private bool ShouldOptionBeVisible(UIOptionType option, bool isAdmin) { if (option.RuntimeState || !option.Visible) { return false; } if (isAdmin && option.Private) { return false; } if (isAdmin && option.ReadLocalMachineSpecified && !option.ReadLocalMachine) { return false; } if (!isAdmin && option.ReadCurrentUserSpecified && !option.ReadCurrentUser) { return false; } return true; }
private bool ShouldOptionBeEnabled(UIOptionType option, bool isAdmin) { if (option.ReadOnly) { return false; } return ShouldOptionBeEnabledInternal(isAdmin, option.IsOverrideAllowed); }
private static void AddOptionGroupInstance(Category subCategory) { Dictionary<string, OptionInfo> groupDefs = OptionApi.GetGroupDefinitions(OptionMapper.GetOptionGroupTypeName(subCategory)); var ogi = new OptionGroupInstance { InstanceName = Workshare.Options.Converters.Xml.DefaultXmlReadVisitor.UnsavedInstanceName, Category = subCategory.Parent, SubCategory = subCategory, DataType = typeof (OptionGroupInstance).ToString() }; if (subCategory != null) { ogi.CanChangeOverride = subCategory.Model.AppModel.IsAdmin; ogi.CanChangeDeploy = subCategory.Model.AppModel.IsAdmin; } foreach (OptionInfo option in groupDefs.Values) { UIOptionType op = new UIOptionType { Name = option.Name }; OptionDataTypeEnum dt; if (Enum.TryParse(option.DataType, true, out dt)) { op.DataType = dt; } // TODO: Hardcode passwords to true for now. if ( op.Name == "Password") { op.Encrypted = true; op.EncryptedSpecified = true; op.DataType = OptionDataTypeEnum.String; op.DataTypeSpecified = true; } op.DisplayText = option.DisplayText; op.Text = new[] { string.Empty }; string primaryKey = option.GetAttribute("IsPrimaryKey"); if (!string.IsNullOrEmpty(primaryKey)) op.IsPrimaryKey = Boolean.Parse(primaryKey); if (op.DataType == OptionDataTypeEnum.KeyValueRange) { OptionMapper.SetValueRange(subCategory, ogi, op, true); } IOption opt = OptionMapper.CreateShellOption(subCategory, op, option.DefaultValue); ogi.SubOptions.Add(opt); opt.Parent = ogi; } subCategory.Options.Add(ogi); }
public void Visit(UIOptionType option) { throw new NotImplementedException(); }
void IVisitorWithContext.Visit(UIOptionSubCategoryType subCategory, object context) { XmlNode subCategoryNode = (XmlNode) context; XmlNode categoryNode = subCategoryNode.ParentNode; XmlNode rootNode = categoryNode.ParentNode; subCategory.Name = subCategoryNode.Attributes["ID"].Value; subCategory.DisplayText = subCategoryNode.Attributes["DisplayText"].Value; string xpath = "ws:Option[@SubCategoryRef='" + subCategory.Name + "']"; XmlNamespaceManager nsmgr = new XmlNamespaceManager(rootNode.OwnerDocument.NameTable); nsmgr.AddNamespace("ws", "http://schemas.workshare.com/Workshare.OptionMap.xsd"); XmlNodeList options = rootNode.SelectNodes(xpath, nsmgr); foreach (XmlNode node in options) { UIOptionType option = new UIOptionType(); subCategory.Options.Add(option); option.Accept(this, node); } xpath = "ws:OptionGroupType[@SubCategoryRef='" + subCategory.Name + "']"; options = rootNode.SelectNodes(xpath, nsmgr); foreach (XmlNode node in options) { UIOptionGroupType option = new UIOptionGroupType(); subCategory.Options.Add(option); option.Accept(this, node); } }
void IVisitorWithContext.Visit(UIOptionType option, object context) { XmlNode optionNode = (XmlNode) context; VisitOptionDefType(option, context); XmlAttribute policyScope = optionNode.Attributes["PolicyScope"]; if (policyScope != null) { option.PolicyScope = (PolicyOptionScopeEnum) Enum.Parse(typeof(PolicyOptionScopeEnum), policyScope.Value); option.PolicyScopeSpecified = true; } XmlAttribute isEncrypted = optionNode.Attributes["Encrypted"]; if (isEncrypted != null) { option.Encrypted = Boolean.Parse(isEncrypted.Value); option.EncryptedSpecified = true; } }
void IVisitor.Visit(UIOptionType option) { // Create the option _admFileWriter.StartPolicy(option.DisplayText); _admFileWriter.StartKeyName(Utils.GetOptionKeyName(option.CategoryRef, option.SubCategoryRef, this._osPlatform, this._localRegistryTarget)); string value = String.Concat(option.Text); if (option.Encrypted) { value = Workshare.Interop.Options.OptionApi.GetProcessedString(option.Name, value, _entropy); } _admFileWriter.AddPart(option.DisplayText, option.DataType, option.Name, value, option.ValueRange); _admFileWriter.EndPolicy(); }
void IVisitor.Visit(UIOptionType option) { string value = String.Concat(option.Text); if (option.Encrypted) { value = Workshare.Interop.Options.OptionApi.GetProcessedString(option.Name, value, _entropy); } _regFileWriter.WriteValue(option.Name, value); }