void AttributesToXml(BinaryDataTree tree, IO.XmlElementStream s)
        {
            if (NameValues == null || NameValues.Count <= 1)
            {
                return;
            }

            if (tree.DecompileAttributesWithTypeData)
            {
                using (s.EnterCursorBookmark("Attributes"))
                {
                    for (int x = 1; x < NameValues.Count; x++)
                    {
                        var name_value = NameValues[x];

                        using (s.EnterCursorBookmark(name_value.Name))
                            name_value.Variant.ToStream(s);
                    }
                }
            }
            else
            {
                for (int x = 1; x < NameValues.Count; x++)
                {
                    var name_value = NameValues[x];
                    name_value.Variant.ToStreamAsAttribute(name_value.Name, s);
                }
            }
        }
예제 #2
0
        public void WriteDefinition(IO.XmlElementStream s)
        {
            using (s.EnterCursorBookmark("Files"))
                WriteChunks(s);

            using (var bm = s.EnterCursorBookmarkOpt("LocalFiles", mLocalFiles, Predicates.HasItems)) if (bm.IsNotNull)
                {
                    WriteLocalFiles(s);
                }
        }
예제 #3
0
        private void ReadChunks(IO.XmlElementStream s)
        {
            foreach (var n in s.ElementsByName(ECF.EcfChunk.kXmlElementStreamName))
            {
                var f = new EraFileEntryChunk();
                using (s.EnterCursorBookmark(n))
                {
                    f.Read(s, false);
                }

                mFiles.Add(f);
            }
        }
        void ChildrenToXml(BinaryDataTree tree, IO.XmlElementStream s)
        {
            if (Children == null || Children.Count == 0)
            {
                return;
            }

            foreach (var child in Children)
            {
                using (s.EnterCursorBookmark(child.NodeName))
                    child.ToXml(tree, s);
            }
        }
예제 #5
0
        private void WriteLocalFiles(IO.XmlElementStream s)
        {
            foreach (var kvp in mLocalFiles)
            {
                string file_name = kvp.Key;
                string file_data = kvp.Value;

                using (s.EnterCursorBookmark("file"))
                {
                    s.WriteAttribute("name", file_name);
                    s.WriteCursor(file_data);
                }
            }
        }
예제 #6
0
        private void ReadLocalFiles(IO.XmlElementStream s)
        {
            foreach (var n in s.ElementsByName("file"))
            {
                using (s.EnterCursorBookmark(n))
                {
                    string file_name = null;
                    s.ReadAttribute("name", ref file_name);

                    string file_data = "";
                    s.ReadCursor(ref file_data);

                    if (!string.IsNullOrEmpty(file_name))
                    {
                        mLocalFiles[file_name] = file_data;
                    }
                }
            }
        }
예제 #7
0
        public bool ReadDefinition(IO.XmlElementStream s)
        {
            mFiles.Clear();

            // first entry should always be the null terminated filenames table
            mFiles.Add(GenerateFileNamesTableEntryChunk());

            using (s.EnterCursorBookmark("Files"))
                ReadChunks(s);

            using (var bm = s.EnterCursorBookmarkOpt("LocalFiles")) if (bm.IsNotNull)
                {
                    ReadLocalFiles(s);
                }

            AddVersionFile();

            // there should be at least one file destined for the ERA, excluding the filenames table
            return(FileChunksCount != 0);
        }
예제 #8
0
 public void Write(IO.XmlElementStream s, bool includeFileData)
 {
     using (s.EnterCursorBookmark(kXmlElementStreamName))
         WriteFields(s, includeFileData);
 }