Template
31 lines
731 B
C#
31 lines
731 B
C#
using System.Collections;
|
|||
|
|
using System.Collections.Generic;
|
||
|
|
using System.IO;
|
||
|
|
using UnityEngine;
|
||
|
|
|
||
|
|
public class PtgFile {
|
||
|
|
|
||
|
|
private List<TimFile> _timData = new List<TimFile>();
|
||
|
|
|
||
|
|
public List<TimFile> Textures {
|
||
|
|
get { return _timData; }
|
||
|
|
}
|
||
|
|
|
||
|
|
public static PtgFile Parse(byte[] data) {
|
||
|
|
PtgFile result = new PtgFile();
|
||
|
|
|
||
|
|
MemoryStream src = new MemoryStream(data);
|
||
|
|
|
||
|
|
BinaryReader r = new BinaryReader(src);
|
||
|
|
var texCount = r.ReadInt32();
|
||
|
|
var texSize = (data.Length - 4) / texCount;
|
||
|
|
|
||
|
|
for (int i = 0; i < texCount; ++i) {
|
||
|
|
var texData = r.ReadBytes(texSize);
|
||
|
|
result._timData.Add(TimFile.Parse(texData));
|
||
|
|
}
|
||
|
|
|
||
|
|
return result;
|
||
|
|
}
|
||
|
|
}
|