[Mono-devel-list] VB ... Very difficult to translate to C# !!!

Daniel Morgan danielmorgan at verizon.net
Thu Jul 8 20:20:26 EDT 2004


You could do like I do when I come across stuff written in VB.NET.  Make
it an class library assembly out of it.  Reference it in your C#
project.  Ta da!  I did this with the ghostscript vb.net code I found
for creating PDFs.  Unless, you do not have a Windows machine.

-----Original Message-----
From: mono-devel-list-admin at lists.ximian.com
[mailto:mono-devel-list-admin at lists.ximian.com] On Behalf Of Alessandro
Torrisi
Sent: Thursday, July 08, 2004 11:28 AM
To: mono-devel-list at lists.ximian.com
Subject: [Mono-devel-list] VB ... Very difficult to translate to C# !!!


Do you know how can I translate this in C# code ???
I have very difficulties...

========================================================================
====

Public Class DCUtils
 
    Public Function LockToKey(ByVal Lck As String) As String
        Dim h As Integer, j As Integer, n As Integer
        n = 5
 
        h = InStr(1, Lck, " ")
        If h Then Lck = Left$(Lck, h - 1)
 
        h = Asc(Lck) Xor Asc(Right$(Lck, 1)) Xor Asc(Right$(Lck, 2)) Xor
n
        h = (h \ 16) Xor (h * 16)
 
        Do While h > 255
            h = h - 256
        Loop
 
        Select Case h
            Case 0, 5, 36, 96, 124, 126
                LockToKey = "/%DCN" & Right$("00" & CStr(h), 3) & "%/"
            Case Else
                LockToKey = Chr(h)
        End Select
 
        For j = 2 To Len(Lck)
            h = Asc(Mid$(Lck, j, 1)) Xor Asc(Mid$(Lck, j - 1, 1))
            h = (h \ 16) Xor (h * 16)
 
            Do While h > 255
                h = h - 256
            Loop
 
            Select Case h
                Case 0, 5, 36, 96, 124, 126
                    LockToKey = LockToKey & "/%DCN" & Right$("00" &
CStr(h), 3) & "%/"
                Case Else
                    LockToKey = LockToKey & Chr(h)
            End Select
        Next
    End Function
 
End Class

========================================================================
====

Please help ME !!! Alex.
P.S. Compiling it with MBAS it took some error !!! 

_______________________________________________
Mono-devel-list mailing list
Mono-devel-list at lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list




More information about the Mono-devel-list mailing list