2734 lines
106 KiB
VB.net
2734 lines
106 KiB
VB.net
'' ------------------------------------------------------------------------------
|
|
'' <auto-generated>
|
|
'' Generated by Xsd2Code. Version 3.4.1.33667 Microsoft Reciprocal License (Ms-RL)
|
|
'' <NameSpace>MicMetadata</NameSpace><Collection>List</Collection><codeType>VisualBasic</codeType><EnableDataBinding>False</EnableDataBinding><EnableLazyLoading>False</EnableLazyLoading><TrackingChangesEnable>False</TrackingChangesEnable><GenTrackingClasses>False</GenTrackingClasses><HidePrivateFieldInIDE>False</HidePrivateFieldInIDE><EnableSummaryComment>False</EnableSummaryComment><VirtualProp>False</VirtualProp><IncludeSerializeMethod>True</IncludeSerializeMethod><UseBaseClass>False</UseBaseClass><GenBaseClass>False</GenBaseClass><GenerateCloneMethod>False</GenerateCloneMethod><GenerateDataContracts>False</GenerateDataContracts><CodeBaseTag>Net40</CodeBaseTag><SerializeMethodName>Serialize</SerializeMethodName><DeserializeMethodName>Deserialize</DeserializeMethodName><SaveToFileMethodName>SaveToFile</SaveToFileMethodName><LoadFromFileMethodName>LoadFromFile</LoadFromFileMethodName><GenerateXMLAttributes>False</GenerateXMLAttributes><OrderXMLAttrib>False</OrderXMLAttrib><EnableEncoding>False</EnableEncoding><AutomaticProperties>False</AutomaticProperties><GenerateShouldSerialize>False</GenerateShouldSerialize><DisableDebug>False</DisableDebug><PropNameSpecified>Default</PropNameSpecified><Encoder>UTF8</Encoder><CustomUsings></CustomUsings><ExcludeIncludedTypes>False</ExcludeIncludedTypes><EnableInitializeFields>True</EnableInitializeFields>
|
|
'' </auto-generated>
|
|
'' ------------------------------------------------------------------------------
|
|
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 MicMetadata
|
|
|
|
Partial Public Class TMicMetadata
|
|
|
|
Private connectionIdField As String
|
|
|
|
Private partnerIdField As String
|
|
|
|
Private dateTimeField As Date
|
|
|
|
Private Shared sSerializer As System.Xml.Serialization.XmlSerializer
|
|
|
|
Public Property connectionId() As String
|
|
Get
|
|
Return Me.connectionIdField
|
|
End Get
|
|
Set
|
|
Me.connectionIdField = 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 dateTime() As Date
|
|
Get
|
|
Return Me.dateTimeField
|
|
End Get
|
|
Set
|
|
Me.dateTimeField = 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(TMicMetadata))
|
|
End If
|
|
Return sSerializer
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Serialize/Deserialize"
|
|
'''<summary>
|
|
'''Serializes current TMicMetadata object into an XML document
|
|
'''</summary>
|
|
'''<returns>string XML value</returns>
|
|
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
|
|
|
|
'''<summary>
|
|
'''Deserializes workflow markup into an TMicMetadata object
|
|
'''</summary>
|
|
'''<param name="xml">string workflow markup to deserialize</param>
|
|
'''<param name="obj">Output TMicMetadata object</param>
|
|
'''<param name="exception">output Exception value if deserialize failed</param>
|
|
'''<returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String, ByRef obj As TMicMetadata, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TMicMetadata)
|
|
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 TMicMetadata) 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 TMicMetadata
|
|
Dim stringReader As System.IO.StringReader = Nothing
|
|
Try
|
|
stringReader = New System.IO.StringReader(xml)
|
|
Return CType(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader)), TMicMetadata)
|
|
Finally
|
|
If (Not (stringReader) Is Nothing) Then
|
|
stringReader.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Serializes current TMicMetadata object into file
|
|
'''</summary>
|
|
'''<param name="fileName">full path of outupt xml file</param>
|
|
'''<param name="exception">output Exception value if failed</param>
|
|
'''<returns>true if can serialize and save into file; otherwise, false</returns>
|
|
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
|
|
|
|
'''<summary>
|
|
'''Deserializes xml markup from file into an TMicMetadata object
|
|
'''</summary>
|
|
'''<param name="fileName">string xml file to load and deserialize</param>
|
|
'''<param name="obj">Output TMicMetadata object</param>
|
|
'''<param name="exception">output Exception value if deserialize failed</param>
|
|
'''<returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TMicMetadata, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TMicMetadata)
|
|
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 TMicMetadata) 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 TMicMetadata
|
|
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 TMessageDetail
|
|
|
|
Private messageIdField As String
|
|
|
|
Private partyIdField As String
|
|
|
|
Private transactionIdField As String
|
|
|
|
Private sequenceNumField As String
|
|
|
|
Private actionCodeField As TActionCode
|
|
|
|
Private Shared sSerializer As System.Xml.Serialization.XmlSerializer
|
|
|
|
Public Sub New()
|
|
MyBase.New
|
|
Me.actionCodeField = New TActionCode()
|
|
End Sub
|
|
|
|
Public Property messageId() As String
|
|
Get
|
|
Return Me.messageIdField
|
|
End Get
|
|
Set
|
|
Me.messageIdField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property partyId() As String
|
|
Get
|
|
Return Me.partyIdField
|
|
End Get
|
|
Set
|
|
Me.partyIdField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property transactionId() As String
|
|
Get
|
|
Return Me.transactionIdField
|
|
End Get
|
|
Set
|
|
Me.transactionIdField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property sequenceNum() As String
|
|
Get
|
|
Return Me.sequenceNumField
|
|
End Get
|
|
Set
|
|
Me.sequenceNumField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property ActionCode() As TActionCode
|
|
Get
|
|
Return Me.actionCodeField
|
|
End Get
|
|
Set
|
|
Me.actionCodeField = 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(TMessageDetail))
|
|
End If
|
|
Return sSerializer
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Serialize/Deserialize"
|
|
'''<summary>
|
|
'''Serializes current TMessageDetail object into an XML document
|
|
'''</summary>
|
|
'''<returns>string XML value</returns>
|
|
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
|
|
|
|
'''<summary>
|
|
'''Deserializes workflow markup into an TMessageDetail object
|
|
'''</summary>
|
|
'''<param name="xml">string workflow markup to deserialize</param>
|
|
'''<param name="obj">Output TMessageDetail object</param>
|
|
'''<param name="exception">output Exception value if deserialize failed</param>
|
|
'''<returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String, ByRef obj As TMessageDetail, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TMessageDetail)
|
|
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 TMessageDetail) 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 TMessageDetail
|
|
Dim stringReader As System.IO.StringReader = Nothing
|
|
Try
|
|
stringReader = New System.IO.StringReader(xml)
|
|
Return CType(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader)), TMessageDetail)
|
|
Finally
|
|
If (Not (stringReader) Is Nothing) Then
|
|
stringReader.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Serializes current TMessageDetail object into file
|
|
'''</summary>
|
|
'''<param name="fileName">full path of outupt xml file</param>
|
|
'''<param name="exception">output Exception value if failed</param>
|
|
'''<returns>true if can serialize and save into file; otherwise, false</returns>
|
|
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
|
|
|
|
'''<summary>
|
|
'''Deserializes xml markup from file into an TMessageDetail object
|
|
'''</summary>
|
|
'''<param name="fileName">string xml file to load and deserialize</param>
|
|
'''<param name="obj">Output TMessageDetail object</param>
|
|
'''<param name="exception">output Exception value if deserialize failed</param>
|
|
'''<returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TMessageDetail, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TMessageDetail)
|
|
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 TMessageDetail) 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 TMessageDetail
|
|
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 TActionCode
|
|
|
|
Private codeField As String
|
|
|
|
Private parameterField As List(Of TActionCodeParameter)
|
|
|
|
Private Shared sSerializer As System.Xml.Serialization.XmlSerializer
|
|
|
|
Public Sub New()
|
|
MyBase.New
|
|
Me.parameterField = New List(Of TActionCodeParameter)()
|
|
End Sub
|
|
|
|
Public Property code() As String
|
|
Get
|
|
Return Me.codeField
|
|
End Get
|
|
Set
|
|
Me.codeField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property parameter() As List(Of TActionCodeParameter)
|
|
Get
|
|
Return Me.parameterField
|
|
End Get
|
|
Set
|
|
Me.parameterField = 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(TActionCode))
|
|
End If
|
|
Return sSerializer
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Serialize/Deserialize"
|
|
'''<summary>
|
|
'''Serializes current TActionCode object into an XML document
|
|
'''</summary>
|
|
'''<returns>string XML value</returns>
|
|
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
|
|
|
|
'''<summary>
|
|
'''Deserializes workflow markup into an TActionCode object
|
|
'''</summary>
|
|
'''<param name="xml">string workflow markup to deserialize</param>
|
|
'''<param name="obj">Output TActionCode object</param>
|
|
'''<param name="exception">output Exception value if deserialize failed</param>
|
|
'''<returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String, ByRef obj As TActionCode, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TActionCode)
|
|
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 TActionCode) 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 TActionCode
|
|
Dim stringReader As System.IO.StringReader = Nothing
|
|
Try
|
|
stringReader = New System.IO.StringReader(xml)
|
|
Return CType(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader)), TActionCode)
|
|
Finally
|
|
If (Not (stringReader) Is Nothing) Then
|
|
stringReader.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Serializes current TActionCode object into file
|
|
'''</summary>
|
|
'''<param name="fileName">full path of outupt xml file</param>
|
|
'''<param name="exception">output Exception value if failed</param>
|
|
'''<returns>true if can serialize and save into file; otherwise, false</returns>
|
|
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
|
|
|
|
'''<summary>
|
|
'''Deserializes xml markup from file into an TActionCode object
|
|
'''</summary>
|
|
'''<param name="fileName">string xml file to load and deserialize</param>
|
|
'''<param name="obj">Output TActionCode object</param>
|
|
'''<param name="exception">output Exception value if deserialize failed</param>
|
|
'''<returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TActionCode, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TActionCode)
|
|
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 TActionCode) 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 TActionCode
|
|
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 TActionCodeParameter
|
|
|
|
Private keyField As String
|
|
|
|
Private valueField As String
|
|
|
|
Private Shared sSerializer As System.Xml.Serialization.XmlSerializer
|
|
|
|
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(TActionCodeParameter))
|
|
End If
|
|
Return sSerializer
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Serialize/Deserialize"
|
|
'''<summary>
|
|
'''Serializes current TActionCodeParameter object into an XML document
|
|
'''</summary>
|
|
'''<returns>string XML value</returns>
|
|
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
|
|
|
|
'''<summary>
|
|
'''Deserializes workflow markup into an TActionCodeParameter object
|
|
'''</summary>
|
|
'''<param name="xml">string workflow markup to deserialize</param>
|
|
'''<param name="obj">Output TActionCodeParameter object</param>
|
|
'''<param name="exception">output Exception value if deserialize failed</param>
|
|
'''<returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String, ByRef obj As TActionCodeParameter, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TActionCodeParameter)
|
|
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 TActionCodeParameter) 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 TActionCodeParameter
|
|
Dim stringReader As System.IO.StringReader = Nothing
|
|
Try
|
|
stringReader = New System.IO.StringReader(xml)
|
|
Return CType(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader)), TActionCodeParameter)
|
|
Finally
|
|
If (Not (stringReader) Is Nothing) Then
|
|
stringReader.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Serializes current TActionCodeParameter object into file
|
|
'''</summary>
|
|
'''<param name="fileName">full path of outupt xml file</param>
|
|
'''<param name="exception">output Exception value if failed</param>
|
|
'''<returns>true if can serialize and save into file; otherwise, false</returns>
|
|
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
|
|
|
|
'''<summary>
|
|
'''Deserializes xml markup from file into an TActionCodeParameter object
|
|
'''</summary>
|
|
'''<param name="fileName">string xml file to load and deserialize</param>
|
|
'''<param name="obj">Output TActionCodeParameter object</param>
|
|
'''<param name="exception">output Exception value if deserialize failed</param>
|
|
'''<returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TActionCodeParameter, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TActionCodeParameter)
|
|
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 TActionCodeParameter) 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 TActionCodeParameter
|
|
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 TStatus
|
|
|
|
Private statusField As TStatusStatus
|
|
|
|
Private itemField As Object
|
|
|
|
Private itemElementNameField As ItemChoiceType
|
|
|
|
Private Shared sSerializer As System.Xml.Serialization.XmlSerializer
|
|
|
|
Public Property status() As TStatusStatus
|
|
Get
|
|
Return Me.statusField
|
|
End Get
|
|
Set
|
|
Me.statusField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlChoiceIdentifierAttribute("ItemElementName")>
|
|
Public Property Item() As Object
|
|
Get
|
|
Return Me.itemField
|
|
End Get
|
|
Set
|
|
Me.itemField = Value
|
|
End Set
|
|
End Property
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property ItemElementName() As ItemChoiceType
|
|
Get
|
|
Return Me.itemElementNameField
|
|
End Get
|
|
Set
|
|
Me.itemElementNameField = 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(TStatus))
|
|
End If
|
|
Return sSerializer
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Serialize/Deserialize"
|
|
'''<summary>
|
|
'''Serializes current TStatus object into an XML document
|
|
'''</summary>
|
|
'''<returns>string XML value</returns>
|
|
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
|
|
|
|
'''<summary>
|
|
'''Deserializes workflow markup into an TStatus object
|
|
'''</summary>
|
|
'''<param name="xml">string workflow markup to deserialize</param>
|
|
'''<param name="obj">Output TStatus object</param>
|
|
'''<param name="exception">output Exception value if deserialize failed</param>
|
|
'''<returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String, ByRef obj As TStatus, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TStatus)
|
|
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 TStatus) 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 TStatus
|
|
Dim stringReader As System.IO.StringReader = Nothing
|
|
Try
|
|
stringReader = New System.IO.StringReader(xml)
|
|
Return CType(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader)), TStatus)
|
|
Finally
|
|
If (Not (stringReader) Is Nothing) Then
|
|
stringReader.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Serializes current TStatus object into file
|
|
'''</summary>
|
|
'''<param name="fileName">full path of outupt xml file</param>
|
|
'''<param name="exception">output Exception value if failed</param>
|
|
'''<returns>true if can serialize and save into file; otherwise, false</returns>
|
|
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
|
|
|
|
'''<summary>
|
|
'''Deserializes xml markup from file into an TStatus object
|
|
'''</summary>
|
|
'''<param name="fileName">string xml file to load and deserialize</param>
|
|
'''<param name="obj">Output TStatus object</param>
|
|
'''<param name="exception">output Exception value if deserialize failed</param>
|
|
'''<returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TStatus, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TStatus)
|
|
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 TStatus) 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 TStatus
|
|
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
|
|
|
|
Public Enum TStatusStatus
|
|
|
|
'''<remarks/>
|
|
OK
|
|
|
|
'''<remarks/>
|
|
[ERROR]
|
|
|
|
'''<remarks/>
|
|
WARNING
|
|
End Enum
|
|
|
|
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"
|
|
'''<summary>
|
|
'''Serializes current ErrorMessages object into an XML document
|
|
'''</summary>
|
|
'''<returns>string XML value</returns>
|
|
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
|
|
|
|
'''<summary>
|
|
'''Deserializes workflow markup into an ErrorMessages object
|
|
'''</summary>
|
|
'''<param name="xml">string workflow markup to deserialize</param>
|
|
'''<param name="obj">Output ErrorMessages object</param>
|
|
'''<param name="exception">output Exception value if deserialize failed</param>
|
|
'''<returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
|
|
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
|
|
|
|
'''<summary>
|
|
'''Serializes current ErrorMessages object into file
|
|
'''</summary>
|
|
'''<param name="fileName">full path of outupt xml file</param>
|
|
'''<param name="exception">output Exception value if failed</param>
|
|
'''<returns>true if can serialize and save into file; otherwise, false</returns>
|
|
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
|
|
|
|
'''<summary>
|
|
'''Deserializes xml markup from file into an ErrorMessages object
|
|
'''</summary>
|
|
'''<param name="fileName">string xml file to load and deserialize</param>
|
|
'''<param name="obj">Output ErrorMessages object</param>
|
|
'''<param name="exception">output Exception value if deserialize failed</param>
|
|
'''<returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
|
|
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"
|
|
'''<summary>
|
|
'''Serializes current TErrorMessageType object into an XML document
|
|
'''</summary>
|
|
'''<returns>string XML value</returns>
|
|
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
|
|
|
|
'''<summary>
|
|
'''Deserializes workflow markup into an TErrorMessageType object
|
|
'''</summary>
|
|
'''<param name="xml">string workflow markup to deserialize</param>
|
|
'''<param name="obj">Output TErrorMessageType object</param>
|
|
'''<param name="exception">output Exception value if deserialize failed</param>
|
|
'''<returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
|
|
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
|
|
|
|
'''<summary>
|
|
'''Serializes current TErrorMessageType object into file
|
|
'''</summary>
|
|
'''<param name="fileName">full path of outupt xml file</param>
|
|
'''<param name="exception">output Exception value if failed</param>
|
|
'''<returns>true if can serialize and save into file; otherwise, false</returns>
|
|
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
|
|
|
|
'''<summary>
|
|
'''Deserializes xml markup from file into an TErrorMessageType object
|
|
'''</summary>
|
|
'''<param name="fileName">string xml file to load and deserialize</param>
|
|
'''<param name="obj">Output TErrorMessageType object</param>
|
|
'''<param name="exception">output Exception value if deserialize failed</param>
|
|
'''<returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
|
|
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
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
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"
|
|
'''<summary>
|
|
'''Serializes current TReference object into an XML document
|
|
'''</summary>
|
|
'''<returns>string XML value</returns>
|
|
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
|
|
|
|
'''<summary>
|
|
'''Deserializes workflow markup into an TReference object
|
|
'''</summary>
|
|
'''<param name="xml">string workflow markup to deserialize</param>
|
|
'''<param name="obj">Output TReference object</param>
|
|
'''<param name="exception">output Exception value if deserialize failed</param>
|
|
'''<returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
|
|
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
|
|
|
|
'''<summary>
|
|
'''Serializes current TReference object into file
|
|
'''</summary>
|
|
'''<param name="fileName">full path of outupt xml file</param>
|
|
'''<param name="exception">output Exception value if failed</param>
|
|
'''<returns>true if can serialize and save into file; otherwise, false</returns>
|
|
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
|
|
|
|
'''<summary>
|
|
'''Deserializes xml markup from file into an TReference object
|
|
'''</summary>
|
|
'''<param name="fileName">string xml file to load and deserialize</param>
|
|
'''<param name="obj">Output TReference object</param>
|
|
'''<param name="exception">output Exception value if deserialize failed</param>
|
|
'''<returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
|
|
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"
|
|
'''<summary>
|
|
'''Serializes current TErrorDetail object into an XML document
|
|
'''</summary>
|
|
'''<returns>string XML value</returns>
|
|
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
|
|
|
|
'''<summary>
|
|
'''Deserializes workflow markup into an TErrorDetail object
|
|
'''</summary>
|
|
'''<param name="xml">string workflow markup to deserialize</param>
|
|
'''<param name="obj">Output TErrorDetail object</param>
|
|
'''<param name="exception">output Exception value if deserialize failed</param>
|
|
'''<returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
|
|
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
|
|
|
|
'''<summary>
|
|
'''Serializes current TErrorDetail object into file
|
|
'''</summary>
|
|
'''<param name="fileName">full path of outupt xml file</param>
|
|
'''<param name="exception">output Exception value if failed</param>
|
|
'''<returns>true if can serialize and save into file; otherwise, false</returns>
|
|
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
|
|
|
|
'''<summary>
|
|
'''Deserializes xml markup from file into an TErrorDetail object
|
|
'''</summary>
|
|
'''<param name="fileName">string xml file to load and deserialize</param>
|
|
'''<param name="obj">Output TErrorDetail object</param>
|
|
'''<param name="exception">output Exception value if deserialize failed</param>
|
|
'''<returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
|
|
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"
|
|
'''<summary>
|
|
'''Serializes current TErrorDetailAdditionalDetails object into an XML document
|
|
'''</summary>
|
|
'''<returns>string XML value</returns>
|
|
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
|
|
|
|
'''<summary>
|
|
'''Deserializes workflow markup into an TErrorDetailAdditionalDetails object
|
|
'''</summary>
|
|
'''<param name="xml">string workflow markup to deserialize</param>
|
|
'''<param name="obj">Output TErrorDetailAdditionalDetails object</param>
|
|
'''<param name="exception">output Exception value if deserialize failed</param>
|
|
'''<returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
|
|
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
|
|
|
|
'''<summary>
|
|
'''Serializes current TErrorDetailAdditionalDetails object into file
|
|
'''</summary>
|
|
'''<param name="fileName">full path of outupt xml file</param>
|
|
'''<param name="exception">output Exception value if failed</param>
|
|
'''<returns>true if can serialize and save into file; otherwise, false</returns>
|
|
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
|
|
|
|
'''<summary>
|
|
'''Deserializes xml markup from file into an TErrorDetailAdditionalDetails object
|
|
'''</summary>
|
|
'''<param name="fileName">string xml file to load and deserialize</param>
|
|
'''<param name="obj">Output TErrorDetailAdditionalDetails object</param>
|
|
'''<param name="exception">output Exception value if deserialize failed</param>
|
|
'''<returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
|
|
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"
|
|
'''<summary>
|
|
'''Serializes current WarningMessages object into an XML document
|
|
'''</summary>
|
|
'''<returns>string XML value</returns>
|
|
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
|
|
|
|
'''<summary>
|
|
'''Deserializes workflow markup into an WarningMessages object
|
|
'''</summary>
|
|
'''<param name="xml">string workflow markup to deserialize</param>
|
|
'''<param name="obj">Output WarningMessages object</param>
|
|
'''<param name="exception">output Exception value if deserialize failed</param>
|
|
'''<returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
|
|
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
|
|
|
|
'''<summary>
|
|
'''Serializes current WarningMessages object into file
|
|
'''</summary>
|
|
'''<param name="fileName">full path of outupt xml file</param>
|
|
'''<param name="exception">output Exception value if failed</param>
|
|
'''<returns>true if can serialize and save into file; otherwise, false</returns>
|
|
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
|
|
|
|
'''<summary>
|
|
'''Deserializes xml markup from file into an WarningMessages object
|
|
'''</summary>
|
|
'''<param name="fileName">string xml file to load and deserialize</param>
|
|
'''<param name="obj">Output WarningMessages object</param>
|
|
'''<param name="exception">output Exception value if deserialize failed</param>
|
|
'''<returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
|
|
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
|
|
|
|
Partial Public Class TMetaReference
|
|
|
|
Private correlationIdField As String
|
|
|
|
Private companyField As String
|
|
|
|
Private plantField As String
|
|
|
|
Private referenceTypeField As String
|
|
|
|
Private referenceSidField As Long
|
|
|
|
Private referenceSidFieldSpecified As Boolean
|
|
|
|
Private Shared sSerializer As System.Xml.Serialization.XmlSerializer
|
|
|
|
Public Property correlationId() As String
|
|
Get
|
|
Return Me.correlationIdField
|
|
End Get
|
|
Set
|
|
Me.correlationIdField = Value
|
|
End Set
|
|
End Property
|
|
|
|
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 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
|
|
|
|
<System.Xml.Serialization.XmlIgnoreAttribute()>
|
|
Public Property referenceSidSpecified() As Boolean
|
|
Get
|
|
Return Me.referenceSidFieldSpecified
|
|
End Get
|
|
Set
|
|
Me.referenceSidFieldSpecified = 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(TMetaReference))
|
|
End If
|
|
Return sSerializer
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Serialize/Deserialize"
|
|
'''<summary>
|
|
'''Serializes current TMetaReference object into an XML document
|
|
'''</summary>
|
|
'''<returns>string XML value</returns>
|
|
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
|
|
|
|
'''<summary>
|
|
'''Deserializes workflow markup into an TMetaReference object
|
|
'''</summary>
|
|
'''<param name="xml">string workflow markup to deserialize</param>
|
|
'''<param name="obj">Output TMetaReference object</param>
|
|
'''<param name="exception">output Exception value if deserialize failed</param>
|
|
'''<returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String, ByRef obj As TMetaReference, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TMetaReference)
|
|
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 TMetaReference) 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 TMetaReference
|
|
Dim stringReader As System.IO.StringReader = Nothing
|
|
Try
|
|
stringReader = New System.IO.StringReader(xml)
|
|
Return CType(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader)), TMetaReference)
|
|
Finally
|
|
If (Not (stringReader) Is Nothing) Then
|
|
stringReader.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Serializes current TMetaReference object into file
|
|
'''</summary>
|
|
'''<param name="fileName">full path of outupt xml file</param>
|
|
'''<param name="exception">output Exception value if failed</param>
|
|
'''<returns>true if can serialize and save into file; otherwise, false</returns>
|
|
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
|
|
|
|
'''<summary>
|
|
'''Deserializes xml markup from file into an TMetaReference object
|
|
'''</summary>
|
|
'''<param name="fileName">string xml file to load and deserialize</param>
|
|
'''<param name="obj">Output TMetaReference object</param>
|
|
'''<param name="exception">output Exception value if deserialize failed</param>
|
|
'''<returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TMetaReference, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TMetaReference)
|
|
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 TMetaReference) 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 TMetaReference
|
|
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
|
|
|
|
Public Enum ItemChoiceType
|
|
|
|
'''<remarks/>
|
|
<System.Xml.Serialization.XmlEnumAttribute("urn:http://www.mic-cust.com/MicErrorWarningMessage/5.2:ErrorMessages")>
|
|
ErrorMessages
|
|
|
|
'''<remarks/>
|
|
<System.Xml.Serialization.XmlEnumAttribute("urn:http://www.mic-cust.com/MicErrorWarningMessage/5.2:WarningMessages")>
|
|
WarningMessages
|
|
|
|
'''<remarks/>
|
|
Reference
|
|
End Enum
|
|
|
|
Partial Public Class StatusMessage
|
|
|
|
Private metadataField As TMicMetadata
|
|
|
|
Private messageDetailField As TMessageDetail
|
|
|
|
Private statusField As TStatus
|
|
|
|
Private Shared sSerializer As System.Xml.Serialization.XmlSerializer
|
|
|
|
Public Sub New()
|
|
MyBase.New
|
|
Me.statusField = New TStatus()
|
|
Me.messageDetailField = New TMessageDetail()
|
|
Me.metadataField = New TMicMetadata()
|
|
End Sub
|
|
|
|
Public Property Metadata() As TMicMetadata
|
|
Get
|
|
Return Me.metadataField
|
|
End Get
|
|
Set
|
|
Me.metadataField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property MessageDetail() As TMessageDetail
|
|
Get
|
|
Return Me.messageDetailField
|
|
End Get
|
|
Set
|
|
Me.messageDetailField = Value
|
|
End Set
|
|
End Property
|
|
|
|
Public Property Status() As TStatus
|
|
Get
|
|
Return Me.statusField
|
|
End Get
|
|
Set
|
|
Me.statusField = 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(StatusMessage))
|
|
End If
|
|
Return sSerializer
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Serialize/Deserialize"
|
|
'''<summary>
|
|
'''Serializes current StatusMessage object into an XML document
|
|
'''</summary>
|
|
'''<returns>string XML value</returns>
|
|
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
|
|
|
|
'''<summary>
|
|
'''Deserializes workflow markup into an StatusMessage object
|
|
'''</summary>
|
|
'''<param name="xml">string workflow markup to deserialize</param>
|
|
'''<param name="obj">Output StatusMessage object</param>
|
|
'''<param name="exception">output Exception value if deserialize failed</param>
|
|
'''<returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String, ByRef obj As StatusMessage, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, StatusMessage)
|
|
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 StatusMessage) 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 StatusMessage
|
|
Dim stringReader As System.IO.StringReader = Nothing
|
|
Try
|
|
stringReader = New System.IO.StringReader(xml)
|
|
Return CType(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader)), StatusMessage)
|
|
Finally
|
|
If (Not (stringReader) Is Nothing) Then
|
|
stringReader.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Serializes current StatusMessage object into file
|
|
'''</summary>
|
|
'''<param name="fileName">full path of outupt xml file</param>
|
|
'''<param name="exception">output Exception value if failed</param>
|
|
'''<returns>true if can serialize and save into file; otherwise, false</returns>
|
|
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
|
|
|
|
'''<summary>
|
|
'''Deserializes xml markup from file into an StatusMessage object
|
|
'''</summary>
|
|
'''<param name="fileName">string xml file to load and deserialize</param>
|
|
'''<param name="obj">Output StatusMessage object</param>
|
|
'''<param name="exception">output Exception value if deserialize failed</param>
|
|
'''<returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As StatusMessage, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, StatusMessage)
|
|
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 StatusMessage) 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 StatusMessage
|
|
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 TStatusResponse
|
|
|
|
Private statusField As TStatus
|
|
|
|
Private Shared sSerializer As System.Xml.Serialization.XmlSerializer
|
|
|
|
Public Sub New()
|
|
MyBase.New
|
|
Me.statusField = New TStatus()
|
|
End Sub
|
|
|
|
Public Property Status() As TStatus
|
|
Get
|
|
Return Me.statusField
|
|
End Get
|
|
Set
|
|
Me.statusField = 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(TStatusResponse))
|
|
End If
|
|
Return sSerializer
|
|
End Get
|
|
End Property
|
|
|
|
#Region "Serialize/Deserialize"
|
|
'''<summary>
|
|
'''Serializes current TStatusResponse object into an XML document
|
|
'''</summary>
|
|
'''<returns>string XML value</returns>
|
|
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
|
|
|
|
'''<summary>
|
|
'''Deserializes workflow markup into an TStatusResponse object
|
|
'''</summary>
|
|
'''<param name="xml">string workflow markup to deserialize</param>
|
|
'''<param name="obj">Output TStatusResponse object</param>
|
|
'''<param name="exception">output Exception value if deserialize failed</param>
|
|
'''<returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function Deserialize(ByVal xml As String, ByRef obj As TStatusResponse, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TStatusResponse)
|
|
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 TStatusResponse) 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 TStatusResponse
|
|
Dim stringReader As System.IO.StringReader = Nothing
|
|
Try
|
|
stringReader = New System.IO.StringReader(xml)
|
|
Return CType(Serializer.Deserialize(System.Xml.XmlReader.Create(stringReader)), TStatusResponse)
|
|
Finally
|
|
If (Not (stringReader) Is Nothing) Then
|
|
stringReader.Dispose()
|
|
End If
|
|
End Try
|
|
End Function
|
|
|
|
'''<summary>
|
|
'''Serializes current TStatusResponse object into file
|
|
'''</summary>
|
|
'''<param name="fileName">full path of outupt xml file</param>
|
|
'''<param name="exception">output Exception value if failed</param>
|
|
'''<returns>true if can serialize and save into file; otherwise, false</returns>
|
|
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
|
|
|
|
'''<summary>
|
|
'''Deserializes xml markup from file into an TStatusResponse object
|
|
'''</summary>
|
|
'''<param name="fileName">string xml file to load and deserialize</param>
|
|
'''<param name="obj">Output TStatusResponse object</param>
|
|
'''<param name="exception">output Exception value if deserialize failed</param>
|
|
'''<returns>true if this XmlSerializer can deserialize the object; otherwise, false</returns>
|
|
Public Overloads Shared Function LoadFromFile(ByVal fileName As String, ByRef obj As TStatusResponse, ByRef exception As System.Exception) As Boolean
|
|
exception = Nothing
|
|
obj = CType(Nothing, TStatusResponse)
|
|
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 TStatusResponse) 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 TStatusResponse
|
|
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
|