public override void CopyFrom(IProperty srcRootProperty) { IPropertyContainer propertyContainer = srcRootProperty as IPropertyContainer; if (propertyContainer == null) { throw new UnexpectedTypeException("IPropertyContainer", srcRootProperty); } propertyContainer.SetCopyDestination(this); foreach (IProperty property in propertyContainer.Children) { if (property.State != PropertyState.NotSupported) { AirSyncProperty propBySchemaLinkId = this.GetPropBySchemaLinkId(property.SchemaLinkId); if (propBySchemaLinkId is IDataObjectGeneratorContainer) { ((IDataObjectGeneratorContainer)propBySchemaLinkId).SchemaState = this.schemaState; ((IDataObjectGeneratorContainer)property).SchemaState = ((IDataObjectGeneratorContainer)srcRootProperty).SchemaState; } this.missingPropStrategy.ExecuteCopyProperty(property, propBySchemaLinkId); } } foreach (IProperty property2 in propertyContainer.Children) { if (property2.State != PropertyState.NotSupported) { AirSyncProperty propBySchemaLinkId2 = this.GetPropBySchemaLinkId(property2.SchemaLinkId); if (propBySchemaLinkId2 != null && propBySchemaLinkId2.PostProcessingDelegate != null) { propBySchemaLinkId2.PostProcessingDelegate(property2, this.Children); propBySchemaLinkId2.PostProcessingDelegate = null; } } } }
public void Bind(XmlNode xmlItemRoot) { if (xmlItemRoot == null) { throw new ArgumentNullException("xmlItemRoot"); } foreach (object obj in xmlItemRoot.ChildNodes) { XmlNode xmlNode = (XmlNode)obj; XmlNodeType nodeType = xmlNode.NodeType; if (nodeType != XmlNodeType.Element) { throw new ConversionException("Unexpected node type, should have been caught in a higher validation layer"); } AirSyncProperty airSyncProperty = null; if (!this.propertyFromAirSyncTag.TryGetValue(xmlNode.Name, out airSyncProperty)) { throw new ConversionException("Cannot bind property to XML node " + xmlNode.Name + ", property does not exist"); } airSyncProperty.Bind(xmlNode); } foreach (AirSyncProperty airSyncProperty2 in this.propertyFromAirSyncTag.Values) { if (airSyncProperty2.State == PropertyState.Uninitialized) { airSyncProperty2.BindToParent(xmlItemRoot); } } this.missingPropStrategy.PostProcessPropertyBag(this); }
public AirSyncDataObject(IList <IProperty> propertyFromSchemaLinkId, IAirSyncMissingPropertyStrategy missingPropStrategy, IAirSyncDataObjectGenerator schemaState) { if (propertyFromSchemaLinkId == null) { throw new ArgumentNullException("propertyFromSchemaLinkId"); } if (missingPropStrategy == null) { throw new ArgumentNullException("missingPropStrategy"); } this.missingPropStrategy = missingPropStrategy; this.propertyFromSchemaLinkId = propertyFromSchemaLinkId; this.schemaState = schemaState; this.propertyFromAirSyncTag = new Dictionary <string, AirSyncProperty>(propertyFromSchemaLinkId.Count); for (int i = 0; i < propertyFromSchemaLinkId.Count; i++) { AirSyncProperty airSyncProperty = (AirSyncProperty)propertyFromSchemaLinkId[i]; if (airSyncProperty == null) { throw new ArgumentNullException("airSyncProperty"); } if (airSyncProperty.AirSyncTagNames == null) { throw new ArgumentNullException("airSyncProperty.AirSyncTagNames"); } for (int j = 0; j < airSyncProperty.AirSyncTagNames.Length; j++) { if (airSyncProperty.AirSyncTagNames[j] != null) { this.propertyFromAirSyncTag[airSyncProperty.AirSyncTagNames[j]] = airSyncProperty; } } } this.missingPropStrategy.Validate(this); }
// Token: 0x06000F47 RID: 3911 RVA: 0x00057374 File Offset: 0x00055574 private void PostProcessAttachments(IProperty srcProperty, IList <IProperty> airSyncProps) { if (!(srcProperty is IAttachments12Property)) { throw new UnexpectedTypeException("IAttachments12Property", srcProperty); } IEnumerable <AirSyncAttachmentInfo> enumerable = null; foreach (IProperty property in airSyncProps) { AirSyncProperty airSyncProperty = (AirSyncProperty)property; if (airSyncProperty is IAirSyncAttachments) { IEnumerable <AirSyncAttachmentInfo> attachments = ((IAirSyncAttachments)airSyncProperty).Attachments; if (attachments != null && attachments.Count <AirSyncAttachmentInfo>() > 0) { enumerable = ((enumerable == null) ? attachments : enumerable.Union(attachments)); } } } if (enumerable != null) { IEnumerable <IGrouping <AttachmentId, AirSyncAttachmentInfo> > allAttachments = from attachment in enumerable group attachment by attachment.AttachmentId; this.FixupXml(allAttachments); } }
public AirSyncProperty TryGetAirSyncPropertyByName(string propertyName) { AirSyncProperty result = null; if (this.propertyFromAirSyncTag.TryGetValue(propertyName, out result)) { return(result); } return(null); }
protected void AppendChildNode(XmlNode parentNode, string elementName, string value, string nodeNamespace) { AirSyncDiagnostics.TraceInfo(ExTraceGlobals.AirSyncTracer, this, "Appending Namespace = {0} Node={1} Value={2} to {3}", new object[] { nodeNamespace, elementName, AirSyncProperty.GetValueToTrace(value, elementName), parentNode.Name }); XmlNode xmlNode = this.xmlParentNode.OwnerDocument.CreateElement(elementName, nodeNamespace); xmlNode.InnerText = value; parentNode.AppendChild(xmlNode); }
// Token: 0x06001020 RID: 4128 RVA: 0x0005B509 File Offset: 0x00059709 public void ExecuteCopyProperty(IProperty srcProperty, AirSyncProperty dstAirSyncProperty) { if (srcProperty == null) { throw new ArgumentNullException("srcProperty"); } if (dstAirSyncProperty == null) { throw new ArgumentNullException("dstAirSyncProperty"); } if (PropertyState.Modified == srcProperty.State || PropertyState.Stream == srcProperty.State || PropertyState.SetToDefault == srcProperty.State) { dstAirSyncProperty.CopyFrom(srcProperty); } }
// Token: 0x06001022 RID: 4130 RVA: 0x0005B5E8 File Offset: 0x000597E8 public void Validate(AirSyncDataObject airSyncDataObject) { if (this.supportedTags != null && airSyncDataObject == null) { throw new ArgumentNullException("airSyncDataObject"); } if (this.supportedTags != null) { foreach (IProperty property in airSyncDataObject.Children) { AirSyncProperty airSyncProperty = (AirSyncProperty)property; if (airSyncProperty.RequiresClientSupport && !this.supportedTags.ContainsKey(airSyncProperty.AirSyncTagNames[0])) { throw new ConversionException("Client must support property: " + airSyncProperty.AirSyncTagNames[0]); } } } }
public void ExecuteCopyProperty(IProperty srcProperty, AirSyncProperty dstAirSyncProperty) { if (srcProperty == null) { throw new ArgumentNullException("srcProperty"); } if (dstAirSyncProperty == null) { throw new ArgumentNullException("dstAirSyncProperty"); } if (dstAirSyncProperty.AirSyncTagNames == null) { throw new ArgumentNullException("dstAirSyncProperty.AirSyncTagNames"); } if (PropertyState.Modified == srcProperty.State && (this.schemaTags == null || this.schemaTags.ContainsKey(dstAirSyncProperty.Namespace + dstAirSyncProperty.AirSyncTagNames[0]))) { dstAirSyncProperty.CopyFrom(srcProperty); } }
// Token: 0x06001024 RID: 4132 RVA: 0x0005B6C8 File Offset: 0x000598C8 public void PostProcessPropertyBag(AirSyncDataObject airSyncDataObject) { if (airSyncDataObject == null) { throw new ArgumentNullException("airSyncDataObject"); } foreach (IProperty property in airSyncDataObject.Children) { AirSyncProperty airSyncProperty = (AirSyncProperty)property; if (airSyncProperty.State == PropertyState.Uninitialized) { airSyncProperty.State = PropertyState.Unmodified; } else if (airSyncProperty.IsBoundToEmptyTag()) { airSyncProperty.State = PropertyState.SetToDefault; } } }
// Token: 0x06001023 RID: 4131 RVA: 0x0005B688 File Offset: 0x00059888 public void ExecuteCopyProperty(IProperty srcProperty, AirSyncProperty dstAirSyncProperty) { if (srcProperty == null) { throw new ArgumentNullException("srcProperty"); } if (dstAirSyncProperty == null) { throw new ArgumentNullException("dstAirSyncProperty"); } if (PropertyState.SetToDefault == srcProperty.State) { dstAirSyncProperty.OutputEmptyNode(); return; } if (PropertyState.Unmodified != srcProperty.State) { dstAirSyncProperty.CopyFrom(srcProperty); } }
public void PostProcessPropertyBag(AirSyncDataObject airSyncDataObject) { if (airSyncDataObject == null) { throw new ArgumentNullException("airSyncDataObject"); } foreach (IProperty property in airSyncDataObject.Children) { AirSyncProperty airSyncProperty = (AirSyncProperty)property; if (airSyncProperty.State == PropertyState.Uninitialized) { airSyncProperty.State = PropertyState.Unmodified; } else if (airSyncProperty.IsBoundToEmptyTag()) { airSyncProperty.State = PropertyState.SetToDefault; } AirSyncDiagnostics.TraceInfo <AirSyncProperty, PropertyState>(ExTraceGlobals.AirSyncTracer, this, "Property={0} State={1}", airSyncProperty, airSyncProperty.State); } }
// Token: 0x06001021 RID: 4129 RVA: 0x0005B54C File Offset: 0x0005974C public void PostProcessPropertyBag(AirSyncDataObject airSyncDataObject) { if (airSyncDataObject == null) { throw new ArgumentNullException("airSyncDataObject"); } foreach (IProperty property in airSyncDataObject.Children) { AirSyncProperty airSyncProperty = (AirSyncProperty)property; if (airSyncProperty.State == PropertyState.Uninitialized) { if (this.supportedTags != null && !this.supportedTags.ContainsKey(airSyncProperty.AirSyncTagNames[0])) { airSyncProperty.State = PropertyState.Unmodified; } else { airSyncProperty.State = (airSyncProperty.ClientChangeTracked ? PropertyState.Unmodified : PropertyState.SetToDefault); } } } }
protected void AppendChildCData(XmlNode parentNode, string elementName, string value) { AirSyncDiagnostics.TraceInfo <string, string, string>(ExTraceGlobals.AirSyncTracer, this, "Creating CData Node={0} Value={1} to {2}", elementName, AirSyncProperty.GetValueToTrace(value, elementName), parentNode.Name); XmlNode xmlNode = this.xmlParentNode.OwnerDocument.CreateElement(elementName, this.xmlNodeNamespace); XmlCDataSection newChild = this.xmlParentNode.OwnerDocument.CreateCDataSection(value); xmlNode.AppendChild(newChild); parentNode.AppendChild(xmlNode); }
protected void AppendChildNode(string elementName, string value) { AirSyncDiagnostics.TraceInfo <string, string>(ExTraceGlobals.AirSyncTracer, this, "Creating Node={0} Value={1}", elementName, AirSyncProperty.GetValueToTrace(value, elementName)); XmlNode xmlNode = this.xmlParentNode.OwnerDocument.CreateElement(elementName, this.xmlNodeNamespace); xmlNode.InnerText = value; this.xmlNode.AppendChild(xmlNode); }
protected void CreateAirSyncNode(string strData, bool allowEmptyNode) { AirSyncDiagnostics.TraceInfo <string, string>(ExTraceGlobals.AirSyncTracer, this, "Creating Node={0} Value={1}", this.airSyncTagNames[0], AirSyncProperty.GetValueToTrace(strData, this.airSyncTagNames[0])); if (allowEmptyNode || !string.IsNullOrEmpty(strData)) { this.xmlNode = this.xmlParentNode.OwnerDocument.CreateElement(this.airSyncTagNames[0], this.xmlNodeNamespace); this.xmlNode.InnerText = strData; this.xmlParentNode.AppendChild(this.xmlNode); } }
protected void CreateAirSyncNode(string airSyncTagName, string strData) { AirSyncDiagnostics.TraceInfo <string, string>(ExTraceGlobals.AirSyncTracer, this, "Creating Node={0} Value={1}", airSyncTagName, AirSyncProperty.GetValueToTrace(strData, airSyncTagName)); this.xmlNode = this.xmlParentNode.OwnerDocument.CreateElement(airSyncTagName, this.xmlNodeNamespace); this.xmlNode.InnerText = strData; this.xmlParentNode.AppendChild(this.xmlNode); }