Template
*
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user