예제 #1
0
        public static string ToJson(List <Models.Block> blocks, BlockContent include, bool FormatIntended)
        {
            var options = new JsonSerializerOptions
            {
                WriteIndented = FormatIntended,
            };

            options.Converters.Add(new JsonConverters.HashConverter());
            options.Converters.Add(new JsonConverters.PublicKeyConverter());
            options.Converters.Add(new JsonConverters.SignatureConverter());
            options.Converters.Add(new JsonConverters.MoneyConverter());
            options.Converters.Add(new JsonConverters.BytesConverter());
            options.Converters.Add(new JsonConverters.UserFieldBytesConverter());
            options.Converters.Add(new JsonConverters.UserFieldMoneyConverter());
            options.Converters.Add(new JsonConverters.UserFieldIntegerConverter());

            List <Models.Block> json_content;

            if (include.All)
            {
                json_content = blocks;
            }
            else
            {
                json_content = new List <Block>();
                // remove
                foreach (var src_block in blocks)
                {
                    json_content.Add(GetBlockService.CopyFrom(src_block, include));
                }
            }

            return(JsonSerializer.Serialize(json_content, options));
        }
예제 #2
0
 public BlocksService(ParseRequestService provider)
 {
     Parser   = provider;
     instance = new NodeAPIClient.Services.GetBlockService();
 }