private Stream saveGeom(string filename, ResourceKey bumpMapKey) { int bumpmapPos = -1; SimGeomFile simgeomfile = new SimGeomFile(); Stream blah = File.Open(filename, FileMode.Open); simgeomfile.Load(blah); blah.Close(); if (bumpMapKey.ToString() != "key:00000000:00000000:0000000000000000") { // Figure out bumpmap location // To do this we loop through the MTNF for (int i = 0; i < simgeomfile.simgeom.mtnfChunk.entries.Count; i++) { if (simgeomfile.simgeom.mtnfChunk.entries[i].fieldTypeHash == (uint)FieldTypes.NormalMap) { bumpmapPos = (int)simgeomfile.simgeom.mtnfChunk.entries[i].dwords[0]; break; } } if (bumpmapPos > -1) { simgeomfile.simgeom.keytable.keys[bumpmapPos] = bumpMapKey; } } return simgeomfile.Save(); }