/// <summary>
        /// Tries to load from XML.
        /// </summary>
        /// <param name="reader">The reader.</param>
        /// <param name="propertyDefinition">The property definition.</param>
        /// <returns>True if property was loaded.</returns>
        internal static bool TryLoadFromXml(EwsServiceXmlReader reader, ref PropertyDefinitionBase propertyDefinition)
        {
            switch (reader.LocalName)
            {
            case XmlElementNames.FieldURI:
                propertyDefinition = ServiceObjectSchema.FindPropertyDefinition(reader.ReadAttributeValue(XmlAttributeNames.FieldURI));
                reader.SkipCurrentElement();
                return(true);

            case XmlElementNames.IndexedFieldURI:
                propertyDefinition = new IndexedPropertyDefinition(
                    reader.ReadAttributeValue(XmlAttributeNames.FieldURI),
                    reader.ReadAttributeValue(XmlAttributeNames.FieldIndex));
                reader.SkipCurrentElement();
                return(true);

            case XmlElementNames.ExtendedFieldURI:
                propertyDefinition = new ExtendedPropertyDefinition();
                (propertyDefinition as ExtendedPropertyDefinition).LoadFromXml(reader);
                return(true);

            default:
                return(false);
            }
        }
 /// <summary>
 /// Determines whether two specified instances of IndexedPropertyDefinition are equal.
 /// </summary>
 /// <param name="idxPropDef1">First indexed property definition.</param>
 /// <param name="idxPropDef2">Second indexed property definition.</param>
 /// <returns>True if indexed property definitions are equal.</returns>
 internal static bool IsEqualTo(IndexedPropertyDefinition idxPropDef1, IndexedPropertyDefinition idxPropDef2)
 {
     return
         object.ReferenceEquals(idxPropDef1, idxPropDef2) ||
         ((object)idxPropDef1 != null &&
          (object)idxPropDef2 != null &&
          idxPropDef1.Uri == idxPropDef2.Uri &&
          idxPropDef1.Index == idxPropDef2.Index);
 }
 /// <summary>
 /// Determines whether two specified instances of IndexedPropertyDefinition are equal.
 /// </summary>
 /// <param name="idxPropDef1">First indexed property definition.</param>
 /// <param name="idxPropDef2">Second indexed property definition.</param>
 /// <returns>True if indexed property definitions are equal.</returns>
 internal static bool IsEqualTo(IndexedPropertyDefinition idxPropDef1, IndexedPropertyDefinition idxPropDef2)
 {
     return
         (object.ReferenceEquals(idxPropDef1, idxPropDef2) ||
          ((object)idxPropDef1 != null &&
           (object)idxPropDef2 != null &&
           idxPropDef1.Uri == idxPropDef2.Uri &&
           idxPropDef1.Index == idxPropDef2.Index));
 }
 /// <summary>
 /// Tries to load from XML.
 /// </summary>
 /// <param name="reader">The reader.</param>
 /// <param name="propertyDefinition">The property definition.</param>
 /// <returns>True if property was loaded.</returns>
 internal static bool TryLoadFromXml(EwsServiceXmlReader reader, ref PropertyDefinitionBase propertyDefinition)
 {
     switch (reader.LocalName)
     {
         case XmlElementNames.FieldURI:
             propertyDefinition = ServiceObjectSchema.FindPropertyDefinition(reader.ReadAttributeValue(XmlAttributeNames.FieldURI));
             reader.SkipCurrentElement();
             return true;
         case XmlElementNames.IndexedFieldURI:
             propertyDefinition = new IndexedPropertyDefinition(
                 reader.ReadAttributeValue(XmlAttributeNames.FieldURI),
                 reader.ReadAttributeValue(XmlAttributeNames.FieldIndex));
             reader.SkipCurrentElement();
             return true;
         case XmlElementNames.ExtendedFieldURI:
             propertyDefinition = new ExtendedPropertyDefinition();
             (propertyDefinition as ExtendedPropertyDefinition).LoadFromXml(reader);
             return true;
         default:
             return false;
     }
 }
예제 #5
0
 /// <summary>
 /// Registers an indexed property.
 /// </summary>
 /// <param name="indexedProperty">The indexed property to register.</param>
 internal void RegisterIndexedProperty(IndexedPropertyDefinition indexedProperty)
 {
     this.indexedProperties.Add(indexedProperty);
 }
        /// <summary>
        /// Determines whether a given indexed property definition is equal to this indexed property definition.
        /// </summary>
        /// <param name="obj">The object to check for equality.</param>
        /// <returns>True if the properties definitions define the same indexed property.</returns>
        public override bool Equals(object obj)
        {
            IndexedPropertyDefinition propertyDefinition = obj as IndexedPropertyDefinition;

            return(IndexedPropertyDefinition.IsEqualTo(propertyDefinition, this));
        }
 /// <summary>
 /// Determines whether two specified instances of IndexedPropertyDefinition are not equal.
 /// </summary>
 /// <param name="idxPropDef1">First indexed property definition.</param>
 /// <param name="idxPropDef2">Second indexed property definition.</param>
 /// <returns>True if indexed property definitions are equal.</returns>
 public static bool operator !=(IndexedPropertyDefinition idxPropDef1, IndexedPropertyDefinition idxPropDef2)
 {
     return(!IndexedPropertyDefinition.IsEqualTo(idxPropDef1, idxPropDef2));
 }