Example #1
0
        public static PlayerMessage ReadFrom(System.IO.BinaryReader reader)
        {
            if (reader == null)
            {
                throw new System.ArgumentNullException(nameof(reader));
            }

            switch (reader.ReadInt32())
            {
            case DebugMessage.TAG:
                return(DebugMessage.ReadFrom(reader));

            case ActionMessage.TAG:
                return(ActionMessage.ReadFrom(reader));

            default:
                throw new System.Exception("Unexpected discriminant value");
            }
        }
Example #2
0
        public static ClientMessage ReadFrom(System.IO.BinaryReader reader)
        {
            switch (reader.ReadInt32())
            {
            case DebugMessage.TAG:
                return(DebugMessage.ReadFrom(reader));

            case ActionMessage.TAG:
                return(ActionMessage.ReadFrom(reader));

            case DebugUpdateDone.TAG:
                return(DebugUpdateDone.ReadFrom(reader));

            case RequestDebugState.TAG:
                return(RequestDebugState.ReadFrom(reader));

            default:
                throw new System.Exception("Unexpected tag value");
            }
        }