WriteToFile() public method

public WriteToFile ( string path ) : void
path string
return void
Beispiel #1
0
        public override void Write()
        {
            Directory.CreateDirectory(m_Path);

            var doc = new JsonDocument();

            var info = WriteInfoToJson(doc);

            WriteODRTagsToJson(info);

            var data = doc.root.CreateArray("data");

            foreach (DataSetVariant item in m_Variants)
            {
                var filename = System.IO.Path.GetFileName(item.path);
                File.Copy(item.path, System.IO.Path.Combine(m_Path, filename));

                var docItem = data.AddDict();
                docItem.SetString("filename", filename);
                WriteRequirementsToJson(docItem, item.requirement);
                if (item.id != null)
                {
                    docItem.SetString("universal-type-identifier", item.id);
                }
            }
            doc.WriteToFile(System.IO.Path.Combine(m_Path, "Contents.json"));
        }
Beispiel #2
0
        public override void Write()
        {
            Directory.CreateDirectory(m_Path);
            var doc  = new JsonDocument();
            var info = WriteInfoToJson(doc);

            WriteODRTagsToJson(info);

            var images = doc.root.CreateArray("images");

            foreach (ImageSetVariant item in m_Variants)
            {
                var filename = System.IO.Path.GetFileName(item.path);
                File.Copy(item.path, System.IO.Path.Combine(m_Path, filename));

                var docItem = images.AddDict();
                docItem.SetString("filename", filename);
                WriteRequirementsToJson(docItem, item.requirement);
                if (item.alignment != null)
                {
                    WriteAlignmentToJson(docItem, item.alignment);
                }
                if (item.resizing != null)
                {
                    WriteResizingToJson(docItem, item.resizing);
                }
            }
            doc.WriteToFile(System.IO.Path.Combine(m_Path, "Contents.json"));
        }
Beispiel #3
0
        void WriteJson()
        {
            if (!providesNamespace)
            {
                return; // json is optional when namespace is not provided
            }
            var doc = new JsonDocument();

            WriteInfoToJson(doc);

            var props = doc.root.CreateDict("properties");

            props.SetBoolean("provides-namespace", providesNamespace);
            doc.WriteToFile(System.IO.Path.Combine(m_Path, "Contents.json"));
        }
Beispiel #4
0
        public override void Write()
        {
            Directory.CreateDirectory(m_Path);
            var doc = new JsonDocument();

            WriteInfoToJson(doc);

            var docLayers = doc.root.CreateArray("layers");

            foreach (var layer in m_Layers)
            {
                layer.Write();

                var docLayer = docLayers.AddDict();
                docLayer.SetString("filename", System.IO.Path.GetFileName(layer.path));
            }
            doc.WriteToFile(System.IO.Path.Combine(m_Path, "Contents.json"));
        }
Beispiel #5
0
        public override void Write()
        {
            Directory.CreateDirectory(m_Path);
            var doc = new JsonDocument();

            WriteInfoToJson(doc);

            if (m_ReferencedName != null)
            {
                var props     = doc.root.CreateDict("properties");
                var reference = props.CreateDict("content-reference");
                reference.SetString("type", "image-set");
                reference.SetString("name", m_ReferencedName);
                reference.SetString("matching-style", "fully-qualified-name");
            }
            if (m_Imageset != null)
            {
                m_Imageset.Write();
            }

            doc.WriteToFile(System.IO.Path.Combine(m_Path, "Contents.json"));
        }