/// <summary> /// Initializes a new <see cref="WGEOFile"/> from a <see cref="Stream"/> /// </summary> /// <param name="stream">The <see cref="Stream"/> to read from</param> public WGEOFile(Stream stream) { using (BinaryReader br = new BinaryReader(stream)) { string magic = Encoding.ASCII.GetString(br.ReadBytes(4)); if (magic != "WGEO") { throw new Exception("This is not a valid WGEO file"); } uint version = br.ReadUInt32(); if (version != 5 && version != 4) { throw new Exception("This WGEO file version is not supported"); } uint modelCount = br.ReadUInt32(); uint faceCount = br.ReadUInt32(); for (int i = 0; i < modelCount; i++) { this.Models.Add(new WGEOModel(br)); } if (version == 5) { this.BucketGeometry = new WGEOBucketGeometry(br); } } }
/// <summary> /// Initializes a new <see cref="WGEOFile"/> /// </summary> /// <param name="models">Models of this <see cref="WGEOFile"/></param> /// <param name="bucketGeometry"><see cref="WGEOBucketGeometry"/> of this <see cref="WGEOFile"/></param> public WGEOFile(List <WGEOModel> models, WGEOBucketGeometry bucketGeometry) { this.Models = models; this.BucketGeometry = bucketGeometry; }