Exemplo n.º 1
0
        IGangCommand IGangCommandExecutor <TStateData> .Deserialize(
            byte[] bytes, GangAudit audit
            )
        {
            var wrapper = _serialization.Deserialize <GangCommandWrapper>(bytes);

            if (!_handlers.ContainsKey(wrapper.Type))
            {
                throw new GangCommandHandlerNotFoundExcetion();
            }

            var type = _handlers[wrapper.Type].DataType;

            return(GangCommand.From(
                       _serialization.Map(wrapper.Data, type),
                       audit));
        }
Exemplo n.º 2
0
        GangTokenData IGangTokenService.TryDecode(string token)
        {
            if (string.IsNullOrWhiteSpace(token))
            {
                return(null);
            }

            var tokenParts = token.Split('.');

            if (tokenParts.Length != 2)
            {
                return(null);
            }

            var data = tokenParts[0];

            return(_serializationService
                   .Deserialize <GangTokenData>(Base64Decode(data)));
        }
Exemplo n.º 3
0
 public static T Deserialize <T>(
     this IGangSerializationService service, byte[] value)
 {
     return((T)service.Deserialize(value, typeof(T)));
 }