Results 1 to 5 of 5

Thread: How convert to VB.NET?

  1. #1

    Thread Starter
    New Member
    Join Date
    Jan 2012
    Posts
    12

    How convert to VB.NET?

    http://snipplr.com/view/48906/
    C#:
    Code:
    a += (uint)(url[k + 0] + (url[k + 1] << 8) + (url[k + 2] << 16) + (url[k + 3] << 24));
    How convert to VB.NET?

  2. #2
    PowerPoster
    Join Date
    Sep 2006
    Location
    Egypt
    Posts
    2,579

    Re: How convert to VB.NET?

    Try this site to convert C# to VB.NET



  3. #3

    Thread Starter
    New Member
    Join Date
    Jan 2012
    Posts
    12

    Re: How convert to VB.NET?

    Code:
    a = a + CType((url((k + 0)) + ((url((k + 1)) << 8) + ((url((k + 2)) << 16) + (url((k + 3)) << 24)))), UInteger)
    Operator '<<' is not defined for types 'Char' and 'Integer'.

  4. #4
    Karen Payne MVP kareninstructor's Avatar
    Join Date
    Jun 2008
    Location
    Oregon
    Posts
    6,714

    Re: How convert to VB.NET?

    Try the following for conversion, of course you need assign values appropriately to the variables being used.

    Code:
    Dim url() As Integer = {}
    Dim a As Long
    Dim k As Integer
    a += CUInt(url(k + 0) + (url(k + 1) << 8) + (url(k + 2) << 16) + (url(k + 3) << 24))

  5. #5

    Thread Starter
    New Member
    Join Date
    Jan 2012
    Posts
    12

    Re: How convert to VB.NET?

    url - String

    http://snipplr.com/view/48906/

    C#:
    Code:
    private static string GoogleChecksum(string url){
    uint GoogleMagic = 0xE6359A60;
    uint a, b;
    uint c = GoogleMagic;
    a = b = 0x9E3779B9;
    int k = 0;
    int length = url.Length;
    //Algorithm
    while (length >= 12){
    a += (uint)(url[k + 0] + (url[k + 1] << 8) + (url[k + 2] << 16) + (url[k + 3] << 24));
    ...
    My VB.NET:
    Code:
     Private Shared Function GoogleChecksum(ByVal url As String) As String
            Dim GoogleMagic As UInteger = 3862272608
            Dim b As UInteger
            Dim a As UInteger
            Dim c As UInteger = GoogleMagic
            b = 2654435769
            a = 2654435769
            Dim k As Integer = 0
            Dim length As Integer = url.Length
            'Algorithm
            While (length >= 12)
            a = a + CType((url((k + 0)) + ((url((k + 1)) << 8) + ((url((k + 2)) << 16) + (url((k + 3)) << 24)))), UInteger)
            ...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width