
Originally Posted by
Quackster
Any code snippets? :)
Code:
public class Users
{
public int ID;
public int Credits;
public int Activity_Points;
public int Rank;
public int AchievementPoints;
public string Username;
public string Motto;
public string Look;
public string Gender;
public static Dictionary<string, Users> AllUsers = new Dictionary<string, Users>();
public static void Parse()
{
DataTable Data = Environment.StorageConnection.ReadDataTable("SELECT * FROM users");
foreach (DataRow Row in Data.Rows)
{
Users User = new Users();
User.ID = (int)Row["id"];
User.Credits = (int)Row["credits"];
User.Activity_Points = (int)Row["activity_points"];
User.Rank = (int)Row["rank"];
User.AchievementPoints = (int)Row["vip_points"];
User.Username = Row["username"].ToString();
User.Motto = Row["motto"].ToString();
User.Look = Row["look"].ToString();
User.Gender = Row["gender"].ToString();
AllUsers.Add(Row["auth_ticket"].ToString(), User);
}
Environment.Logging.WriteLine(string.Format("Succesfully parsed {0} User(s)!", AllUsers.Count), Core.Logging.Status.Database);
}
}
Code:
private void OnReceive(IAsyncResult ias)
{
try
{
int Length = base.EndReceive(ias);
if (Length < 6)
{
throw new Exception("Connection closed");
}
byte[] ReceivedBytes = new byte[Length];
Array.Copy(Buffer, ReceivedBytes, Length);
if (ReceivedBytes[0] == 60)
{
this.Send("<?xml version=\"1.0\"?> " +
"<!DOCTYPE cross-domain-policy SYSTEM \"/xml/dtds/cross-domain-policy.dtd\"> " +
"<cross-domain-policy> " +
"<allow-access-from domain=\"*\" to-ports=\"*\" /> " +
"</cross-domain-policy>\x0");
}
else
{
Environment.GameClientManager.GetGameClientById(Id).HandlePacket(ReceivedBytes);
}
}
catch
{
this.Destroy();
}
finally
{
this.WaitForData();
}
}
More will come later. Got also some packet structures to find out (I've been lazy lately).
Will get a brand new laptop this wednesday (for my birthday, which IS wednesday) which will be quicker then this pc so then I will backup everything + move it to my laptop and continue project on laptop.
User authentication works, users table from Phoenix (people would like that).
Not much is coded, I know, had kinda 'problems' with sql (well.. more stupidness)..