public SknData(ref BinaryReader br, ref SknFile SknFile) { this.Vertices = new List <SknFile.SknData.Vertex>(); this.Indices = new List <short>(); bool flag = SknFile.Version == 4; checked { if (flag) { this.Unknown = (uint)br.ReadInt32(); } uint num = br.ReadUInt32(); uint num2 = br.ReadUInt32(); bool flag2 = SknFile.Version == 4; if (flag2) { this.UnknownBytes = br.ReadBytes(48); } long num3 = (long)(unchecked ((ulong)num) - 1uL); for (long num4 = 0L; num4 <= num3; num4 += 1L) { this.Indices.Add(br.ReadInt16()); } long num5 = (long)(unchecked ((ulong)num2) - 1uL); for (long num6 = 0L; num6 <= num5; num6 += 1L) { this.Vertices.Add(new SknFile.SknData.Vertex(ref br)); } } }
public SknFile(string FilePath) { this.Materials = new List <SknFile.SknMaterial>(); checked { using (BinaryReader binaryReader = new BinaryReader(File.Open(FilePath, FileMode.Open))) { this.Magic = binaryReader.ReadInt32(); bool flag = this.Magic != 1122867; if (flag) { throw new Exception("This file is not a valid SKN file."); } this.Version = (short)binaryReader.ReadUInt16(); this.Unknown = (short)binaryReader.ReadUInt16(); long num = (long)(unchecked ((ulong)binaryReader.ReadUInt32()) - 1uL); BinaryReader binaryReader2; for (long num2 = 0L; num2 <= num; num2 += 1L) { List <SknFile.SknMaterial> arg_8B_0 = this.Materials; binaryReader2 = binaryReader; SknFile.SknMaterial item = new SknFile.SknMaterial(ref binaryReader2); arg_8B_0.Add(item); } binaryReader2 = binaryReader; SknFile sknFile = this; SknFile.SknData data = new SknFile.SknData(ref binaryReader2, ref sknFile); this.Data = data; } } }