Beispiel #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="reader"></param>
        public override void ReadJson(JsonReader reader)
        {
            while (reader.Read())
            {
                if (reader.TokenType == JsonToken.EndObject)
                {
                    return;
                }

                if (reader.TokenType != JsonToken.PropertyName)
                {
                    continue;
                }

                switch (reader.Value)
                {
                case RedmineKeys.ID: Id = reader.ReadAsInt32().GetValueOrDefault(); break;

                case RedmineKeys.AUTHOR: Author = new IdentifiableName(reader); break;

                case RedmineKeys.CONTENT_TYPE: ContentType = reader.ReadAsString(); break;

                case RedmineKeys.CONTENT_URL: ContentUrl = reader.ReadAsString(); break;

                case RedmineKeys.CREATED_ON: CreatedOn = reader.ReadAsDateTime(); break;

                case RedmineKeys.DESCRIPTION: Description = reader.ReadAsString(); break;

                case RedmineKeys.DIGEST: Digest = reader.ReadAsString(); break;

                case RedmineKeys.DOWNLOADS: Downloads = reader.ReadAsInt32().GetValueOrDefault(); break;

                case RedmineKeys.FILE_NAME: Filename = reader.ReadAsString(); break;

                case RedmineKeys.FILE_SIZE: FileSize = reader.ReadAsInt32().GetValueOrDefault(); break;

                case RedmineKeys.TOKEN: Token = reader.ReadAsString(); break;

                case RedmineKeys.VERSION: Version = new IdentifiableName(reader); break;

                case RedmineKeys.VERSION_ID: Version = IdentifiableName.Create(reader.ReadAsInt32().GetValueOrDefault()); break;

                default: reader.Read(); break;
                }
            }
        }
Beispiel #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="reader"></param>
        public override void ReadXml(XmlReader reader)
        {
            reader.Read();

            while (!reader.EOF)
            {
                if (reader.IsEmptyElement && !reader.HasAttributes)
                {
                    reader.Read();
                    continue;
                }

                switch (reader.Name)
                {
                case RedmineKeys.ID: Id = reader.ReadElementContentAsInt(); break;

                case RedmineKeys.AUTHOR: Author = new IdentifiableName(reader); break;

                case RedmineKeys.CONTENT_TYPE: ContentType = reader.ReadElementContentAsString(); break;

                case RedmineKeys.CONTENT_URL: ContentUrl = reader.ReadElementContentAsString(); break;

                case RedmineKeys.CREATED_ON: CreatedOn = reader.ReadElementContentAsNullableDateTime(); break;

                case RedmineKeys.DESCRIPTION: Description = reader.ReadElementContentAsString(); break;

                case RedmineKeys.DIGEST: Digest = reader.ReadElementContentAsString(); break;

                case RedmineKeys.DOWNLOADS: Downloads = reader.ReadElementContentAsInt(); break;

                case RedmineKeys.FILE_NAME: Filename = reader.ReadElementContentAsString(); break;

                case RedmineKeys.FILE_SIZE: FileSize = reader.ReadElementContentAsInt(); break;

                case RedmineKeys.TOKEN: Token = reader.ReadElementContentAsString(); break;

                case RedmineKeys.VERSION: Version = new IdentifiableName(reader); break;

                case RedmineKeys.VERSION_ID: Version = IdentifiableName.Create(reader.ReadElementContentAsInt()); break;

                default: reader.Read(); break;
                }
            }
        }
Beispiel #3
0
 /// <summary>
 ///
 /// </summary>
 /// <returns></returns>
 public IdentifiableName AsParent()
 {
     return(IdentifiableName.Create <IdentifiableName>(Id));
 }