Skip to content

Instantly share code, notes, and snippets.

@AHartTN
Created July 25, 2011 04:15
Show Gist options
  • Save AHartTN/1103549 to your computer and use it in GitHub Desktop.
Save AHartTN/1103549 to your computer and use it in GitHub Desktop.
Create Empire Parameters Object
// This gets converted into a json hash.
public class CreateEmpireParms
{
public string name;
public string password;
public string password1;
public string captcha_guid;
public string captcha_solution;
public string email;
public string facebook_uid;
public string facebook_token;
public string invite_code;
public object[] parms
{
get
{
return new object[] { name, password, password1, captcha_guid, captcha_solution, email, facebook_uid, facebook_token, invite_code };
}
}
}
// which gets passed through via CreateEmpireParms.parms to this class
public class Post : JSON
{
public string method;
public object[] parms;
public Post(string action, object[] parm)
{
jsonrpc = "2.0";
id = 1;
method = action;
parms = parm;
}
public new string ToString()
{
return Traffic.Serialize(this).Replace("parms", "params");
}
}
// which inherits this class
public class JSON
{
public string jsonrpc { get; set; }
public int id { get; set; }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment