AddDict() public method

public AddDict ( ) : JsonElementDict
return JsonElementDict
 private static void AddSplashEntry(JsonElementArray entries, SplashScreen splash)
 {
     if (Utils.CompareVersionNumbers(splash.minOsVersion, "7.0") <= 0)
     {
         AddSplashEntryForOSVersion(entries.AddDict(), splash, null);
     }
     if (splash.minOsVersion != null)
     {
         AddSplashEntryForOSVersion(entries.AddDict(), splash, splash.minOsVersion);
     }
 }
Exemplo n.º 2
0
        public override void Write(List <string> warnings)
        {
            Directory.CreateDirectory(this.m_Path);
            JsonDocument doc = new JsonDocument();

            this.WriteODRTagsToJson(this.WriteInfoToJson(doc));
            JsonElementArray array             = doc.root.CreateArray("images");
            HashSet <string> existingFilenames = new HashSet <string>();

            foreach (AssetImageSet.ImageSetVariant imageSetVariant in this.m_Variants)
            {
                string          val             = this.CopyFileToSet(imageSetVariant.path, existingFilenames, warnings);
                JsonElementDict jsonElementDict = array.AddDict();
                jsonElementDict.SetString("filename", val);
                this.WriteRequirementsToJson(jsonElementDict, imageSetVariant.requirement);
                if (imageSetVariant.alignment != null)
                {
                    this.WriteAlignmentToJson(jsonElementDict, imageSetVariant.alignment);
                }
                if (imageSetVariant.resizing != null)
                {
                    this.WriteResizingToJson(jsonElementDict, imageSetVariant.resizing);
                }
            }
            doc.WriteToFile(Path.Combine(this.m_Path, "Contents.json"));
        }
Exemplo n.º 3
0
        public override void Write(List <string> warnings)
        {
            Directory.CreateDirectory(base.m_Path);
            JsonDocument    doc  = new JsonDocument();
            JsonElementDict info = base.WriteInfoToJson(doc);

            base.WriteODRTagsToJson(info);
            JsonElementArray array = doc.root.CreateArray("data");

            foreach (DataSetVariant variant in base.m_Variants)
            {
                string fileName = Path.GetFileName(variant.path);
                if (!File.Exists(variant.path))
                {
                    if (warnings != null)
                    {
                        warnings.Add("File not found: " + variant.path);
                    }
                }
                else
                {
                    File.Copy(variant.path, Path.Combine(base.m_Path, fileName));
                }
                JsonElementDict item = array.AddDict();
                item.SetString("filename", fileName);
                base.WriteRequirementsToJson(item, variant.requirement);
                if (variant.id != null)
                {
                    item.SetString("universal-type-identifier", variant.id);
                }
            }
            doc.WriteToFile(Path.Combine(base.m_Path, "Contents.json"));
        }
Exemplo n.º 4
0
        public override void Write(List <string> warnings)
        {
            Directory.CreateDirectory(base.m_Path);
            JsonDocument doc = new JsonDocument();

            base.WriteInfoToJson(doc);
            JsonElementArray array = doc.root.CreateArray("layers");

            foreach (AssetImageStackLayer layer in this.m_Layers)
            {
                layer.Write(warnings);
                array.AddDict().SetString("filename", Path.GetFileName(layer.path));
            }
            doc.WriteToFile(Path.Combine(base.m_Path, "Contents.json"));
        }
Exemplo n.º 5
0
        public override void Write(List <string> warnings)
        {
            Directory.CreateDirectory(this.m_Path);
            JsonDocument doc = new JsonDocument();

            this.WriteInfoToJson(doc);
            JsonElementArray array = doc.root.CreateArray("assets");

            foreach (AssetBrandAssetGroup.AssetBrandAssetItem assetBrandAssetItem in this.m_Items)
            {
                JsonElementDict jsonElementDict = array.AddDict();
                jsonElementDict.SetString("size", string.Format("{0}x{1}", (object)assetBrandAssetItem.width, (object)assetBrandAssetItem.height));
                jsonElementDict.SetString("idiom", assetBrandAssetItem.idiom);
                jsonElementDict.SetString("role", assetBrandAssetItem.role);
                jsonElementDict.SetString("filename", Path.GetFileName(assetBrandAssetItem.item.path));
                assetBrandAssetItem.item.Write(warnings);
            }
            doc.WriteToFile(Path.Combine(this.m_Path, "Contents.json"));
        }
        public override void Write(List <string> warnings)
        {
            Directory.CreateDirectory(base.m_Path);
            JsonDocument doc = new JsonDocument();

            base.WriteInfoToJson(doc);
            JsonElementArray array = doc.root.CreateArray("assets");

            foreach (AssetBrandAssetItem item in this.m_Items)
            {
                JsonElementDict dict = array.AddDict();
                dict.SetString("size", $"{item.width}x{item.height}");
                dict.SetString("idiom", item.idiom);
                dict.SetString("role", item.role);
                dict.SetString("filename", Path.GetFileName(item.item.path));
                item.item.Write(warnings);
            }
            doc.WriteToFile(Path.Combine(base.m_Path, "Contents.json"));
        }
Exemplo n.º 7
0
        public override void Write(List <string> warnings)
        {
            Directory.CreateDirectory(this.m_Path);
            JsonDocument doc = new JsonDocument();

            this.WriteODRTagsToJson(this.WriteInfoToJson(doc));
            JsonElementArray array             = doc.root.CreateArray("data");
            HashSet <string> existingFilenames = new HashSet <string>();

            foreach (AssetDataSet.DataSetVariant dataSetVariant in this.m_Variants)
            {
                string          val             = this.CopyFileToSet(dataSetVariant.path, existingFilenames, warnings);
                JsonElementDict jsonElementDict = array.AddDict();
                jsonElementDict.SetString("filename", val);
                this.WriteRequirementsToJson(jsonElementDict, dataSetVariant.requirement);
                if (dataSetVariant.id != null)
                {
                    jsonElementDict.SetString("universal-type-identifier", dataSetVariant.id);
                }
            }
            doc.WriteToFile(Path.Combine(this.m_Path, "Contents.json"));
        }