Ejemplo n.º 1
0
        private JsonObject readObject()
        {
            read();
            JsonObject obj = new JsonObject();

            skipWhiteSpace();
            if (readChar('}'))
            {
                return(obj);
            }
            do
            {
                skipWhiteSpace();
                string name = readName();
                skipWhiteSpace();
                if (!readChar(':'))
                {
                    throw expected("':'");
                }
                skipWhiteSpace();
                obj.add(name, readValue());
                skipWhiteSpace();
            } while (readChar(','));
            if (!readChar('}'))
            {
                throw expected("',' or '}'");
            }
            return(obj);
        }
Ejemplo n.º 2
0
 internal JsonObject toArray()
 {
     JsonObject data = new JsonObject()
         .add("snaktype", this.type)
         .add("property", this.propertyId.getPrefixedId());
     if (this.dataValue != null)
     {
         data.add("datavalue", this.dataValue.fullEncode());
     }
     return data;
 }
Ejemplo n.º 3
0
 public void Send(string message)
 {
     JsonObject jsonMessage = new JsonObject();
     jsonMessage.add("type", "metrics").add("message", message);
     metricsws.Send(jsonMessage.ToString());
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Save the reference.
 /// </summary>
 /// <param name="summary">The summary</param>
 public void save(string summary)
 {
     if (this.statement.id == null)
     {
         throw new Exception("The statement has no Id. Please save the statement containing it first.");
     }
     JsonObject obj = new JsonObject();
     foreach (KeyValuePair<string, Dictionary<string, Snak>> pair in this.snaks)
     {
         JsonArray array = new JsonArray();
         foreach(KeyValuePair<string, Snak> p in pair.Value)
         {
             array.add(p.Value.toArray());
         }
         obj.add(pair.Key, array);
     }
     JsonObject result = this.statement.entity.api.setReference(this.statement.id, obj, this.hash, this.statement.entity.lastRevisionId, summary);
     this.updateDataFromResult(result);
 }
Ejemplo n.º 5
0
 private JsonObject readObject()
 {
     read();
     JsonObject obj = new JsonObject();
     skipWhiteSpace();
     if (readChar('}'))
     {
         return obj;
     }
     do
     {
         skipWhiteSpace();
         string name = readName();
         skipWhiteSpace();
         if (!readChar(':'))
         {
             throw expected("':'");
         }
         skipWhiteSpace();
         obj.add(name, readValue());
         skipWhiteSpace();
     } while (readChar(','));
     if (!readChar('}'))
     {
         throw expected("',' or '}'");
     }
     return obj;
 }