Пример #1
0
 /// <summary>
 /// Constructor for cloning instance.
 /// </summary>
 /// <param name="portion">Instance to clone properties from</param>
 public FileNamePortion(FileNamePortion portion)
 {
     this.Type = portion.Type;
     this.Header = portion.Header;
     this.Footer = portion.Footer;
     this.CaseOption = portion.CaseOption;
     this.Whitespace = portion.Whitespace;
 }
Пример #2
0
 /// <summary>
 /// Constructor for cloning instance.
 /// </summary>
 /// <param name="portion">Instance to clone properties from</param>
 public FileNamePortion(FileNamePortion portion)
 {
     this.Type       = portion.Type;
     this.Header     = portion.Header;
     this.Footer     = portion.Footer;
     this.CaseOption = portion.CaseOption;
     this.Whitespace = portion.Whitespace;
 }
Пример #3
0
        /// <summary>
        /// Loads instance properties from XML.
        /// </summary>
        /// <param name="itemNode">Node to load XML from</param>
        /// <returns>true if sucessfully loaded from XML</returns>
        public bool Load(XmlNode fileNameNode)
        {
            // Loop through sub-nodes
            foreach (XmlNode propNode in fileNameNode.ChildNodes)
            {
                // Get element/property type
                XmlElements element;;
                if (!Enum.TryParse <XmlElements>(propNode.Name, out element))
                {
                    continue;
                }

                // Get value string
                string value = propNode.InnerText;

                // Load value into appropriate property
                switch (element)
                {
                case XmlElements.Format:
                    this.Format = new ObservableCollection <FileNamePortion>();
                    foreach (XmlNode formatNode in propNode.ChildNodes)
                    {
                        FileNamePortion portion = new FileNamePortion();
                        portion.Load(formatNode);
                        this.Format.Add(portion);
                    }
                    break;

                case XmlElements.EpisodeFormat:
                    this.EpisodeFormat = new TvEpisodeFormat();
                    this.EpisodeFormat.Load(propNode);
                    break;
                }
            }

            // Success
            return(true);
        }
Пример #4
0
        /// <summary>
        /// Loads instance properties from XML.
        /// </summary>
        /// <param name="itemNode">Node to load XML from</param>
        /// <returns>true if sucessfully loaded from XML</returns>
        public bool Load(XmlNode fileNameNode)
        {
            // Loop through sub-nodes
            foreach (XmlNode propNode in fileNameNode.ChildNodes)
            {
                // Get element/property type
                XmlElements element;;
                if(!Enum.TryParse<XmlElements>(propNode.Name, out element))
                    continue;

                // Get value string
                string value = propNode.InnerText;

                // Load value into appropriate property
                switch (element)
                {
                    case XmlElements.Format:
                        this.Format = new ObservableCollection<FileNamePortion>();
                        foreach(XmlNode formatNode in propNode.ChildNodes)
                        {
                            FileNamePortion portion = new FileNamePortion();
                            portion.Load(formatNode);
                            this.Format.Add(portion);
                        }
                        break;
                    case XmlElements.EpisodeFormat:
                        this.EpisodeFormat = new TvEpisodeFormat();
                        this.EpisodeFormat.Load(propNode);
                        break;
                }
            }

            // Success
            return true;
        }