Imports Newtonsoft.Json

Friend Class Program

    Public Shared Sub Main(ByVal args() As String)
        'System.Console.WriteLine(EAN13CodeGenerator("858500248192"))
        'System.Console.ReadLine()
        'Exit Sub

        Dim _ScannerModule As New Scanner.Module.CSharp.ScannerModule

        Dim _SimpleAnswerJSON As String

        Dim _SimpleQueryJSON As String
        Dim _SimpleQuery As New SimpleQuery
        _SimpleQuery.Database = "pcs_318Y"
        _SimpleQuery.Password = "SysAdmin"
        _SimpleQuery.UserName = "SysAdmin"
        _SimpleQuery.Query = "DX_InsertStorageOutRows_dxDataGrid;5997359136281;617C139C-56E5-418B-A462-61E8579D3E69;1"

        _SimpleQueryJSON = JsonConvert.SerializeObject(_SimpleQuery)


        _SimpleAnswerJSON = _ScannerModule.GetInfo(_SimpleQueryJSON)

        System.Console.WriteLine(_SimpleAnswerJSON)
        System.Console.ReadLine()
    End Sub
    Private Shared Function EAN13CodeGenerator(BodyText As String) As String
        If BodyText.Length <> 12 Then
            Return String.Empty
        End If

        Dim _ReturnValue As String = String.Empty

        Dim _MyInteger As Integer = 0
        For i As Integer = 0 To 10 Step 2
            _MyInteger += Integer.Parse(BodyText.Substring(i, 1))
        Next

        For i As Integer = 1 To 11 Step 2
            _MyInteger += Integer.Parse(BodyText.Substring(i, 1)) * 3
        Next
        _MyInteger = _MyInteger Mod 10

        If _MyInteger = 0 Then
            _MyInteger = 10
        End If
        _MyInteger = 10 - _MyInteger

        _ReturnValue = BodyText & _MyInteger
        Return _ReturnValue
    End Function

End Class
