/*// OLD * public void SendTimeCommandOLD(string mac, string time, string buffer, int commandType) * { * string c = ""; * switch (commandType) * { * case 1: * // start time * c = commands[3] + "~" + time + "~" + buffer; * break; * case 2: * // pause time * c = commands[4] + "~" + time; * break; * case 3: * // stop time * c = commands[5] + "~0"; * break; * } * nt.DirectMessage(c, mac); * } * * public void SendTimeCommand(string mac, string time, string buffer, NetworkCommand.CommandTypes type) * { * NetworkCommand nc = new NetworkCommand(type, time, buffer); * nt.DirectMessage(nc.ToJson(), mac); * } * * public void SendNextBookingInfo(string mac, string displayName, string time, long startTime, bool forceUpdate) * { * // 0 = cmd, 1 = mac, 2 = next reservation name, 3 = next reservation time, 4 = start time (long), 5 = force update (bool) * //string msg = commands[8] + "~" + mac + "~" + displayName + "~" + time + "~" + startTime + "~" + forceUpdate; * //Console.WriteLine("Message: " + msg); * * * NetworkCommand nc = new NetworkCommand(NetworkCommand.CommandTypes.SimBookingInfoUpdate); * // 0 = nextReservationName, 1 = nextReservationTime, 2 = startTime (long), 3 = forceUpdate (bool) * string msg = displayName + "~" + time + "~" + startTime + "~" + forceUpdate; * nc.Message = msg; * nt.DirectMessage(nc.ToJson(), mac); * } * * public void SendUpdateSimInfo(string mac, string nickName, string model) * { * //string msg = commands[9] + "~" + mac + "~" + nickName + "~" + model; * NetworkCommand nc = new NetworkCommand(NetworkCommand.CommandTypes.SimInfoUpdate); * nc.Message = nickName; * nc.Value = model; * nt.DirectMessage(nc.ToJson(), mac); * } * * public void SendKeepAliveCommand(string mac) * { * //string m = commands[6] + "~1"; * NetworkCommand nc = new NetworkCommand(NetworkCommand.CommandTypes.KeepAlive); * nt.DirectMessage(nc.ToJson(), mac); * }*/ // Sim command public void SendGameRunningUpdateCommand(string mac, string gameName) { //string msg = commands[7] + "~" + input; //NetworkCommand nc = new NetworkCommand(NetworkCommand.CommandTypes.GameRunningUpdate, input, "value"); GameRunningUpdate gru = new GameRunningUpdate(mac, gameName); nt.SendMessage(gru.ToJson()); }
/*public void ReceiveCommand(NetworkCommand nc) * { * switch(nc.Type) * { * case NetworkCommand.CommandTypes.GameRunningUpdate: * //OnSimUpdateEvent(new SimUpdateEventArgs(cmd[1], cmd[2])); * // nc.Message = gameName * // nc.Value = start/end * OnSimUpdateEvent(new SimUpdateEventArgs(nc.MacAddress, nc.Message)); * break; * } * }*/ public void ReceiveCommand(MessageInterface m) { switch (m.Type) { case "GameRunningUpdate": GameRunningUpdate gru = (GameRunningUpdate)m; OnSimUpdateEvent(new SimUpdateEventArgs(gru.MACAddress, gru.GameName)); break; } }