public void Delete(T[] models, OnSuccessAction onDeleteSuccessAction, OnFailedAction onDeleteFailedAction) { var formData = new Dictionary <string, string>(); formData.Add("records", models.SerializeJson()); formData.Add("primary_keys", JSON.JSONWriter.ToJson(_primaryKeys)); MakerWOWApi.DoPostRequest(formData, CrudType.Delete.ToString().ToLower() + "&table=" + _tableName, (IWebRequest result) => { var apiResult = new ApiAction(result.Json); if (apiResult.IsError) { onDeleteFailedAction(apiResult); } else { _models.Remove(models); onDeleteSuccessAction(apiResult); } }, (WebContextException error) => { MakerWOWApi.FireOnError(new ApiException(1, "Could not update models.", error)); }); }
private static void Main(string[] args) { MakerWOWApi.Initialize <WindowsWebContext>(); MakerWOWApi.OnError += MakerWOWApi_OnError; MakerWOWApi.Login("*****@*****.**", "9751058aA2", onLoginSuccess, OnCrudFailed); }
private static void Main(string[] args) { MakerWOWApi.Initialize <WindowsWebContext>(); _engine = new ClientEngine <SocketSession, Client <SocketSession> >("127.0.0.1", 3456); _engine.Start(); Console.Write("Username: "******"Password: "); string password = Console.ReadLine(); Login(_engine.ServerSession, username, password); }
public override void ProcessCommand(SessionCommand sessionCommand) { switch (sessionCommand.CurrentCommand.CommandType) { case DataTypes.CommandType.None: Debugger.Print("Processing command: None"); break; case DataTypes.CommandType.Login: Debugger.Print("Processing command: Login"); MakerWOWApi.Login(sessionCommand, (string)sessionCommand.CurrentCommand.Arguments[0], (string)sessionCommand.CurrentCommand.Arguments[1], onLoginSuccess, onLoginFailed); break; case DataTypes.CommandType.Logout: Debugger.Print("Processing command: Logout"); MakerWOWApi.Logout(sessionCommand, onLogoutSuccess, onLogoutFailed); break; case DataTypes.CommandType.StartWorld: Debugger.Print("Processing command: StartWorld"); break; case DataTypes.CommandType.StopWorld: Debugger.Print("Processing command: StopWorld"); break; case DataTypes.CommandType.World: Debugger.Print("Processing command: World"); break; case DataTypes.CommandType.Lobby: Debugger.Print("Processing command: Lobby"); foreach (var client in _clients.Values) { _networkController.Networker.Send(client, sessionCommand.CurrentCommand.ToBytes()); } break; case DataTypes.CommandType.Editor: Debugger.Print("Processing command: Editor"); break; default: break; } }
public void Read(OnGetSuccessAction <T> onReadSuccessAction, OnFailedAction onReadFailedAction, Dictionary <string, string> filter = null) { MakerWOWApi.DoGetRequest(CrudType.Read.ToString().ToLower() + "&" + ((filter != null) ? filter.FormSerialize() : string.Empty) + "&table=" + _tableName, (IWebRequest result) => { var apiResult = new ApiResult <T>(result.Json); if (apiResult.IsError) { onReadFailedAction(apiResult); } else { _models.Combine(apiResult.Records); onReadSuccessAction(apiResult.Records, apiResult); } }, (WebContextException error) => { MakerWOWApi.FireOnError(new ApiException(1, "Could not read models.", error)); }); }
public ServerEngine(string ipAddress, int port) : base(ipAddress, port) { MakerWOWApi.Initialize <WindowsWebContext>(); _clients = new Dictionary <int, Session>(); }