Hi!
Flex.Net is a framework to make simple and flexible server.
You must write only write server response to a DLL and let Flex.Net handle clients requests.
Example of a DLL
public class PacketHandler
{
public Mysql MysqlConn;
public PacketHandler()
{
MysqlConn = new Mysql();
MysqlConn.Connect("127.0.0.1", 3306, "root", "123456", "unity");
MysqlConn.GetClient();
}
public MethodResponse LOGIN(object username, object password)
{
bool response = false;
DataRow Row = MysqlConn.ReadDataRow("SELECT * FROM users where username = '" + username + "' AND password = '" + password + "'");
MethodResponse MethodResponse = new MethodResponse(false); //true if you want to send response to all clients
if (Row != null)
{
response = true;
MethodResponse.AddData((Convert.ToInt32(response)).ToString());
MethodResponse.AddData(Row["id"].ToString());
}
else
MethodResponse.AddData((Convert.ToInt32(response)).ToString());
return MethodResponse;
}
public MethodResponse LIST_CHARS(object user_id)
{
DataTable Table;
Table = MysqlConn.ReadDataTable("SELECT * FROM characters where user_id = '" + user_id + "'");
if (Table != null)
{
MethodResponse MethodResponse = new MethodResponse(false);
foreach (DataRow Row in Table.Rows)
{
MethodResponse.AddData(Row["char_name"].ToString());
}
return MethodResponse;
}
return null;
}
}
Screenshot:
If you just add a code like this
public class WebserviceHandler : IWebservice
{
public int GetCpu()
{
return (int)Math.Round(PacketHandler.cpuCounter.NextValue(), 0);
}
}
[ServiceContract]
public interface IWebservice
{
[OperationContract]
int GetCpu();
}
you can have your own server panel and display what you want
Screenshot:
Let me know what do you think and how to improve it. Thanks