예제 #1
0
        /// <summary>
        /// Determines whether the specified <see cref="T:System.Object"/> is equal to the current <see cref="T:System.Object"/>.
        /// </summary>
        /// <param name="obj">The <see cref="T:System.Object"/> to compare with the current <see cref="T:System.Object"/>.</param>
        /// <returns>
        /// true if the specified <see cref="T:System.Object"/> is equal to the current <see cref="T:System.Object"/>; otherwise, false.
        /// </returns>
        /// <exception cref="T:System.NullReferenceException">
        /// The <paramref name="obj"/> parameter is null.
        /// </exception>
        public override bool Equals(object obj)
        {
            SnippetInfoCollection target = obj as SnippetInfoCollection;

            if (target == null)
            {
                return(false);
            }

            if (
                (_snippetInfos != null && target._snippetInfos == null) ||
                (_snippetInfos == null && target._snippetInfos != null)
                )
            {
                return(false);
            }

            if (_snippetInfos.Count != target._snippetInfos.Count)
            {
                return(false);
            }

            for (int i = 0; i < _snippetInfos.Count; i++)
            {
                if (!_snippetInfos[i].Equals(_snippetInfos[i]))
                {
                    return(false);
                }
            }

            return(true);
        }
예제 #2
0
        public MultiPageAssemblyInstruction()
        {
            // Initialize sub objects.
            _snippets      = new SnippetInfoCollection();
            _pages         = new MultiPageCollection();
            PageMetadata   = new PageMetadata();
            SocialMetadata = new SocialMetadata();
            PageResources  = new PageResources();
            _localFields   = new LocalFieldCollection();

            //base.Initialize();
        }
예제 #3
0
 public MultiPage()
 {
     // Initialize sub objects.
     _snippets    = new SnippetInfoCollection();
     PageMetadata = new PageMetadata();
 }
예제 #4
0
        public void ReadXml(System.Xml.XmlReader reader)
        {
            while (reader.Read())
            {
                if ((reader.LocalName == "SnippetInfo") && (reader.IsStartElement() == false))
                {
                    reader.Read(); break;
                }

                switch (reader.LocalName)
                {
                case "Data":
                {
                    Data = reader.ReadString();
                }
                break;

                case "ConfigTextItem":
                {
                    if (_configStrings == null)
                    {
                        _configStrings = new Dictionary <string, string>();
                    }

                    if (reader.GetAttribute("Name") == null)
                    {
                        log.Error("Invalid ConfigTextItem - Name cannot be empty");
                        break;
                    }

                    try
                    {
                        _configStrings.Add(reader.GetAttribute("Name"), reader.ReadString());
                    }
                    catch (Exception ex)
                    {
                        log.Error("Invalid ConfigTextItem", ex);
                        break;
                    }
                }
                break;

                case "SnippetTemplatePath":
                {
                    SnippetTemplatePath = reader.ReadString();
                }
                break;

                case "SlotName":
                {
                    SlotName = reader.ReadString();
                }
                break;

                case "ContentID":
                {
                    ContentID = reader.ReadString();
                }
                break;
                //case "CDRId":
                //    string cdrId = reader.ReadString();
                //    if (!string.IsNullOrEmpty(cdrId))
                //        CDRId = cdrId;
                //    break;

                //case "CDRDefinitionName":
                //    CDRDefinitionName = reader.ReadString();
                //    break;
                case "DisplayVersion":
                {
                    listOnlyDisplayFor.Add((DisplayVersions)Enum.Parse(typeof(DisplayVersions), reader.ReadString()));
                }
                break;

                case "Snippets":
                {
                    //using (XmlTextReader snippetReader = new XmlTextReader(snippetXmlData.Trim(), XmlNodeType.Element, null))
                    //{
                    //    XmlSerializer serializer = new XmlSerializer(typeof(SnippetInfoCollection));
                    //    this._snippets = (SnippetInfoCollection)serializer.Deserialize(reader);
                    //}


                    _snippets = (SnippetInfoCollection)nestedSnippetSerializer.Deserialize(reader);
                }
                break;
                }
            }
        }