Ejemplo n.º 1
0
        private static BlockParameter GetBlockParameter(string value)
        {
            if (string.IsNullOrWhiteSpace(value))
            {
                return(new BlockParameter(BlockParameterType.Latest));
            }

            return(BlockParameter.FromJson(value));
        }
Ejemplo n.º 2
0
        protected TParam Deserialize <TParam>(string parameter, IJsonSerializer serializer)
        {
            // use BlockParamConverter instead...
            if (typeof(TParam) == typeof(BlockParameter))
            {
                BlockParameter blockParameter = new BlockParameter();
                blockParameter.FromJson(parameter);
                return((TParam)Convert.ChangeType(blockParameter, typeof(TParam)));
            }

            return(serializer.Deserialize <TParam>(parameter));
        }
Ejemplo n.º 3
0
        protected TParam Deserialize <TParam>(object parameter, IJsonSerializer serializer)
        {
            var parameterString = parameter is string?$"\"{parameter}\"" : parameter?.ToString();

            // use BlockParamConverter instead...
            if (typeof(TParam) == typeof(BlockParameter))
            {
                BlockParameter blockParameter = BlockParameter.FromJson(parameter as string);
                return((TParam)Convert.ChangeType(blockParameter, typeof(TParam)));
            }

            return(parameterString == null ? default : serializer.Deserialize <TParam>(parameterString));
        }
Ejemplo n.º 4
0
        private static BlockParameter GetBlockParameter(string value)
        {
            if (string.IsNullOrWhiteSpace(value))
            {
                return(new BlockParameter
                {
                    Type = BlockParameterType.Latest
                });
            }

            var block = new BlockParameter();

            block.FromJson(value);

            return(block);
        }