'' ------------------------------------------------------------------------------ '' '' Generated by Xsd2Code. Version 3.4.1.33667 Microsoft Reciprocal License (Ms-RL) '' MicErrorWarningMessageListVisualBasicFalseFalseFalseFalseFalseFalseFalseTrueFalseFalseFalseFalseNet40SerializeDeserializeSaveToFileLoadFromFileFalseFalseFalseFalseFalseFalseDefaultUTF8FalseTrue '' '' ------------------------------------------------------------------------------ Imports System Imports System.Diagnostics Imports System.Xml.Serialization Imports System.Collections Imports System.Xml.Schema Imports System.ComponentModel Imports System.IO Imports System.Text Imports System.Collections.Generic Namespace MicErrorWarningMessage Partial Public Class ErrorMessages Private errorMessageField As List(Of TErrorMessageType) Private Shared sSerializer As System.Xml.Serialization.XmlSerializer Public Sub New() MyBase.New Me.errorMessageField = New List(Of TErrorMessageType)() End Sub Public Property ErrorMessage() As List(Of TErrorMessageType) Get Return Me.errorMessageField End Get Set Me.errorMessageField = Value End Set End Property Private Shared ReadOnly Property Serializer() As System.Xml.Serialization.XmlSerializer Get If (sSerializer Is Nothing) Then sSerializer = New System.Xml.Serialization.XmlSerializer(GetType(ErrorMessages)) End If Return sSerializer End Get End Property #Region "Serialize/Deserialize" ''' '''Serializes current ErrorMessages object into an XML document ''' '''string XML value Public Overridable Function Serialize() As String Dim streamReader As System.IO.StreamReader = Nothing Dim memoryStream As System.IO.MemoryStream = Nothing Try memoryStream = New System.IO.MemoryStream() Serializer.Serialize(memoryStream, Me) memoryStream.Seek(0, System.IO.SeekOrigin.Begin) streamReader = New System.IO.StreamReader(memoryStream) Return streamReader.ReadToEnd Finally If (Not (streamReader) Is Nothing) Then streamReader.Dispose() End If If (Not (memoryStream) Is Nothing) Then memoryStream.Dispose() End If End Try End Function ''' '''Deserializes workflow markup into an ErrorMessages object ''' '''string workflow markup to deserialize '''Output ErrorMessages object '''output Exception value if deserialize failed '''true if this XmlSerializer can deserialize the object; otherwise, false Public Overloads Shared Function Deserialize(ByVal xml As String, ByRef obj As ErrorMessages, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, ErrorMessages) Try obj = Deserialize(xml) Return True Catch ex As System.Exception exception = ex Return False End Try End Function Public Overloads Shared Function Deserialize(ByVal xml As String, ByRef obj As ErrorMessages) As Boolean Dim exception As System.Exception = Nothing Return Deserialize(xml, obj, exception) End Function Public Overloads Shared Function Deserialize(ByVal xml As String) As ErrorMessages Dim stringReader As System.IO.StringReader = Nothing Try stringReader = New System.IO.StringReader(xml) Return CType(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader)), ErrorMessages) Finally If (Not (stringReader) Is Nothing) Then stringReader.Dispose() End If End Try End Function ''' '''Serializes current ErrorMessages object into file ''' '''full path of outupt xml file '''output Exception value if failed '''true if can serialize and save into file; otherwise, false Public Overridable Overloads Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean exception = Nothing Try SaveToFile(fileName) Return True Catch e As System.Exception exception = e Return False End Try End Function Public Overridable Overloads Sub SaveToFile(ByVal fileName As String) Dim streamWriter As System.IO.StreamWriter = Nothing Try Dim xmlString As String = Serialize() Dim xmlFile As System.IO.FileInfo = New System.IO.FileInfo(fileName) streamWriter = xmlFile.CreateText streamWriter.WriteLine(xmlString) streamWriter.Close() Finally If (Not (streamWriter) Is Nothing) Then streamWriter.Dispose() End If End Try End Sub ''' '''Deserializes xml markup from file into an ErrorMessages object ''' '''string xml file to load and deserialize '''Output ErrorMessages object '''output Exception value if deserialize failed '''true if this XmlSerializer can deserialize the object; otherwise, false Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As ErrorMessages, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, ErrorMessages) Try obj = LoadFromFile(fileName) Return True Catch ex As System.Exception exception = ex Return False End Try End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As ErrorMessages) As Boolean Dim exception As System.Exception = Nothing Return LoadFromFile(fileName, obj, exception) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String) As ErrorMessages Dim file As System.IO.FileStream = Nothing Dim sr As System.IO.StreamReader = Nothing Try file = New System.IO.FileStream(fileName, FileMode.Open, FileAccess.Read) sr = New System.IO.StreamReader(file) Dim xmlString As String = sr.ReadToEnd sr.Close() file.Close() Return Deserialize(xmlString) Finally If (Not (file) Is Nothing) Then file.Dispose() End If If (Not (sr) Is Nothing) Then sr.Dispose() End If End Try End Function #End Region End Class Partial Public Class TErrorMessageType Private moduleField As String Private processField As String Private errorCodeField As String Private errorDescField As String Private referenceField As TReference Private detailsField As TErrorDetail Private Shared sSerializer As System.Xml.Serialization.XmlSerializer Public Sub New() MyBase.New Me.detailsField = New TErrorDetail() Me.referenceField = New TReference() End Sub Public Property [module]() As String Get Return Me.moduleField End Get Set Me.moduleField = Value End Set End Property Public Property process() As String Get Return Me.processField End Get Set Me.processField = Value End Set End Property Public Property errorCode() As String Get Return Me.errorCodeField End Get Set Me.errorCodeField = Value End Set End Property Public Property errorDesc() As String Get Return Me.errorDescField End Get Set Me.errorDescField = Value End Set End Property Public Property Reference() As TReference Get Return Me.referenceField End Get Set Me.referenceField = Value End Set End Property Public Property Details() As TErrorDetail Get Return Me.detailsField End Get Set Me.detailsField = Value End Set End Property Private Shared ReadOnly Property Serializer() As System.Xml.Serialization.XmlSerializer Get If (sSerializer Is Nothing) Then sSerializer = New System.Xml.Serialization.XmlSerializer(GetType(TErrorMessageType)) End If Return sSerializer End Get End Property #Region "Serialize/Deserialize" ''' '''Serializes current TErrorMessageType object into an XML document ''' '''string XML value Public Overridable Function Serialize() As String Dim streamReader As System.IO.StreamReader = Nothing Dim memoryStream As System.IO.MemoryStream = Nothing Try memoryStream = New System.IO.MemoryStream() Serializer.Serialize(memoryStream, Me) memoryStream.Seek(0, System.IO.SeekOrigin.Begin) streamReader = New System.IO.StreamReader(memoryStream) Return streamReader.ReadToEnd Finally If (Not (streamReader) Is Nothing) Then streamReader.Dispose() End If If (Not (memoryStream) Is Nothing) Then memoryStream.Dispose() End If End Try End Function ''' '''Deserializes workflow markup into an TErrorMessageType object ''' '''string workflow markup to deserialize '''Output TErrorMessageType object '''output Exception value if deserialize failed '''true if this XmlSerializer can deserialize the object; otherwise, false Public Overloads Shared Function Deserialize(ByVal xml As String, ByRef obj As TErrorMessageType, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, TErrorMessageType) Try obj = Deserialize(xml) Return True Catch ex As System.Exception exception = ex Return False End Try End Function Public Overloads Shared Function Deserialize(ByVal xml As String, ByRef obj As TErrorMessageType) As Boolean Dim exception As System.Exception = Nothing Return Deserialize(xml, obj, exception) End Function Public Overloads Shared Function Deserialize(ByVal xml As String) As TErrorMessageType Dim stringReader As System.IO.StringReader = Nothing Try stringReader = New System.IO.StringReader(xml) Return CType(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader)), TErrorMessageType) Finally If (Not (stringReader) Is Nothing) Then stringReader.Dispose() End If End Try End Function ''' '''Serializes current TErrorMessageType object into file ''' '''full path of outupt xml file '''output Exception value if failed '''true if can serialize and save into file; otherwise, false Public Overridable Overloads Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean exception = Nothing Try SaveToFile(fileName) Return True Catch e As System.Exception exception = e Return False End Try End Function Public Overridable Overloads Sub SaveToFile(ByVal fileName As String) Dim streamWriter As System.IO.StreamWriter = Nothing Try Dim xmlString As String = Serialize() Dim xmlFile As System.IO.FileInfo = New System.IO.FileInfo(fileName) streamWriter = xmlFile.CreateText streamWriter.WriteLine(xmlString) streamWriter.Close() Finally If (Not (streamWriter) Is Nothing) Then streamWriter.Dispose() End If End Try End Sub ''' '''Deserializes xml markup from file into an TErrorMessageType object ''' '''string xml file to load and deserialize '''Output TErrorMessageType object '''output Exception value if deserialize failed '''true if this XmlSerializer can deserialize the object; otherwise, false Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TErrorMessageType, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, TErrorMessageType) Try obj = LoadFromFile(fileName) Return True Catch ex As System.Exception exception = ex Return False End Try End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TErrorMessageType) As Boolean Dim exception As System.Exception = Nothing Return LoadFromFile(fileName, obj, exception) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String) As TErrorMessageType Dim file As System.IO.FileStream = Nothing Dim sr As System.IO.StreamReader = Nothing Try file = New System.IO.FileStream(fileName, FileMode.Open, FileAccess.Read) sr = New System.IO.StreamReader(file) Dim xmlString As String = sr.ReadToEnd sr.Close() file.Close() Return Deserialize(xmlString) Finally If (Not (file) Is Nothing) Then file.Dispose() End If If (Not (sr) Is Nothing) Then sr.Dispose() End If End Try End Function #End Region End Class Partial Public Class TReference Private companyField As String Private plantField As String Private correlationIdField As String Private referenceTypeField As String Private referenceSidField As Long Private referenceSidFieldSpecified As Boolean Private userField As String Private partnerIdField As String Private routeIdField As String Private Shared sSerializer As System.Xml.Serialization.XmlSerializer Public Property company() As String Get Return Me.companyField End Get Set Me.companyField = Value End Set End Property Public Property plant() As String Get Return Me.plantField End Get Set Me.plantField = Value End Set End Property Public Property correlationId() As String Get Return Me.correlationIdField End Get Set Me.correlationIdField = Value End Set End Property Public Property referenceType() As String Get Return Me.referenceTypeField End Get Set Me.referenceTypeField = Value End Set End Property Public Property referenceSid() As Long Get Return Me.referenceSidField End Get Set Me.referenceSidField = Value End Set End Property Public Property referenceSidSpecified() As Boolean Get Return Me.referenceSidFieldSpecified End Get Set Me.referenceSidFieldSpecified = Value End Set End Property Public Property user() As String Get Return Me.userField End Get Set Me.userField = Value End Set End Property Public Property partnerId() As String Get Return Me.partnerIdField End Get Set Me.partnerIdField = Value End Set End Property Public Property routeId() As String Get Return Me.routeIdField End Get Set Me.routeIdField = Value End Set End Property Private Shared ReadOnly Property Serializer() As System.Xml.Serialization.XmlSerializer Get If (sSerializer Is Nothing) Then sSerializer = New System.Xml.Serialization.XmlSerializer(GetType(TReference)) End If Return sSerializer End Get End Property #Region "Serialize/Deserialize" ''' '''Serializes current TReference object into an XML document ''' '''string XML value Public Overridable Function Serialize() As String Dim streamReader As System.IO.StreamReader = Nothing Dim memoryStream As System.IO.MemoryStream = Nothing Try memoryStream = New System.IO.MemoryStream() Serializer.Serialize(memoryStream, Me) memoryStream.Seek(0, System.IO.SeekOrigin.Begin) streamReader = New System.IO.StreamReader(memoryStream) Return streamReader.ReadToEnd Finally If (Not (streamReader) Is Nothing) Then streamReader.Dispose() End If If (Not (memoryStream) Is Nothing) Then memoryStream.Dispose() End If End Try End Function ''' '''Deserializes workflow markup into an TReference object ''' '''string workflow markup to deserialize '''Output TReference object '''output Exception value if deserialize failed '''true if this XmlSerializer can deserialize the object; otherwise, false Public Overloads Shared Function Deserialize(ByVal xml As String, ByRef obj As TReference, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, TReference) Try obj = Deserialize(xml) Return True Catch ex As System.Exception exception = ex Return False End Try End Function Public Overloads Shared Function Deserialize(ByVal xml As String, ByRef obj As TReference) As Boolean Dim exception As System.Exception = Nothing Return Deserialize(xml, obj, exception) End Function Public Overloads Shared Function Deserialize(ByVal xml As String) As TReference Dim stringReader As System.IO.StringReader = Nothing Try stringReader = New System.IO.StringReader(xml) Return CType(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader)), TReference) Finally If (Not (stringReader) Is Nothing) Then stringReader.Dispose() End If End Try End Function ''' '''Serializes current TReference object into file ''' '''full path of outupt xml file '''output Exception value if failed '''true if can serialize and save into file; otherwise, false Public Overridable Overloads Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean exception = Nothing Try SaveToFile(fileName) Return True Catch e As System.Exception exception = e Return False End Try End Function Public Overridable Overloads Sub SaveToFile(ByVal fileName As String) Dim streamWriter As System.IO.StreamWriter = Nothing Try Dim xmlString As String = Serialize() Dim xmlFile As System.IO.FileInfo = New System.IO.FileInfo(fileName) streamWriter = xmlFile.CreateText streamWriter.WriteLine(xmlString) streamWriter.Close() Finally If (Not (streamWriter) Is Nothing) Then streamWriter.Dispose() End If End Try End Sub ''' '''Deserializes xml markup from file into an TReference object ''' '''string xml file to load and deserialize '''Output TReference object '''output Exception value if deserialize failed '''true if this XmlSerializer can deserialize the object; otherwise, false Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TReference, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, TReference) Try obj = LoadFromFile(fileName) Return True Catch ex As System.Exception exception = ex Return False End Try End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TReference) As Boolean Dim exception As System.Exception = Nothing Return LoadFromFile(fileName, obj, exception) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String) As TReference Dim file As System.IO.FileStream = Nothing Dim sr As System.IO.StreamReader = Nothing Try file = New System.IO.FileStream(fileName, FileMode.Open, FileAccess.Read) sr = New System.IO.StreamReader(file) Dim xmlString As String = sr.ReadToEnd sr.Close() file.Close() Return Deserialize(xmlString) Finally If (Not (file) Is Nothing) Then file.Dispose() End If If (Not (sr) Is Nothing) Then sr.Dispose() End If End Try End Function #End Region End Class Partial Public Class TErrorDetail Private timestampField As Date Private stackTraceField As String Private additionalDetailsField As List(Of TErrorDetailAdditionalDetails) Private Shared sSerializer As System.Xml.Serialization.XmlSerializer Public Sub New() MyBase.New Me.additionalDetailsField = New List(Of TErrorDetailAdditionalDetails)() End Sub Public Property timestamp() As Date Get Return Me.timestampField End Get Set Me.timestampField = Value End Set End Property Public Property stackTrace() As String Get Return Me.stackTraceField End Get Set Me.stackTraceField = Value End Set End Property Public Property additionalDetails() As List(Of TErrorDetailAdditionalDetails) Get Return Me.additionalDetailsField End Get Set Me.additionalDetailsField = Value End Set End Property Private Shared ReadOnly Property Serializer() As System.Xml.Serialization.XmlSerializer Get If (sSerializer Is Nothing) Then sSerializer = New System.Xml.Serialization.XmlSerializer(GetType(TErrorDetail)) End If Return sSerializer End Get End Property #Region "Serialize/Deserialize" ''' '''Serializes current TErrorDetail object into an XML document ''' '''string XML value Public Overridable Function Serialize() As String Dim streamReader As System.IO.StreamReader = Nothing Dim memoryStream As System.IO.MemoryStream = Nothing Try memoryStream = New System.IO.MemoryStream() Serializer.Serialize(memoryStream, Me) memoryStream.Seek(0, System.IO.SeekOrigin.Begin) streamReader = New System.IO.StreamReader(memoryStream) Return streamReader.ReadToEnd Finally If (Not (streamReader) Is Nothing) Then streamReader.Dispose() End If If (Not (memoryStream) Is Nothing) Then memoryStream.Dispose() End If End Try End Function ''' '''Deserializes workflow markup into an TErrorDetail object ''' '''string workflow markup to deserialize '''Output TErrorDetail object '''output Exception value if deserialize failed '''true if this XmlSerializer can deserialize the object; otherwise, false Public Overloads Shared Function Deserialize(ByVal xml As String, ByRef obj As TErrorDetail, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, TErrorDetail) Try obj = Deserialize(xml) Return True Catch ex As System.Exception exception = ex Return False End Try End Function Public Overloads Shared Function Deserialize(ByVal xml As String, ByRef obj As TErrorDetail) As Boolean Dim exception As System.Exception = Nothing Return Deserialize(xml, obj, exception) End Function Public Overloads Shared Function Deserialize(ByVal xml As String) As TErrorDetail Dim stringReader As System.IO.StringReader = Nothing Try stringReader = New System.IO.StringReader(xml) Return CType(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader)), TErrorDetail) Finally If (Not (stringReader) Is Nothing) Then stringReader.Dispose() End If End Try End Function ''' '''Serializes current TErrorDetail object into file ''' '''full path of outupt xml file '''output Exception value if failed '''true if can serialize and save into file; otherwise, false Public Overridable Overloads Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean exception = Nothing Try SaveToFile(fileName) Return True Catch e As System.Exception exception = e Return False End Try End Function Public Overridable Overloads Sub SaveToFile(ByVal fileName As String) Dim streamWriter As System.IO.StreamWriter = Nothing Try Dim xmlString As String = Serialize() Dim xmlFile As System.IO.FileInfo = New System.IO.FileInfo(fileName) streamWriter = xmlFile.CreateText streamWriter.WriteLine(xmlString) streamWriter.Close() Finally If (Not (streamWriter) Is Nothing) Then streamWriter.Dispose() End If End Try End Sub ''' '''Deserializes xml markup from file into an TErrorDetail object ''' '''string xml file to load and deserialize '''Output TErrorDetail object '''output Exception value if deserialize failed '''true if this XmlSerializer can deserialize the object; otherwise, false Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TErrorDetail, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, TErrorDetail) Try obj = LoadFromFile(fileName) Return True Catch ex As System.Exception exception = ex Return False End Try End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TErrorDetail) As Boolean Dim exception As System.Exception = Nothing Return LoadFromFile(fileName, obj, exception) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String) As TErrorDetail Dim file As System.IO.FileStream = Nothing Dim sr As System.IO.StreamReader = Nothing Try file = New System.IO.FileStream(fileName, FileMode.Open, FileAccess.Read) sr = New System.IO.StreamReader(file) Dim xmlString As String = sr.ReadToEnd sr.Close() file.Close() Return Deserialize(xmlString) Finally If (Not (file) Is Nothing) Then file.Dispose() End If If (Not (sr) Is Nothing) Then sr.Dispose() End If End Try End Function #End Region End Class Partial Public Class TErrorDetailAdditionalDetails Private typeField As String Private keyField As String Private valueField As String Private Shared sSerializer As System.Xml.Serialization.XmlSerializer Public Property type() As String Get Return Me.typeField End Get Set Me.typeField = Value End Set End Property Public Property key() As String Get Return Me.keyField End Get Set Me.keyField = Value End Set End Property Public Property value() As String Get Return Me.valueField End Get Set Me.valueField = Value End Set End Property Private Shared ReadOnly Property Serializer() As System.Xml.Serialization.XmlSerializer Get If (sSerializer Is Nothing) Then sSerializer = New System.Xml.Serialization.XmlSerializer(GetType(TErrorDetailAdditionalDetails)) End If Return sSerializer End Get End Property #Region "Serialize/Deserialize" ''' '''Serializes current TErrorDetailAdditionalDetails object into an XML document ''' '''string XML value Public Overridable Function Serialize() As String Dim streamReader As System.IO.StreamReader = Nothing Dim memoryStream As System.IO.MemoryStream = Nothing Try memoryStream = New System.IO.MemoryStream() Serializer.Serialize(memoryStream, Me) memoryStream.Seek(0, System.IO.SeekOrigin.Begin) streamReader = New System.IO.StreamReader(memoryStream) Return streamReader.ReadToEnd Finally If (Not (streamReader) Is Nothing) Then streamReader.Dispose() End If If (Not (memoryStream) Is Nothing) Then memoryStream.Dispose() End If End Try End Function ''' '''Deserializes workflow markup into an TErrorDetailAdditionalDetails object ''' '''string workflow markup to deserialize '''Output TErrorDetailAdditionalDetails object '''output Exception value if deserialize failed '''true if this XmlSerializer can deserialize the object; otherwise, false Public Overloads Shared Function Deserialize(ByVal xml As String, ByRef obj As TErrorDetailAdditionalDetails, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, TErrorDetailAdditionalDetails) Try obj = Deserialize(xml) Return True Catch ex As System.Exception exception = ex Return False End Try End Function Public Overloads Shared Function Deserialize(ByVal xml As String, ByRef obj As TErrorDetailAdditionalDetails) As Boolean Dim exception As System.Exception = Nothing Return Deserialize(xml, obj, exception) End Function Public Overloads Shared Function Deserialize(ByVal xml As String) As TErrorDetailAdditionalDetails Dim stringReader As System.IO.StringReader = Nothing Try stringReader = New System.IO.StringReader(xml) Return CType(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader)), TErrorDetailAdditionalDetails) Finally If (Not (stringReader) Is Nothing) Then stringReader.Dispose() End If End Try End Function ''' '''Serializes current TErrorDetailAdditionalDetails object into file ''' '''full path of outupt xml file '''output Exception value if failed '''true if can serialize and save into file; otherwise, false Public Overridable Overloads Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean exception = Nothing Try SaveToFile(fileName) Return True Catch e As System.Exception exception = e Return False End Try End Function Public Overridable Overloads Sub SaveToFile(ByVal fileName As String) Dim streamWriter As System.IO.StreamWriter = Nothing Try Dim xmlString As String = Serialize() Dim xmlFile As System.IO.FileInfo = New System.IO.FileInfo(fileName) streamWriter = xmlFile.CreateText streamWriter.WriteLine(xmlString) streamWriter.Close() Finally If (Not (streamWriter) Is Nothing) Then streamWriter.Dispose() End If End Try End Sub ''' '''Deserializes xml markup from file into an TErrorDetailAdditionalDetails object ''' '''string xml file to load and deserialize '''Output TErrorDetailAdditionalDetails object '''output Exception value if deserialize failed '''true if this XmlSerializer can deserialize the object; otherwise, false Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TErrorDetailAdditionalDetails, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, TErrorDetailAdditionalDetails) Try obj = LoadFromFile(fileName) Return True Catch ex As System.Exception exception = ex Return False End Try End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TErrorDetailAdditionalDetails) As Boolean Dim exception As System.Exception = Nothing Return LoadFromFile(fileName, obj, exception) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String) As TErrorDetailAdditionalDetails Dim file As System.IO.FileStream = Nothing Dim sr As System.IO.StreamReader = Nothing Try file = New System.IO.FileStream(fileName, FileMode.Open, FileAccess.Read) sr = New System.IO.StreamReader(file) Dim xmlString As String = sr.ReadToEnd sr.Close() file.Close() Return Deserialize(xmlString) Finally If (Not (file) Is Nothing) Then file.Dispose() End If If (Not (sr) Is Nothing) Then sr.Dispose() End If End Try End Function #End Region End Class Partial Public Class WarningMessages Private warningMessageField As List(Of TErrorMessageType) Private Shared sSerializer As System.Xml.Serialization.XmlSerializer Public Sub New() MyBase.New Me.warningMessageField = New List(Of TErrorMessageType)() End Sub Public Property WarningMessage() As List(Of TErrorMessageType) Get Return Me.warningMessageField End Get Set Me.warningMessageField = Value End Set End Property Private Shared ReadOnly Property Serializer() As System.Xml.Serialization.XmlSerializer Get If (sSerializer Is Nothing) Then sSerializer = New System.Xml.Serialization.XmlSerializer(GetType(WarningMessages)) End If Return sSerializer End Get End Property #Region "Serialize/Deserialize" ''' '''Serializes current WarningMessages object into an XML document ''' '''string XML value Public Overridable Function Serialize() As String Dim streamReader As System.IO.StreamReader = Nothing Dim memoryStream As System.IO.MemoryStream = Nothing Try memoryStream = New System.IO.MemoryStream() Serializer.Serialize(memoryStream, Me) memoryStream.Seek(0, System.IO.SeekOrigin.Begin) streamReader = New System.IO.StreamReader(memoryStream) Return streamReader.ReadToEnd Finally If (Not (streamReader) Is Nothing) Then streamReader.Dispose() End If If (Not (memoryStream) Is Nothing) Then memoryStream.Dispose() End If End Try End Function ''' '''Deserializes workflow markup into an WarningMessages object ''' '''string workflow markup to deserialize '''Output WarningMessages object '''output Exception value if deserialize failed '''true if this XmlSerializer can deserialize the object; otherwise, false Public Overloads Shared Function Deserialize(ByVal xml As String, ByRef obj As WarningMessages, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, WarningMessages) Try obj = Deserialize(xml) Return True Catch ex As System.Exception exception = ex Return False End Try End Function Public Overloads Shared Function Deserialize(ByVal xml As String, ByRef obj As WarningMessages) As Boolean Dim exception As System.Exception = Nothing Return Deserialize(xml, obj, exception) End Function Public Overloads Shared Function Deserialize(ByVal xml As String) As WarningMessages Dim stringReader As System.IO.StringReader = Nothing Try stringReader = New System.IO.StringReader(xml) Return CType(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader)), WarningMessages) Finally If (Not (stringReader) Is Nothing) Then stringReader.Dispose() End If End Try End Function ''' '''Serializes current WarningMessages object into file ''' '''full path of outupt xml file '''output Exception value if failed '''true if can serialize and save into file; otherwise, false Public Overridable Overloads Function SaveToFile(ByVal fileName As String, ByRef exception As System.Exception) As Boolean exception = Nothing Try SaveToFile(fileName) Return True Catch e As System.Exception exception = e Return False End Try End Function Public Overridable Overloads Sub SaveToFile(ByVal fileName As String) Dim streamWriter As System.IO.StreamWriter = Nothing Try Dim xmlString As String = Serialize() Dim xmlFile As System.IO.FileInfo = New System.IO.FileInfo(fileName) streamWriter = xmlFile.CreateText streamWriter.WriteLine(xmlString) streamWriter.Close() Finally If (Not (streamWriter) Is Nothing) Then streamWriter.Dispose() End If End Try End Sub ''' '''Deserializes xml markup from file into an WarningMessages object ''' '''string xml file to load and deserialize '''Output WarningMessages object '''output Exception value if deserialize failed '''true if this XmlSerializer can deserialize the object; otherwise, false Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As WarningMessages, ByRef exception As System.Exception) As Boolean exception = Nothing obj = CType(Nothing, WarningMessages) Try obj = LoadFromFile(fileName) Return True Catch ex As System.Exception exception = ex Return False End Try End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As WarningMessages) As Boolean Dim exception As System.Exception = Nothing Return LoadFromFile(fileName, obj, exception) End Function Public Overloads Shared Function LoadFromFile(ByVal fileName As String) As WarningMessages Dim file As System.IO.FileStream = Nothing Dim sr As System.IO.StreamReader = Nothing Try file = New System.IO.FileStream(fileName, FileMode.Open, FileAccess.Read) sr = New System.IO.StreamReader(file) Dim xmlString As String = sr.ReadToEnd sr.Close() file.Close() Return Deserialize(xmlString) Finally If (Not (file) Is Nothing) Then file.Dispose() End If If (Not (sr) Is Nothing) Then sr.Dispose() End If End Try End Function #End Region End Class End Namespace