Ejemplo n.º 1
0
        internal void WriteToJson(System.Text.Json.Utf8JsonWriter writer)
        {
            writer.WritePropertyName(nameof(PartitionKeys));
            writer.WriteStartArray();
            if (PartitionKeys != null)
            {
                for (int i = 0; i < PartitionKeys.Length; i++)
                {
                    writer.WriteNumberValue(PartitionKeys[i]);
                }
            }
            writer.WriteEndArray();

            writer.WritePropertyName(nameof(ClusteringColumns));
            if (ClusteringColumns != null && ClusteringColumns.Length > 0)
            {
                writer.WriteStartArray();
                for (int i = 0; i < ClusteringColumns.Length; i++)
                {
                    writer.WriteStartObject();
                    writer.WriteNumber("MemberId", ClusteringColumns[i].MemberId);
                    writer.WriteBoolean("OrderByDesc", ClusteringColumns[i].OrderByDesc);
                    writer.WriteEndObject();
                }
                writer.WriteEndArray();
            }
            else
            {
                writer.WriteEmptyArray();
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// The gateway_balances command calculates the total balances issued by a given account, optionally excluding amounts held by operational addresses.
        /// New in: rippled 0.28.2
        /// </summary>
        public async Task <GatewayBalancesResponse> GatewayBalances(GatewayBalancesRequest request, CancellationToken cancellationToken = default)
        {
            jsonBuffer.Clear();
            jsonWriter.Reset();
            jsonWriter.WriteStartObject();
            var requestId = WriteHeader(jsonWriter, "gateway_balances");

            LedgerSpecification.Write(jsonWriter, request.Ledger);
            jsonWriter.WriteString("account", request.Account.ToString());
            if (request.HotWallet != null)
            {
                if (request.HotWallet.Length == 1)
                {
                    jsonWriter.WriteString("hotwallet", request.HotWallet[0].ToString());
                }
                else
                {
                    jsonWriter.WriteStartArray("hotwallet");
                    foreach (var account in request.HotWallet)
                    {
                        jsonWriter.WriteStringValue(account.ToString());
                    }
                    jsonWriter.WriteEndArray();
                }
            }
            WriteFooter(jsonWriter);
            jsonWriter.WriteEndObject();
            jsonWriter.Flush();
            var response = await SendReceiveAsync(requestId, jsonBuffer.WrittenMemory, cancellationToken);

            return(new GatewayBalancesResponse(response));
        }
Ejemplo n.º 3
0
        internal void WriteToJson(System.Text.Json.Utf8JsonWriter writer)
        {
            //monaco.DocumentSymbol
            writer.WriteStartObject();
            writer.WriteString("name", DisplayName);
            writer.WriteString("detail", "");
            writer.WriteNumber("kind", SymbolKinds.ToMonacoKind(Kind));

            var fullRange = Ranges["full"];
            var nameRange = Ranges["name"];

            writer.WritePropertyName("range");
            fullRange.WriteToJson(writer);
            writer.WritePropertyName("selectionRange");
            nameRange.WriteToJson(writer);

            if (Children != null)
            {
                writer.WritePropertyName("children");
                writer.WriteStartArray();
                foreach (var child in Children)
                {
                    child.WriteToJson(writer);
                }
                writer.WriteEndArray();
            }

            writer.WriteEndObject();
        }
Ejemplo n.º 4
0
 internal void WriteToJson(System.Text.Json.Utf8JsonWriter writer)
 {
     //对应monaco.SignatureInformation
     writer.WriteStartObject();
     writer.WriteString("label", Label);
     writer.WriteString("documentation", StructuredDocumentation.SummaryText);
     writer.WritePropertyName("parameters");
     writer.WriteStartArray();
     foreach (var item in Parameters)
     {
         item.WriteToJson(writer);
     }
     writer.WriteEndArray();
     writer.WriteEndObject();
 }
Ejemplo n.º 5
0
 protected override void WriteFooter(System.Text.Json.Utf8JsonWriter writer)
 {
     writer.WriteEndObject();
     writer.WriteEndArray();
 }