using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BinaryPacker
{
class ReadAtlasData
{
public static void Pack(string path, string outFile) {
FileStream fileStream3 = File.OpenRead( path + ".meta");
string strValue = "";
BinaryReader binaryReader3 = new BinaryReader(fileStream3);
int version = binaryReader3.ReadInt32();
strValue += "version:\t" + version.ToString() + "\r\n";
string strpack =binaryReader3.ReadString();
strValue += "pack:\t" + strpack + "\r\n";
int msg = binaryReader3.ReadInt32();
strValue += "msg:\t" + msg.ToString() + "\r\n";
short num13 = binaryReader3.ReadInt16();
strValue += "长度:\t" + num13.ToString() + "\r\n";
strValue += "{\r\n";
for (int m = 0; m < (int)num13; m++)
{
string str3 = binaryReader3.ReadString();
strValue += "数据:\t" + str3 + "\r\n";
//VirtualTexture virtualTexture5 = VirtualContent.CreateTexture(Path.Combine(Path.GetDirectoryName(path), str3 + ".data"));
//atlas.Sources.Add(virtualTexture5);
//MTexture parent4 = new MTexture(virtualTexture5);
short num14 = binaryReader3.ReadInt16();
strValue += "长度:\t" + num14.ToString() + "\r\n";
strValue += "\t{\r\n";
for (int n = 0; n < (int)num14; n++)
{
string text5 = binaryReader3.ReadString().Replace('\\', '/');
short num15 = binaryReader3.ReadInt16();
short num16 = binaryReader3.ReadInt16();
short num17 = binaryReader3.ReadInt16();
short num18 = binaryReader3.ReadInt16();
short num19 = binaryReader3.ReadInt16();
short num20 = binaryReader3.ReadInt16();
short width2 = binaryReader3.ReadInt16();
short height2 = binaryReader3.ReadInt16();
// atlas.textures[text5] = new MTexture(parent4, text5, new Rectangle((int)num15, (int)num16, (int)num17, (int)num18), new Vector2((float)(-(float)num19), (float)(-(float)num20)), (int)width2, (int)height2);
strValue += "\t\t" + text5 + "\r\n";
strValue += "\t\t" + num15.ToString() + "\r\n";
}
strValue += "\t}\r\n";
}
strValue += "}\r\n";
if (fileStream3.Position < fileStream3.Length && binaryReader3.ReadString() == "LINKS")
{
strValue += "{\r\n";
short num21 = binaryReader3.ReadInt16();
for (int num22 = 0; num22 < (int)num21; num22++)
{
string key = binaryReader3.ReadString();
string value = binaryReader3.ReadString();
strValue += key + "\t:\t" + value + "\r\n";
}
strValue += "}\r\n";
}
File.WriteAllText(outFile, strValue);
}
}
}