|
-
Aug 10th, 2006, 09:25 PM
#1
Thread Starter
Hyperactive Member
[2.0] Socket DataArrival
Here is a small section i'm working on that i just cant seem to figure out...
Now dont have a Stroke here just because i have the VB.NET Code posted..Just showing the section of Code i'm translating to C#..
VB Code:
Private Sub Socket_DataArrival(ByVal eventSender As System.Object, ByVal eventArgs As AxMSWinsockLib.DMSWinsockControlEvents_DataArrivalEvent) Handles Socket.DataArrival
Dim Index As Short = Socket.GetIndex(eventSender)
Socket(Index).GetData(Buffer(Index))
Debug.Print(Buffer(Index))
If Mid(Buffer(Index), 12, 1) = "W" Then
Sessionkey(Index) = Mid(Buffer(Index), 17, 4)
ChallengeString(Index) = Mid(Buffer(Index), 30 + Len(ClientID(Index)), Len(Buffer(Index)) - 29)
ChallengeString(Index) = Replace(ChallengeString(Index), "�13�1�", "")
Call GetStrings(ClientID(Index), Password(Index), ChallengeString(Index), Crypt1(Index), Crypt2(Index), 1)
Socket(Index).SendData(Login(ClientID(Index), Crypt1(Index), Crypt2(Index), Sessionkey(Index)))
ElseIf Mid(Buffer(Index), 12, 1) = "T" Then
statz.Items.Item(1).Text = ClientID(Index) & ""
Socket(Index).Close()
ElseIf Mid(Buffer(Index), 12, 1) = "U" Then
ListView1.Items.Item(Index).SubItems.Add(1)
Sessionkey(Index) = Mid(Buffer(Index), 17, 4)
statz.Items.Item(2).Text = CStr(CDbl(statz.Items.Item(2).Text) + 1)
statz.Items.Item(1).Text = "Status: " & ClientID(Index) & ""
End If
End Sub
Here is the Section of C# that i have done so far,that only produces a few errors,but i'm sure i'v messed up some where's along the line..
VB Code:
private void Socket_DataArrival(object sender, EventArgs e)
{
short index;
newsock.Receive(buffer, 0, SocketFlags.None);
if (String.Format(LoginMod.LoginMod.Buffer[index], 12, 1) == "W")
LoginMod.LoginMod.SessionKey[index] = String.Format("{17}, {4}", LoginMod.LoginMod.Buffer[index]);
LoginMod.LoginMod.ChallengeString[index] = String.Format("{30},{4}", LoginMod.LoginMod.Buffer[index],
Convert.ToChar(LoginMod.LoginMod.ClientID[index]),
Convert.ToChar(Convert.ToByte(LoginMod.LoginMod.Buffer[index]) - 29));
LoginMod.LoginMod.ChallengeString[index] = String.Format(LoginMod.LoginMod.ChallengeString[index], "�13�1�", "");
LoginMod.LoginMod.GetStrings(ref ClientID, ref Password, ref Seed, ref Str1, ref Str2, ref mode);
string YahooID = LoginMod.LoginMod.ClientID[index];
string Password = LoginMod.LoginMod.Password[index];
string ChallengeString = LoginMod.LoginMod.ChallengeString[index];
string Crypt1 = LoginMod.LoginMod.Crypt1[index];
string Crypt2 = LoginMod.LoginMod.Crypt2[index];
int mode = 1;
}
The only section that is producing errors is the LoginMod.LoginMod.GetStrings where the "ref Seed, ref Str1, ref Str2, & ref mode" Now what i think is just weird is that they Exist in the LoginMod.cs under the " public static bool GetStrings( ) "..But they dont show up in the intelli-sence like ClientID and Password does..
And yes i have Completed all the C# code compared to whats their in VB.NET,for me its fix them as i get them..Instead of trying to fix a boat load of stuff..
Last edited by Rattlerr; Aug 10th, 2006 at 10:02 PM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|