Exemplo n.º 1
0
 public FileTemplate(FileTemplate source)
     : base(source)
 {
     _files         = source._files;
     _version       = source._version;
     _isLoaded      = source._isLoaded;
     _sourceFile    = source._sourceFile;
     _authoring     = source._authoring;
     _assistant     = source._assistant;
     _properties    = source._properties;
     _description   = source._description;
     _configuration = source._configuration;
 }
Exemplo n.º 2
0
 public ProjectTemplate(ProjectTemplate source)
     : base(source)
 {
     _files            = source._files;
     _version          = source._version;
     _isLoaded         = source._isLoaded;
     _sourceFile       = source._sourceFile;
     _authoring        = source._authoring;
     _assistant        = source._assistant;
     _properties       = source._properties;
     _description      = source._description;
     _configuration    = source._configuration;
     _actions          = source._actions;
     _itemGroups       = source._itemGroups;
     _propertyGroups   = source._propertyGroups;
     _targetFrameworks = source._targetFrameworks;
 }
Exemplo n.º 3
0
        /// <summary>
        /// This reads and sets its state or attributes stored in a <c>XML</c> format
        /// with the given reader.
        /// </summary>
        /// <param name="reader">
        /// The reader with which the <c>XML</c> attributes of this object are accessed.
        /// </param>
        /// <exception cref="ArgumentNullException">
        /// If the <paramref name="reader"/> is <see langword="null"/>.
        /// </exception>
        public override void ReadXml(XmlReader reader)
        {
            BuildExceptions.NotNull(reader, "reader");

            Debug.Assert(reader.NodeType == XmlNodeType.Element);
            if (reader.NodeType != XmlNodeType.Element)
            {
                return;
            }

            if (!String.Equals(reader.Name, TagName,
                               StringComparison.OrdinalIgnoreCase))
            {
                return;
            }

            string tempText = reader.GetAttribute("Version");

            if (!String.IsNullOrEmpty(tempText))
            {
                _version = new Version(tempText);
            }
            if (reader.IsEmptyElement)
            {
                return;
            }

            string sourceDir = String.IsNullOrEmpty(_sourceFile) ? String.Empty :
                               Path.GetDirectoryName(_sourceFile);

            while (reader.Read())
            {
                if (reader.NodeType == XmlNodeType.Element)
                {
                    switch (reader.Name)
                    {
                    case "TemplateAuthoring":
                        if (_authoring == null)
                        {
                            _authoring = new TemplateAuthoring();
                        }
                        _authoring.ReadXml(reader);
                        break;

                    case "TemplateConfiguration":
                        if (_configuration == null)
                        {
                            _configuration = new TemplateConfiguration();
                        }
                        _configuration.ReadXml(reader);
                        break;

                    case "TemplateDescription":
                        if (_description == null)
                        {
                            _description = new TemplateDescription();
                        }
                        _description.ReadXml(reader);
                        break;

                    case "TemplateProperty":
                        if (_properties == null)
                        {
                            _properties = new BuildList <TemplateProperty>();
                        }
                        TemplateProperty property = new TemplateProperty();
                        property.ReadXml(reader);
                        if (!property.IsEmpty)
                        {
                            _properties.Add(property);
                        }
                        break;

                    case "TemplateAssistant":
                        if (_assistant == null)
                        {
                            _assistant = new TemplateAssistant();
                        }
                        _assistant.ReadXml(reader);
                        break;

                    case "TemplateFile":
                        if (_files == null)
                        {
                            _files = new BuildList <TemplateFile>();
                        }
                        TemplateFile file = new TemplateFile();
                        if (!String.IsNullOrEmpty(sourceDir))
                        {
                            file.SourceDir = sourceDir;
                        }
                        file.ReadXml(reader);
                        if (!file.IsEmpty)
                        {
                            _files.Add(file);
                        }
                        break;
                    }
                }
                else if (reader.NodeType == XmlNodeType.EndElement)
                {
                    if (String.Equals(reader.Name, TagName, StringComparison.OrdinalIgnoreCase))
                    {
                        break;
                    }
                }
            }
        }