protected void WriteODRTagsToJson(JsonElementDict info)
 {
     if (m_ODRTags.Count > 0)
     {
         var tags = info.CreateArray("on-demand-resource-tags");
         foreach (var tag in m_ODRTags)
         {
             tags.AddString(tag);
         }
     }
 }
Exemple #2
0
 void WriteDict(StringBuilder sb, JsonElementDict el, int indent)
 {
     sb.Append("{");
     bool hasElement = false;
     foreach (var key in el.values.Keys)
     {
         if (hasElement)
             sb.Append(","); // trailing commas not supported
         WriteDictKeyValue(sb, key, el[key], indent+1);
         hasElement = true;
     }
     sb.Append("\n");
     AppendIndent(sb, indent);
     sb.Append("}");
 }
        void WriteResizingToJson(JsonElementDict item, ImageResizing resizing)
        {
            var docResizing = item.CreateDict("resizing");

            docResizing.SetString("mode", GetSlicingMode(resizing.type));

            var docCenter = docResizing.CreateDict("center");

            docCenter.SetString("mode", GetCenterResizeMode(resizing.centerResizeMode));
            docCenter.SetInteger("width", resizing.centerWidth);
            docCenter.SetInteger("height", resizing.centerHeight);

            var docInsets = docResizing.CreateDict("cap-insets");

            docInsets.SetInteger("top", resizing.top);
            docInsets.SetInteger("bottom", resizing.bottom);
            docInsets.SetInteger("left", resizing.left);
            docInsets.SetInteger("right", resizing.right);
        }
Exemple #4
0
 public JsonElementDict CreateDict(string key)
 {
     var v = new JsonElementDict();
     values[key] = v;
     return v;
 }
Exemple #5
0
 public JsonDocument()
 {
     root = new JsonElementDict();
 }
Exemple #6
0
 public JsonElementDict AddDict()
 {
     var v = new JsonElementDict();
     values.Add(v);
     return v;
 }