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);
        }
Esempio n. 2
0
        // 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);
        }