Exemplo n.º 1
0
        public T DeserializeObjectFromString(string data, StringSerializationFormat format, bool useProtobuffer)
        {
            byte[] byteData = null;
            switch (format)
            {
            case StringSerializationFormat.Base64:
                byteData = Convert.FromBase64String(data);
                break;

            case StringSerializationFormat.Hex:
                byteData = GeneralConverters.HexStringToByteArray(data);
                break;

            default:
                throw new ArgumentOutOfRangeException("format");
            }

            return(useProtobuffer ? this.DeserializeProtoBufferObjectDataInternal(byteData) : this.DeserializeBinaryFormatterObjectDataInternal(byteData));
        }