Imports System.Xml
Imports System.IO

Public Class cGetMsgType

    Shared Function isNCTS_Versandanmeldung(lines() As String) As Boolean
        If lines.Count > 0 Then
            If lines(1).StartsWith("UNB+UNOC:") OrElse lines(0).StartsWith("UNB+UNOC:") Then
                If lines(2).StartsWith("UNH+1+CUSDEC:D:96B:UN:DETUDA") Or lines(1).StartsWith("UNH+1+CUSDEC:D:96B:UN:DETUDA") Or
                      lines(2).StartsWith("UNH+1+CUSDEC:D:96B:UN:DETUDB") Or lines(1).StartsWith("UNH+1+CUSDEC:D:96B:UN:DETUDB") Then
                    Return True
                End If
            End If
        End If

        Return False

    End Function

    Shared Function isEZA_FreierVerkehrAktVeredelUmwandlung(lines() As String) As Boolean
        If lines.Count > 0 Then
            If lines(1).StartsWith("UNB+UNOC:") OrElse lines(0).StartsWith("UNB+UNOC:") Then
                If lines(2).StartsWith("UNH+1+CUSDEC:D:96B:UN:FCFCDB") OrElse lines(1).StartsWith("UNH+1+CUSDEC:D:96B:UN:FCFCDB") Then
                    Return True
                End If
            End If
        End If

        Return False
    End Function

    Shared Function isNCTS_Ankunftsanzeige(lines() As String) As Boolean
        If lines.Count > 0 Then
            If lines(1).StartsWith("UNH+") Then
                If lines(1).Contains("CUSDEC:D:96B:UN:DETBAE") Then
                    Return True
                End If
            End If
        End If

        Return False
    End Function


    Shared Function isSumAErledigungsinformation(doc As XmlDocument, ByRef version As String) As Boolean
        If doc.HasChildNodes Then
            If doc.GetElementsByTagName("SumAErledigungsinformation").Count > 0 Then
                '<Version>005</Version>
                If doc.GetElementsByTagName("Version").Count > 0 Then
                    version = doc.GetElementsByTagName("Version")(0).InnerText
                End If

                Return True
            End If
        End If
        Return False
    End Function


    Shared Function isNCTS_Ueberlassungsmeldung(doc As XmlDocument, ByRef version As String) As Boolean
        If doc.HasChildNodes Then
            If doc.GetElementsByTagName("UeberlassungsmeldungNCTSDE").Count > 0 Then
                '<Version>005</Version>
                If doc.GetElementsByTagName("Version").Count > 0 Then
                    version = doc.GetElementsByTagName("Version")(0).InnerText
                End If

                Return True
            End If
        End If
        Return False
    End Function

    Shared Function isNCTS_AnrechnungReferenzbetraege(doc As XmlDocument, ByRef version As String) As Boolean
        If doc.HasChildNodes Then
            If doc.GetElementsByTagName("AnrechnungReferenzbetraegeNCTSDE").Count > 0 Then
                If doc.GetElementsByTagName("Version").Count > 0 Then
                    version = doc.GetElementsByTagName("Version")(0).InnerText
                End If
                Return True
            End If
        End If
        Return False
    End Function




    Shared Function isNCTS_StatusmeldungNCTSDE(doc As XmlDocument, ByRef version As String) As Boolean
        If doc.HasChildNodes Then
            If doc.GetElementsByTagName("StatusmeldungNCTSDE").Count > 0 Then
                If doc.GetElementsByTagName("Version").Count > 0 Then
                    version = doc.GetElementsByTagName("Version")(0).InnerText
                End If
                Return True
            End If
        End If
        Return False
    End Function


    Shared Function isNCTS_AT_TR100_Versandanmeldung(doc As XmlDocument) As Boolean
        If doc.HasChildNodes Then
            If doc.GetElementsByTagName("Msg").Count > 0 Then
                If doc.GetElementsByTagName("MsgTyp").Count > 0 Then 'EVTL noch eine Ebene tiefer
                    If doc.GetElementsByTagName("MsgTyp")(0).InnerText = "TR100" Then
                        Return True
                    End If
                End If
            End If
        End If
        Return False
    End Function



    Shared Function isNCTS_Erledigungsmeldung(doc As XmlDocument, ByRef version As String) As Boolean
        If doc.HasChildNodes Then
            If doc.GetElementsByTagName("ErledigungsmeldungNCTSDE").Count > 0 Then
                If doc.GetElementsByTagName("Version").Count > 0 Then
                    version = doc.GetElementsByTagName("Version")(0).InnerText
                End If
                Return True
            End If
        End If
        Return False
    End Function

    Shared Function isNCTS_Ereignismitteilung(doc As XmlDocument, ByRef version As String) As Boolean
        If doc.HasChildNodes Then
            If doc.GetElementsByTagName("EreignismitteilungNCTSDE").Count > 0 Then
                If doc.GetElementsByTagName("Version").Count > 0 Then
                    version = doc.GetElementsByTagName("Version")(0).InnerText
                End If
                Return True
            End If
        End If
        Return False
    End Function

    Shared Function isNCTS_UngueltigkeitSicherheitenNCTSDE(doc As XmlDocument, ByRef version As String) As Boolean
        If doc.HasChildNodes Then
            If doc.GetElementsByTagName("UngueltigkeitSicherheitenNCTSDE").Count > 0 Then

                If doc.GetElementsByTagName("Version").Count > 0 Then
                    version = doc.GetElementsByTagName("Version")(0).InnerText
                End If

                Return True
            End If
        End If
        Return False
    End Function

    Shared Function isNCTS_SumAVerwahrungsinfo(doc As XmlDocument, ByRef version As String) As Boolean
        If doc.HasChildNodes Then
            If doc.GetElementsByTagName("SumAVerwahrungsinfo").Count > 0 Then

                If doc.GetElementsByTagName("Version").Count > 0 Then
                    version = doc.GetElementsByTagName("Version")(0).InnerText
                End If

                Return True
            End If
        End If
        Return False
    End Function

    Shared Function isNCTS_SumABekanntgabeMassnahme(doc As XmlDocument, ByRef version As String) As Boolean
        If doc.HasChildNodes Then
            If doc.GetElementsByTagName("SumABekanntgabeMassnahme").Count > 0 Then

                If doc.GetElementsByTagName("Version").Count > 0 Then
                    version = doc.GetElementsByTagName("Version")(0).InnerText
                End If

                Return True
            End If
        End If
        Return False
    End Function


    Shared Function isAES_DEXPSD(doc As XmlDocument) As Boolean
        If doc.HasChildNodes Then
            '  If doc.GetElementsByTagName("DakosyMessageInternal").Count > 0 Then
            Dim sw = New StringWriter()
            Dim xw = New XmlTextWriter(sw)
            doc.WriteTo(xw)
            Dim XmlString = sw.ToString()
            If XmlString.Contains("<DEXPSD>") Then
                Return True
            End If
            'End If
        End If
        Return False
    End Function


    Shared Function isAES_DEXPNE(doc As XmlDocument) As Boolean
        If doc.HasChildNodes Then
            '  If doc.GetElementsByTagName("DakosyMessageInternal").Count > 0 Then
            Dim sw = New StringWriter()
            Dim xw = New XmlTextWriter(sw)
            doc.WriteTo(xw)
            Dim XmlString = sw.ToString()
            If XmlString.Contains("<DEXPNE>") Then
                Return True
            End If
            'End If
        End If
        Return False
    End Function

    Shared Function isAES_DEXPND(doc As XmlDocument) As Boolean
        If doc.HasChildNodes Then
            '  If doc.GetElementsByTagName("DakosyMessageInternal").Count > 0 Then
            Dim sw = New StringWriter()
            Dim xw = New XmlTextWriter(sw)
            doc.WriteTo(xw)
            Dim XmlString = sw.ToString()
            If XmlString.Contains("<DEXPND>") Then
                Return True
            End If
            'End If
        End If
        Return False
    End Function


    Shared Function isAES_DeliveryNotification(doc As XmlDocument) As Boolean
        If doc.HasChildNodes Then
            '  If doc.GetElementsByTagName("DakosyMessageInternal").Count > 0 Then
            Dim sw = New StringWriter()
            Dim xw = New XmlTextWriter(sw)
            doc.WriteTo(xw)
            Dim XmlString = sw.ToString()

            If XmlString.Contains("<![CDATA[DN - Delivery") Then
                Return True
            End If
            'End If
        End If
        Return False
    End Function



    Shared Function isAES_DEXPRD(doc As XmlDocument) As Boolean
        If doc.HasChildNodes Then
            '  If doc.GetElementsByTagName("DakosyMessageInternal").Count > 0 Then
            Dim sw = New StringWriter()
            Dim xw = New XmlTextWriter(sw)
            doc.WriteTo(xw)
            Dim XmlString = sw.ToString()
            If XmlString.Contains("<DEXPRD>") Then
                Return True
            End If
            'End If
        End If
        Return False
    End Function

    Shared Function isAES_DEXPRE(doc As XmlDocument) As Boolean
        If doc.HasChildNodes Then
            '  If doc.GetElementsByTagName("DakosyMessageInternal").Count > 0 Then
            Dim sw = New StringWriter()
            Dim xw = New XmlTextWriter(sw)
            doc.WriteTo(xw)
            Dim XmlString = sw.ToString()
            If XmlString.Contains("<DEXPRE>") Then
                Return True
            End If
            'End If
        End If
        Return False
    End Function


    Shared Function isAES_DEERRE(doc As XmlDocument) As Boolean
        If doc.HasChildNodes Then
            '  If doc.GetElementsByTagName("DakosyMessageInternal").Count > 0 Then
            Dim sw = New StringWriter()
            Dim xw = New XmlTextWriter(sw)
            doc.WriteTo(xw)
            Dim XmlString = sw.ToString()
            If XmlString.Contains("<DEERRE>") Then
                Return True
            End If
            'End If
        End If
        Return False
    End Function


    Shared Function isAES_DEXPCC(doc As XmlDocument) As Boolean
        If doc.HasChildNodes Then
            '  If doc.GetElementsByTagName("DakosyMessageInternal").Count > 0 Then
            Dim sw = New StringWriter()
            Dim xw = New XmlTextWriter(sw)
            doc.WriteTo(xw)
            Dim XmlString = sw.ToString()
            If XmlString.Contains("<DEXPCC>") Then
                Return True
            End If
            'End If
        End If
        Return False
    End Function




    Shared Function isEZA_EntscheidungAnmeldung(doc As XmlDocument) As Boolean
        If doc.HasChildNodes Then
            If doc.GetElementsByTagName("EntscheidungAnmeldung").Count > 0 Then
                Return True
            End If
        End If
        Return False
    End Function



    Shared Function isEZA_EntscheidungAnmeldung(doc As XmlDocument, ByRef VERSION As String) As Boolean
        If doc.HasChildNodes Then
            If doc.GetElementsByTagName("EntscheidungAnmeldung").Count > 0 Then
                If doc.GetElementsByTagName("Version").Count > 0 Then
                    VERSION = doc.GetElementsByTagName("Version")(0).InnerText
                End If
                Return True
            End If
        End If
        Return False
    End Function

    Shared Function isEZA_SumAErledigungsinformationVorpapier(doc As XmlDocument, ByRef VERSION As String) As Boolean
        If doc.HasChildNodes Then
            If doc.GetElementsByTagName("SumAErledigungsinformationVorpapier").Count > 0 Then
                If doc.GetElementsByTagName("Version").Count > 0 Then
                    VERSION = doc.GetElementsByTagName("Version")(0).InnerText
                End If
                Return True
            End If
        End If
        Return False
    End Function

    Shared Function isAES_DatenZumAusgang(doc As XmlDocument, ByRef VERSION As String) As Boolean
        If doc.HasChildNodes Then
            If doc.GetElementsByTagName("DataEXITDE").Count > 0 Then
                If doc.GetElementsByTagName("Version").Count > 0 Then
                    VERSION = doc.GetElementsByTagName("Version")(0).InnerText
                End If
                Return True
            End If
        End If
        Return False
    End Function
    Shared Function isAES_E_EXT_DAT(doc As XmlDocument) As Boolean
        If doc.HasChildNodes Then
            If doc.GetElementsByTagName("E_EXT_DAT").Count > 0 Then
                'If doc.GetElementsByTagName("Version").Count > 0 Then
                '    VERSION = doc.GetElementsByTagName("Version")(0).InnerText
                'End If
                Return True
            End If
        End If
        Return False
    End Function
    Shared Function isAES_E_EXP_FUP_DEXPFE(doc As XmlDocument) As Boolean
        If doc.HasChildNodes Then

            If doc.GetElementsByTagName("DEXPFE").Count > 0 Then
                'If doc.GetElementsByTagName("Version").Count > 0 Then
                '    VERSION = doc.GetElementsByTagName("Version")(0).InnerText
                'End If
                Return True
            End If
        End If
        Return False
    End Function

    Shared Function isEZA_SumAErledigungsinformationCDXWare(doc As XmlDocument, ByRef VERSION As String) As Boolean
        If doc.HasChildNodes Then
            If doc.GetElementsByTagName("SumAErledigungsinformationCDXWare").Count > 0 Then
                If doc.GetElementsByTagName("Version").Count > 0 Then
                    VERSION = doc.GetElementsByTagName("Version")(0).InnerText
                End If
                Return True
            End If
        End If
        Return False
    End Function


    Shared Function isEZA_SumAErledigungsinformationVorpapier(doc As XmlDocument) As Boolean
        If doc.HasChildNodes Then
            If doc.GetElementsByTagName("SumAErledigungsinformationVorpapier").Count > 0 Then
                Return True
            End If
        End If
        Return False
    End Function


    Shared Function isEZA_Abgabenbescheid(doc As XmlDocument, ByRef VERSION As String) As Boolean
        If doc.HasChildNodes Then
            If doc.GetElementsByTagName("Abgabenbescheid").Count > 0 Then
                If doc.GetElementsByTagName("Version").Count > 0 Then
                    VERSION = doc.GetElementsByTagName("Version")(0).InnerText
                End If
                Return True
            End If
        End If
        Return False
    End Function


    Shared Function isEZA_NichtAbschliessendeFestsetzung(doc As XmlDocument, ByRef VERSION As String) As Boolean
        If doc.HasChildNodes Then
            If doc.GetElementsByTagName("NichtAbschliessendeFestsetzung").Count > 0 Then
                If doc.GetElementsByTagName("Version").Count > 0 Then
                    VERSION = doc.GetElementsByTagName("Version")(0).InnerText
                End If
                Return True
            End If
        End If
        Return False
    End Function

    Shared Function isEZA_AbschliessendeFestsetzung(doc As XmlDocument, ByRef VERSION As String) As Boolean
        If doc.HasChildNodes Then
            If doc.GetElementsByTagName("AbschliessendeFestsetzung").Count > 0 Then
                If doc.GetElementsByTagName("Version").Count > 0 Then
                    VERSION = doc.GetElementsByTagName("Version")(0).InnerText
                End If
                Return True
            End If
        End If
        Return False
    End Function

    Shared Function isEZA_StornierungBescheid(doc As XmlDocument, ByRef VERSION As String) As Boolean
        If doc.HasChildNodes Then
            If doc.GetElementsByTagName("StornierungBescheid").Count > 0 Then
                If doc.GetElementsByTagName("Version").Count > 0 Then
                    VERSION = doc.GetElementsByTagName("Version")(0).InnerText
                End If
                Return True
            End If
        End If
        Return False
    End Function
    Shared Function isEZA_StornierungBescheid(doc As XmlDocument) As Boolean
        If doc.HasChildNodes Then
            If doc.GetElementsByTagName("StornierungBescheid").Count > 0 Then
                Return True
            End If
        End If
        Return False
    End Function

    Shared Function isEZA_BefundVereinfachteZollanmeldung(doc As XmlDocument, ByRef version As String) As Boolean
        If doc.HasChildNodes Then
            If doc.GetElementsByTagName("BefundVereinfachteZollanmeldung").Count > 0 Then
                If doc.GetElementsByTagName("Version").Count > 0 Then
                    version = doc.GetElementsByTagName("Version")(0).InnerText
                End If
                Return True
            End If
        End If
        Return False
    End Function

    Shared Function isAES_UeberlassungAusfuhr(doc As XmlDocument, ByRef version As String) As Boolean
        If doc.HasChildNodes Then
            If doc.GetElementsByTagName("UeberlassungAusfuhr").Count > 0 Then
                If doc.GetElementsByTagName("Version").Count > 0 Then
                    version = doc.GetElementsByTagName("Version")(0).InnerText
                End If
                Return True
            End If
        End If
        Return False
    End Function

    Shared Funct
    Shared Function isAES_BestaetigungAusfuhr(doc As XmlDocument, ByRef version As String) As Boolean
        If doc.HasChildNodes Then
            If doc.GetElementsByTagName("BestaetigungAusfuhr").Count > 0 Then
                If doc.GetElementsByTagName("Version").Count > 0 Then
                    version = doc.GetElementsByTagName("Version")(0).InnerText
                End If
                Return True
            End If
        End If
        Return False
    End Function

    Shared Function isEZA_MitteilungAbschreibung(doc As XmlDocument, ByRef version As String) As Boolean
        If doc.HasChildNodes Then
            If doc.GetElementsByTagName("MitteilungAbschreibung").Count > 0 Then
                If doc.GetElementsByTagName("Version").Count > 0 Then
                    version = doc.GetElementsByTagName("Version")(0).InnerText
                End If
                Return True
            End If
        End If
        Return False
    End Function

    Shared Function isEZA_WeitergabeHauptzollamt(doc As XmlDocument, ByRef version As String) As Boolean
        If doc.HasChildNodes Then
            If doc.GetElementsByTagName("WeitergabeHauptzollamt").Count > 0 Then
                If doc.GetElementsByTagName("Version").Count > 0 Then
                    version = doc.GetElementsByTagName("Version")(0).InnerText
                End If
                Return True
            End If
        End If
        Return False
    End Function

    Shared Function isEZA_FreierVerkehrAktVeredelUmwandlungXML(doc As XmlDocument) As Boolean
        If doc.HasChildNodes Then
            '  If doc.GetElementsByTagName("DakosyMessageInternal").Count > 0 Then
            Dim sw = New StringWriter()
            Dim xw = New XmlTextWriter(sw)
            doc.WriteTo(xw)
            Dim XmlString = sw.ToString()
            If XmlString.Contains("<FCFCDC>") Then

                Return True
            End If
            'End If
        End If
        Return False
    End Function
    Shared Function isEZA_FreierVerkehrAktVeredelUmwandlungXML_FCFCDD(doc As XmlDocument) As Boolean
        If doc.HasChildNodes Then
            '  If doc.GetElementsByTagName("DakosyMessageInternal").Count > 0 Then
            Dim sw = New StringWriter()
            Dim xw = New XmlTextWriter(sw)
            doc.WriteTo(xw)
            Dim XmlString = sw.ToString()
            If XmlString.Contains("<FCFCDD>") Then

                Return True
            End If
            'End If
        End If
        Return False
    End Function
    Shared Function isEZA_FreierVerkehrAktVeredelUmwandlungXML_FCFCDE(doc As XmlDocument) As Boolean
        If doc.HasChildNodes Then
            '  If doc.GetElementsByTagName("DakosyMessageInternal").Count > 0 Then
            Dim sw = New StringWriter()
            Dim xw = New XmlTextWriter(sw)
            doc.WriteTo(xw)
            Dim XmlString = sw.ToString()
            If XmlString.Contains("<FCFCDE>") Then

                Return True
            End If
            'End If
        End If
        Return False
    End Function

    Shared Function isEZA_FreierVerkehrAktVeredelUmwandlungXML_FCFCDF(doc As XmlDocument) As Boolean
        If doc.HasChildNodes Then
            '  If doc.GetElementsByTagName("DakosyMessageInternal").Count > 0 Then
            Dim sw = New StringWriter()
            Dim xw = New XmlTextWriter(sw)
            doc.WriteTo(xw)
            Dim XmlString = sw.ToString()
            If XmlString.Contains("<FCFCDF>") Then

                Return True
            End If
            'End If
        End If
        Return False
    End Function



    Shared Function isAES_DEXPDE(doc As XmlDocument) As Boolean
        If doc.HasChildNodes Then
            '  If doc.GetElementsByTagName("DakosyMessageInternal").Count > 0 Then
            Dim sw = New StringWriter()
            Dim xw = New XmlTextWriter(sw)
            doc.WriteTo(xw)
            Dim XmlString = sw.ToString()
            If XmlString.Contains("<DEXPDE>") Then

                Return True
            End If
            'End If
        End If
        Return False
    End Function


    Shared Function isAES_DEXPDF(doc As XmlDocument) As Boolean
        If doc.HasChildNodes Then
            '  If doc.GetElementsByTagName("DakosyMessageInternal").Count > 0 Then
            Dim sw = New StringWriter()
            Dim xw = New XmlTextWriter(sw)
            doc.WriteTo(xw)
            Dim XmlString = sw.ToString()
            If XmlString.Contains("<DEXPDF>") Then

                Return True
            End If
            'End If
        End If
        Return False
    End Function
    Shared Function isAES_DEXPDD(doc As XmlDocument) As Boolean
        If doc.HasChildNodes Then
            '  If doc.GetElementsByTagName("DakosyMessageInternal").Count > 0 Then
            Dim sw = New StringWriter()
            Dim xw = New XmlTextWriter(sw)
            doc.WriteTo(xw)
            Dim XmlString = sw.ToString()
            If XmlString.Contains("<DEXPDD>") Then

                Return True
            End If
            'End If
        End If
        Return False
    End Function

    Shared Function isNCTS_GenerellesEreignis(doc As XmlDocument, ByRef version As String) As Boolean
        If doc.HasChildNodes Then
            If doc.GetElementsByTagName("GenerellesEreignis").Count > 0 Then
                If doc.GetElementsByTagName("Version").Count > 0 Then
                    version = doc.GetElementsByTagName("Version")(0).InnerText
                End If
                Return True
            End If
        End If
        Return False
    End Function

    Shared Function isNCTS_QuittungEingangsverarbeitung(doc As XmlDocument, ByRef version As String) As Boolean
        If doc.HasChildNodes Then
            If doc.GetElementsByTagName("QuittungEingangsverarbeitung").Count > 0 Then
                If doc.GetElementsByTagName("Version").Count > 0 Then
                    version = doc.GetElementsByTagName("Version")(0).InnerText
                End If
                Return True
            End If
        End If
        Return False
    End Function

    Shared Function isVERAG_KD(doc As XmlDocument) As Boolean
        If doc.HasChildNodes Then
            If doc.GetElementsByTagName("VERAG_Kundenstamm_IMPORT").Count > 0 Then
                Return True
            End If
        End If
        Return False
    End Function


    Shared Function isAES_VollstaendigeAusfuhr(doc As XmlDocument) As Boolean
        If doc.HasChildNodes Then
            If doc.GetElementsByTagName("DEXPDD").Count > 0 Then
                Return True
            End If
        End If
        Return False
    End Function

    Shared Function isNCTS_VersandanmeldungXML(doc As XmlDocument) As Boolean
        If doc.HasChildNodes Then
            If doc.GetElementsByTagName("DETUDC").Count > 0 Then
                Return True
            End If
        End If
        Return False
    End Function

    Shared Function isNCTS_VersandanmeldungXML_DETPDD(doc As XmlDocument) As Boolean
        If doc.HasChildNodes Then
            If doc.GetElementsByTagName("DETPDD").Count > 0 Then
                Return True
            End If
        End If
        Return False
    End Function

    Shared Function isNCTS_VersandanmeldungXML_DETPRH(doc As XmlDocument) As Boolean
        If doc.HasChildNodes Then
            If doc.GetElementsByTagName("DETPRH").Count > 0 Then
                Return True
            End If
        End If
        Return False
    End Function

    Shared Function isNCTS_AnkunftsanzeigeXML(doc As XmlDocument) As Boolean
        If doc.HasChildNodes Then
            If doc.GetElementsByTagName("DETBAE").Count > 0 Then
                Return True
            End If
        End If
        Return False
    End Function

    Shared Function isNCTS_Versandbestaetigung(doc As XmlDocument, ByRef version As String) As Boolean
        If doc.HasChildNodes Then
            If doc.GetElementsByTagName("VersandbestaetigungNCTSDE").Count > 0 Then
                If doc.GetElementsByTagName("Version").Count > 0 Then
                    version = doc.GetElementsByTagName("Version")(0).InnerText
                End If
                Return True
            End If
        End If
        Return False
    End Function

    Shared Function isTC_Anmeldung2(doc As XmlDocument) As Boolean
        '<vifDec>
        If doc.HasChildNodes Then
            If doc.GetElementsByTagName("vifDec").Count > 0 Then
                Return True
            End If
        End If
        Return False

        'If doc.HasChildNodes Then
        '    If doc.GetElementsByTagName("interfaceData").Count > 0 Then
        '        If doc.GetElementsByTagName("interfaceData")(0).InnerXml.ToString.Contains("vifDec") Then
        '            Return True
        '        End If
        '    End If
        'End If

        'Return False
    End Function
    Shared Function isTC_Anmeldung(doc As XmlDocument) As Boolean
        If doc.HasChildNodes Then
            If doc.GetElementsByTagName("vifDec").Count > 0 Then
                Return True
            End If
        End If
        'If doc.HasChildNodes Then
        '    If doc.GetElementsByTagName("interfaceData").Count > 0 Then
        '        MsgBox("O1")
        '        If doc.GetElementsByTagName("interfaceData")(0).InnerXml.ToString.Contains("vifDec") Then
        '            MsgBox("O2")
        '            Return True
        '        End If
        '    End If
        'End If

        'Return False
    End Function

    Shared Function isPLOSE_Detail(doc As String) As Boolean
        Dim lines() As String = System.IO.File.ReadAllLines(doc)
        If lines.Count > 0 Then
            If lines(0).ToString.Replace("""", "").StartsWith("TR5") Or (lines.Count > 1 AndAlso (lines(0).ToString.Replace("""", "").StartsWith("TR1") And lines(1).ToString.Replace("""", "").StartsWith("TR5"))) Then
                Return True
            End If
        End If
        Return False
    End Function

    Shared Function isPLOSE_NewFormat_TR(doc As String) As Boolean
        Dim lines() As String = System.IO.File.ReadAllLines(doc)
        If lines.Count > 0 Then
            If lines(0).ToString.Replace("""", "").StartsWith("CustomerCode") AndAlso lines(0).ToString.Contains("ServiceDescription") AndAlso lines(0).ToString.Contains("ItalianDocNumber") Then
                Return True
            End If
        End If
        Return False
    End Function

    Shared Function isPLOSE_NewFormat_INV(doc As String) As Boolean
        Dim lines() As String = System.IO.File.ReadAllLines(doc)
        If lines.Count > 0 Then
            If lines(0).ToString.Replace("""", "").StartsWith("CustomerCode") AndAlso lines(0).ToString.Contains("DocumentNumber") AndAlso lines(0).ToString.Contains("PdfFileName") AndAlso doc.ToUpper.Contains("RDOC") Then
                Return True
            End If
        End If
        Return False
    End Function
    Shared Function isPLOSE_Header(doc As String) As Boolean
        Dim lines() As String = System.IO.File.ReadAllLines(doc)
        If lines.Count > 0 Then
            If lines(0).ToString.Replace("""", "").StartsWith("TR6") Then
                Return True
            End If
        End If
        Return False
    End Function
    Shared Function isPLOSE_INVData(doc As String) As Boolean
        Dim lines() As String = System.IO.File.ReadAllLines(doc)

        If lines.Count > 0 Then
            If lines(0).ToString.Replace("""", "").StartsWith("PloseCode") Then
                Return True
            End If
        End If
        Return False
    End Function


End Class
