public static Object Main(string operation, params object[] args) { if (args.Length > 0) { if (operation == "create") { byte[] id = (byte[])args[0]; BigInteger suit = (BigInteger)args[1]; BigInteger value = (BigInteger)args[2]; bool isPlayed = (bool)args[3]; PlayCard.Card card = new PlayCard.Card { id = id, suit = PlayCard.BigInteger2Suit(suit), value = PlayCard.BigInteger2Value(value), isPlayed = isPlayed }; SaveCard(card); return(card); } if (operation == "get") { byte[] id = (byte[])args[0]; return(ReadCard(id)); } return(false); } return(false); }
public static PlayCard.Card Bytes2Card(byte[] data) { if (data.Length == 0) { return(null); } PlayCard.Card card = new PlayCard.Card { id = data.SplitTbl(0), suit = PlayCard.BigInteger2Suit(data.SplitTblInt(1)), value = PlayCard.BigInteger2Value(data.SplitTblInt(2)), isPlayed = data.SplitTblBool(3) }; return(card); }