public NetStreamStorage EncodeValueWithType(object input) { // First encode value type: NetStreamType valueType = GetNetStreamType(input); EncodeType(valueType); // Second encode data: switch (valueType) { case NetStreamType.Boolean: case NetStreamType.Byte: case NetStreamType.Short: case NetStreamType.Int: case NetStreamType.Long: case NetStreamType.Float: case NetStreamType.Double: return(EncodeNative(input)); case NetStreamType.String: return(EncodeString((string)input)); case NetStreamType.BooleanArray: case NetStreamType.ByteArray: case NetStreamType.ShortArray: case NetStreamType.IntArray: case NetStreamType.LongArray: case NetStreamType.FloatArray: case NetStreamType.DoubleArray: case NetStreamType.Array: return(EncodeArray((Array)input)); case NetStreamType.Null: return(this); default: return(null); } }
/** * @param input * @return MemoryStream with encoded struct in it */ public NetStreamStorage EncodeType(NetStreamType input) { return EncodeNative((byte) input); }
/** * @param input * @return MemoryStream with encoded struct in it */ public NetStreamStorage EncodeType(NetStreamType input) { return(EncodeNative((byte)input)); }