Esempio n. 1
0
 protected virtual void WriteFields(IO.XmlElementStream s, bool includeFileData)
 {
     s.WriteAttribute("id", EntryId.ToString("X16"));
     //if (Flags != 0)
     //	s.WriteAttribute("flags", Flags.ToString("X1"));
     if (DataAlignmentBit != kDefaultAlignmentBit)
     {
         s.WriteAttribute("align", DataAlignmentBit.ToString("X1"));
     }
     if (includeFileData)
     {
         s.WriteAttribute("offset", DataOffset.u32.ToString("X8"));
         s.WriteAttribute("size", DataSize.ToString("X8"));
     }
 }
Esempio n. 2
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);
                }
            }
        }
Esempio n. 3
0
        protected void WriteResourceFlags(IO.XmlElementStream s)
        {
            if (mResourceFlags == 0)
            {
                return;
            }

            if (IsContiguous)
            {
                s.WriteAttribute("IsContiguous", true);
            }
            if (IsWriteCombined)
            {
                s.WriteAttribute("IsWriteCombined", true);
            }
            if (IsDeflateStream)
            {
                s.WriteAttribute("IsDeflateStream", true);
            }
            if (IsResourceTag)
            {
                s.WriteAttribute("IsResourceTag", true);
            }
        }
Esempio n. 4
0
        protected override void WriteFields(IO.XmlElementStream s, bool includeFileData)
        {
            if (includeFileData && mFileTimeBits != 0)
            {
                s.WriteAttribute("fileTime", mFileTimeBits.ToString("X16"));
            }

            // only because it's interesting to have, never read back in
            s.WriteAttribute("fileDateTime", FileDateTimeString);

            base.WriteFields(s, includeFileData);

            // When we extract, we decode xmbs
            string fn = FileName;

            if (ResourceUtils.IsXmbFile(fn))
            {
                bool remove_xmb_ext = true;

                var expander = s.Owner as EraFileExpander;
                if (expander != null && expander.ExpanderOptions.Test(EraFileExpanderOptions.DontTranslateXmbFiles))
                {
                    remove_xmb_ext = false;
                }

                if (remove_xmb_ext)
                {
                    ResourceUtils.RemoveXmbExtension(ref fn);
                }
            }
            s.WriteAttribute("name", fn);

            if (includeFileData)
            {
                if (DataUncompressedSize != DataSize)
                {
                    s.WriteAttribute("fullSize", DataUncompressedSize.ToString("X8"));
                }

                s.WriteAttribute("compressedDataHash",
                                 Text.Util.ByteArrayToString(CompressedDataTiger128));

                s.WriteAttribute("nameOffset", FileNameOffset.ToString("X6"));
            }

            base.WriteFlags(s);
            base.WriteResourceFlags(s);
        }