示例#1
0
文件: Texture.cs 项目: q4a/CodeWalker
        public static TextureDictionary ReadXmlNode(XmlNode node, string ddsfolder)
        {
            if (node == null)
            {
                return(null);
            }
            var td = new TextureDictionary();

            td.ReadXml(node, ddsfolder);
            return(td);
        }
示例#2
0
文件: YtdFile.cs 项目: q4a/CodeWalker
        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());
        }
示例#3
0
文件: YtdFile.cs 项目: q4a/CodeWalker
        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);
        }
示例#4
0
文件: Texture.cs 项目: q4a/CodeWalker
 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);
     }
 }
示例#5
0
文件: YtdFile.cs 项目: z87/CodeWalker
        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;
            //}
        }