void processFileList(string listfilename, ScnMemoryEstimate memEst) { if (!File.Exists(listfilename)) { return; } Stream st = null; // if we're in async mode, we may not have access to this yet. while (st == null) { try { st = File.OpenRead(listfilename); } catch (IOException e) { } } StreamReader tr = new StreamReader(st); int otherFiles = 0; List <string> ddxFiles = new List <string>(); try { string filename = tr.ReadLine(); do { if (!File.Exists(filename)) { continue; } if (filename.ToLower().Contains(".xmb")) { continue; } if (filename.ToLower().Contains(".lgt")) { continue; } if (filename.ToLower().Contains(".tfx")) { continue; } if (filename.ToLower().Contains(".xpr")) { continue; } if (filename.ToLower().Contains(".scn")) { continue; } if (filename.ToLower().Contains(".txt")) { continue; } if (filename.ToLower().Contains(".gls")) { continue; } if (filename.ToLower().Contains(".pfx")) { continue; } if (filename.ToLower().Contains(".ddx")) { int DDXMem = DDXBridge.give360TextureMemFootprint(filename); memEst.setOrAddMemoryElement("Model Texture Memory", DDXMem, ScnMemoryEstimate.eMainCatagory.eCat_Models); memEst.setOrAddMemoryElement(removeWorkPrepath(filename), DDXMem, ScnMemoryEstimate.eMainCatagory.eCat_Models_Detailed, false); } else if (filename.ToLower().Contains(".ugx")) { System.IO.FileInfo fi = new System.IO.FileInfo(filename); int UGXMem = (int)fi.Length; fi = null; memEst.setOrAddMemoryElement("Model UGX Memory", UGXMem, ScnMemoryEstimate.eMainCatagory.eCat_Models); memEst.setOrAddMemoryElement(removeWorkPrepath(filename), UGXMem, ScnMemoryEstimate.eMainCatagory.eCat_Models_Detailed, false); } else if (filename.ToLower().Contains(".uax")) { System.IO.FileInfo fi = new System.IO.FileInfo(filename); int UAXMem = (int)fi.Length; fi = null; memEst.setOrAddMemoryElement("Model UAX Memory", UAXMem, ScnMemoryEstimate.eMainCatagory.eCat_Models); memEst.setOrAddMemoryElement(removeWorkPrepath(filename), UAXMem, ScnMemoryEstimate.eMainCatagory.eCat_Models_Detailed, false); } else { otherFiles++; } } while ((filename = tr.ReadLine()) != null); } catch (IOException e) { } finally { tr.Close(); st.Close(); } }
void calculateXTDMemory() { ECFReader ecfR = new ECFReader(); string XTDName = Path.ChangeExtension(gameDirectory + @"\scenario\" + scnName, ".XTD"); if (!ecfR.openForRead(XTDName)) { return; } for (uint i = 0; i < ecfR.getNumChunks(); i++) { ECF.BECFChunkHeader chunkHeader = ecfR.getChunkHeader(i); eXTD_ChunkID id = (eXTD_ChunkID)chunkHeader.mID; switch (id) { case eXTD_ChunkID.cXTD_XTDHeader: break; case eXTD_ChunkID.cXTD_AOChunk: mMemEst.setOrAddMemoryElement("Terrain AO", chunkHeader.mSize, ScnMemoryEstimate.eMainCatagory.eCat_Terrain); break; case eXTD_ChunkID.cXTD_AtlasChunk: mMemEst.setOrAddMemoryElement("Terrain Verts & Normals", chunkHeader.mSize, ScnMemoryEstimate.eMainCatagory.eCat_Terrain); break; case eXTD_ChunkID.cXTD_TessChunk: mMemEst.setOrAddMemoryElement("Terrain Tessellation", chunkHeader.mSize, ScnMemoryEstimate.eMainCatagory.eCat_Terrain); break; case eXTD_ChunkID.cXTD_LightingChunk: mMemEst.setOrAddMemoryElement("Terrain Lighting", chunkHeader.mSize, ScnMemoryEstimate.eMainCatagory.eCat_Terrain); break; case eXTD_ChunkID.cXTD_AlphaChunk: mMemEst.setOrAddMemoryElement("Terrain Alpha", chunkHeader.mSize, ScnMemoryEstimate.eMainCatagory.eCat_Terrain); break; } } ecfR.close(); ecfR = null; }