private static void CreateStickerIconElement(StickerIcon icon, JsonElementDict dict)
 {
     dict.SetString("size", string.Format("{0}x{1}", icon.size.x, icon.size.y));
     dict.SetString("idiom", icon.GetIdiom());
     dict.SetString("filename", icon.filename);
     dict.SetString("scale", icon.GetScale());
     if (!string.IsNullOrEmpty(icon.platform))
     {
         dict.SetString("platform", icon.platform);
     }
 }
 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);
         }
     }
 }
示例#3
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("}");
 }
 private static void AddSplashEntryForOSVersion(JsonElementDict entry, SplashScreen splash, string minOsVersion)
 {
     entry.SetString("orientation", !splash.isPortrait ? "landscape" : "portrait");
     entry.SetString("idiom", FileUpdaterUtils.GetDeviceIdiomForJson(splash.deviceType));
     entry.SetString("filename", splash.xcodeFile);
     if (minOsVersion != null)
     {
         entry.SetString("minimum-system-version", splash.minOsVersion);
     }
     if (splash.subtype != null)
     {
         entry.SetString("subtype", splash.subtype);
     }
     entry.SetString("extent", "full-screen");
     entry.SetString("scale", $"{splash.scale}x");
 }
        internal static string CreateJsonString(List <SplashScreen> splashes)
        {
            JsonDocument document = new JsonDocument {
                indentString = "\t"
            };
            JsonElementArray entries = document.root.CreateArray("images");

            foreach (SplashScreen screen in splashes)
            {
                AddSplashEntry(entries, screen);
            }
            JsonElementDict dict = document.root.CreateDict("info");

            dict.SetInteger("version", 1);
            dict.SetString("author", "xcode");
            return(document.WriteToString());
        }
        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);
        }
示例#7
0
        internal static string CreateJsonString(List <Icon> icons, bool prerendered)
        {
            JsonDocument document = new JsonDocument {
                indentString = "\t"
            };
            JsonElementArray array = document.root.CreateArray("images");

            foreach (Icon icon in icons)
            {
                JsonElementDict dict = array.AddDict();
                dict.SetString("size", $"{icon.width}x{icon.height}");
                dict.SetString("idiom", FileUpdaterUtils.GetDeviceIdiomForJson(icon.deviceType));
                dict.SetString("filename", icon.xcodefile);
                dict.SetString("scale", $"{icon.scale}x");
            }
            JsonElementDict dict2 = document.root.CreateDict("info");

            dict2.SetInteger("version", 1);
            dict2.SetString("author", "xcode");
            document.root.CreateDict("properties").SetBoolean("pre-rendered", prerendered);
            return(document.WriteToString());
        }
示例#8
0
 public JsonDocument()
 {
     root = new JsonElementDict();
 }
示例#9
0
 public JsonElementDict AddDict()
 {
     var v = new JsonElementDict();
     values.Add(v);
     return v;
 }
示例#10
0
 public JsonElementDict CreateDict(string key)
 {
     var v = new JsonElementDict();
     values[key] = v;
     return v;
 }