public static LogicCommand DecodeCommand(ByteStream stream) { LogicCommand command = LogicCommandManager.CreateCommand((LogicCommandType)stream.ReadInt()); if (command == null) { Debugger.Warning("LogicCommandManager::decodeCommand() - command is null"); } else { command.Decode(stream); } return(command); }
public static LogicCommand LoadCommandFromJSON(LogicJSONObject jsonObject) { LogicJSONNumber jsonNumber = jsonObject.GetJSONNumber("ct"); if (jsonNumber == null) { Debugger.Error("loadCommandFromJSON - Unknown command type"); } else { LogicCommand command = LogicCommandManager.CreateCommand((LogicCommandType)jsonNumber.GetIntValue()); if (command != null) { command.LoadFromJSON(jsonObject.GetJSONObject("c")); } return(command); } return(null); }