internal DictionaryPropertyDescriptor(IDictionary d, object key) : base(key.ToString(), null) { _dictionary = d; _key = key; _schema = null; }
// Create new configuration item private void miResourceTypeNewConfigurationItem_Click(object sender, EventArgs e) { DscResource parent = (treeLibrary.SelectedNode.Tag as DscResource); DialogText nameDialog = new DialogText(); if (nameDialog.ShowDialog() != DialogResult.OK) { return; } if (_repositoryWorker.Contains(nameDialog.InputResult, parent)) { MessageBoxWorker.SameItemExists(this, Strings.UI_Text_ConfigurationItemC); return; } DscConfigurationItemNode configurationItemNode = _repositoryWorker.NewConfigurationItemNode(nameDialog.InputResult, parent); if (configurationItemNode == null) { return; } treeLibrary.SelectedNode = TreeViewWorker.TreeNodeAdd(configurationItemNode.Name, configurationItemNode, 1, menuConfigurationItem, treeLibrary.SelectedNode); }
public DscConfigurationItemNode GetConfigurationItemNode(string fullname) { string[] path = fullname.Split(':'); DscModule module = Modules.Find(x => x.Name == path[0]); DscResource resource = module.Resources.Find(x => x.FriendlyName == path[1]); return(resource.Nodes.Find(x => x.Name == path[2])); }
public DscConfigurationItemNode(string path, DscResource parent) { FilePath = path; Parent = parent; string fileName = Path.GetFileName(path); if (fileName != null) { Name = fileName.Replace(".json", ""); } ConfigurationItem = DscConfigurationItem.Load(path); }
public DscConfigurationItem(DscResource schema) { foreach (DscResource.Parameter parameter in schema.Parameters) { if (parameter.Qualifier == DscResource.QualifierType.Read) { continue; } object value = null; if (parameter.Type == DscResource.VariableType.String) { value = ""; } Properties.Add(parameter.Name, value); } }
// Create new configuration item public DscConfigurationItemNode NewConfigurationItemNode(string name, DscResource parent) { if (parent == null || string.IsNullOrWhiteSpace(name)) { return(null); } string fileName = Path.Combine(_repository.Dir.Resources, parent.Parent.Name, parent.FriendlyName, name + @".json"); DscConfigurationItem configurationItem = new DscConfigurationItem(parent); configurationItem.Save(fileName); DscConfigurationItemNode configurationItemNode = new DscConfigurationItemNode(fileName, parent); configurationItemNode.Validate(); parent.Nodes.Add(configurationItemNode); return(configurationItemNode); }
public DictionaryPropertyGridAdapter(IDictionary d) { _dictionary = d; _schema = null; }
public DictionaryPropertyGridAdapter(IDictionary d, DscResource s) { _dictionary = d; _schema = s; }
// Check if DSC resource already contains child with provided name public bool Contains(string name, DscResource parent) { return(parent != null && parent.Nodes.Any(x => x.Name == name)); }