protected void SetBaseData(CodePhrase normalStatus, DvInterval <T> normalRange, ReferenceRange <T>[] otherReferenceRanges) { DesignByContract.Check.Require(otherReferenceRanges == null || otherReferenceRanges.Length > 0, "if otherReferenceRanges is not null, it must not be empty."); this.normalStatus = normalStatus; this.normalRange = normalRange; if (otherReferenceRanges != null) { this.otherReferenceRanges = new List <ReferenceRange <T> >(otherReferenceRanges); } }
protected override void ReadXmlBase(System.Xml.XmlReader reader) { if (reader.LocalName == "charset") { this.charset = new OpenEhr.RM.DataTypes.Text.CodePhrase(); this.charset.ReadXml(reader); } if (reader.LocalName == "language") { this.language = new OpenEhr.RM.DataTypes.Text.CodePhrase(); this.language.ReadXml(reader); } }
public DvMultimedia(Text.CodePhrase charset, Text.CodePhrase language, string alternateText, Uri.DvUri uri, byte[] data, Text.CodePhrase mediaType, Text.CodePhrase compressionAlgorithm, byte[] integrityCheck, Text.CodePhrase integrityCheckAlgorithm, int size, DvMultimedia thumbnail) : this() { this.SetBaseData(charset, language); this.alternateText = alternateText; this.uri = uri; this.data = data; this.mediaType = mediaType; this.compressionAlgorithm = compressionAlgorithm; this.integrityCheck = integrityCheck; this.integrityCheckAlgorithm = integrityCheckAlgorithm; this.size = size; this.CheckInvariants(); }
protected override void ReadXmlBase(System.Xml.XmlReader reader) { if (reader.LocalName == "normal_range") { if (this.normalRange == null) { this.normalRange = new DvInterval <T>(); } this.normalRange.ReadXml(reader); } if (reader.LocalName == "other_reference_ranges") { List <ReferenceRange <T> > otherRefRanges = new List <ReferenceRange <T> >(); do { ReferenceRange <T> refRange = new ReferenceRange <T>(); refRange.ReadXml(reader); otherRefRanges.Add(refRange); } while (reader.LocalName == "other_reference_ranges"); this.otherReferenceRanges = otherRefRanges; } if (reader.LocalName == "normal_status") { if (this.normalStatus == null) { this.normalStatus = new CodePhrase(); } // CM: 06/03/08 this.normalStatus.ReadXml(reader); } }
protected void SetBaseData(CodePhrase charset, CodePhrase language) { this.charset = charset; this.language = language; }
protected override void ReadXmlBase(System.Xml.XmlReader reader) { base.ReadXmlBase(reader); if (reader.LocalName == "alternate_text") { this.alternateText = reader.ReadElementString("alternate_text", RmXmlSerializer.OpenEhrNamespace); } reader.MoveToContent(); if (reader.LocalName == "uri") { string uriType = reader.GetAttribute("type", RmXmlSerializer.XsiNamespace); if (uriType != null) { Check.Assert(uriType.IndexOf("DV_EHR_URI") > 0, "uriType must be DV_EHR_URI, but it is " + uriType); this.uri = new OpenEhr.RM.DataTypes.Uri.DvEhrUri(); } this.uri = new OpenEhr.RM.DataTypes.Uri.DvUri(); this.uri.ReadXml(reader); } if (reader.LocalName == "data") { reader.MoveToContent(); reader.ReadStartElement(); byte[] buffer = new byte[1024]; System.IO.MemoryStream stream = new System.IO.MemoryStream(); System.IO.BinaryWriter writer = new System.IO.BinaryWriter(stream); int bytesRead = reader.ReadContentAsBase64(buffer, 0, 1024); while (bytesRead > 0) { writer.Write(buffer, 0, bytesRead); bytesRead = reader.ReadContentAsBase64(buffer, 0, 1024); } writer.Close(); reader.MoveToContent(); reader.ReadEndElement(); this.data = stream.ToArray(); } reader.MoveToContent(); if (reader.LocalName == "media_type") { this.mediaType = new OpenEhr.RM.DataTypes.Text.CodePhrase(); this.mediaType.ReadXml(reader); } if (reader.LocalName == "compression_algorithm") { this.compressionAlgorithm = new OpenEhr.RM.DataTypes.Text.CodePhrase(); this.compressionAlgorithm.ReadXml(reader); } if (reader.LocalName == "integrity_check") { reader.ReadElementContentAsBase64(this.integrityCheck, 0, this.integrityCheck.Length); } reader.MoveToContent(); if (reader.LocalName == "integrity_check_algorithm") { this.integrityCheckAlgorithm = new OpenEhr.RM.DataTypes.Text.CodePhrase(); this.integrityCheckAlgorithm.ReadXml(reader); } Check.Assert(reader.LocalName == "size", "Expected LocalName is 'size', not " + reader.LocalName); this.size = reader.ReadElementContentAsInt("size", RmXmlSerializer.OpenEhrNamespace); reader.MoveToContent(); if (reader.LocalName == "thumbnail") { this.thumbnail = new DvMultimedia(); this.thumbnail.ReadXml(reader); } }
protected override void ReadXmlBase(System.Xml.XmlReader reader) { base.ReadXmlBase(reader); if (reader.LocalName == "alternate_text") this.alternateText = reader.ReadElementString("alternate_text", RmXmlSerializer.OpenEhrNamespace); reader.MoveToContent(); if (reader.LocalName == "uri") { string uriType = reader.GetAttribute("type", RmXmlSerializer.XsiNamespace); if (uriType != null) { Check.Assert(uriType.IndexOf("DV_EHR_URI")>0, "uriType must be DV_EHR_URI, but it is "+uriType); this.uri = new OpenEhr.RM.DataTypes.Uri.DvEhrUri(); } this.uri = new OpenEhr.RM.DataTypes.Uri.DvUri(); this.uri.ReadXml(reader); } if (reader.LocalName == "data") { reader.MoveToContent(); reader.ReadStartElement(); byte[] buffer = new byte[1024]; System.IO.MemoryStream stream = new System.IO.MemoryStream(); System.IO.BinaryWriter writer = new System.IO.BinaryWriter(stream); int bytesRead = reader.ReadContentAsBase64(buffer, 0, 1024); while (bytesRead > 0) { writer.Write(buffer, 0, bytesRead); bytesRead = reader.ReadContentAsBase64(buffer, 0, 1024); } writer.Close(); reader.MoveToContent(); reader.ReadEndElement(); this.data = stream.ToArray(); } reader.MoveToContent(); if (reader.LocalName == "media_type") { this.mediaType = new OpenEhr.RM.DataTypes.Text.CodePhrase(); this.mediaType.ReadXml(reader); } if (reader.LocalName == "compression_algorithm") { this.compressionAlgorithm = new OpenEhr.RM.DataTypes.Text.CodePhrase(); this.compressionAlgorithm.ReadXml(reader); } if (reader.LocalName == "integrity_check") { reader.ReadElementContentAsBase64(this.integrityCheck, 0, this.integrityCheck.Length); } reader.MoveToContent(); if (reader.LocalName == "integrity_check_algorithm") { this.integrityCheckAlgorithm = new OpenEhr.RM.DataTypes.Text.CodePhrase(); this.integrityCheckAlgorithm.ReadXml(reader); } Check.Assert(reader.LocalName=="size", "Expected LocalName is 'size', not " + reader.LocalName); this.size = reader.ReadElementContentAsInt("size", RmXmlSerializer.OpenEhrNamespace); reader.MoveToContent(); if (reader.LocalName == "thumbnail") { this.thumbnail = new DvMultimedia(); this.thumbnail.ReadXml(reader); } }