Ejemplo n.º 1
0
        public static TextureDictionary ReadXmlNode(XmlNode node, string ddsfolder)
        {
            if (node == null)
            {
                return(null);
            }
            var td = new TextureDictionary();

            td.ReadXml(node, ddsfolder);
            return(td);
        }
Ejemplo n.º 2
0
        public static string GetXml(YtdFile ytd, string outputFolder = "")
        {
            StringBuilder sb = new StringBuilder();

            sb.AppendLine(XmlHeader);

            if (ytd?.TextureDict != null)
            {
                TextureDictionary.WriteXmlNode(ytd.TextureDict, sb, 0, outputFolder);
            }

            return(sb.ToString());
        }
Ejemplo n.º 3
0
        public static YtdFile GetYtd(XmlDocument doc, string inputFolder = "")
        {
            YtdFile r = new YtdFile();

            var ddsfolder = inputFolder;

            var node = doc.DocumentElement;

            if (node != null)
            {
                r.TextureDict = TextureDictionary.ReadXmlNode(node, ddsfolder);
            }

            r.Name = Path.GetFileName(inputFolder);

            return(r);
        }
Ejemplo n.º 4
0
 public static void WriteXmlNode(TextureDictionary d, StringBuilder sb, int indent, string ddsfolder, string name = "TextureDictionary")
 {
     if (d == null)
     {
         return;
     }
     if ((d.Textures?.data_items == null) || (d.Textures.data_items.Length == 0))
     {
         YtdXml.SelfClosingTag(sb, indent, name);
     }
     else
     {
         YtdXml.OpenTag(sb, indent, name);
         d.WriteXml(sb, indent + 1, ddsfolder);
         YtdXml.CloseTag(sb, indent, name);
     }
 }
Ejemplo n.º 5
0
        public void Load(byte[] data, RpfFileEntry entry)
        {
            Name = entry.Name;

            RpfResourceFileEntry resentry = entry as RpfResourceFileEntry;
            if (resentry == null)
            {
                throw new Exception("File entry wasn't a resource! (is it binary data?)");
            }

            ResourceDataReader rd = new ResourceDataReader(resentry, data);

            TextureDict = rd.ReadBlock<TextureDictionary>();

            //MemoryUsage = 0; //uses decompressed file size now..
            //if (TextureDict != null)
            //{
            //    MemoryUsage += TextureDict.MemoryUsage;
            //}
        }