private void button1_Click(object sender, EventArgs e) { DDXBridge.init(); if (!Directory.Exists(outputDir)) { Directory.CreateDirectory(outputDir); } List <string> selectedFiles = new List <string>(); for (int i = 0; i < scenarioListBox.SelectedItems.Count; i++) { selectedFiles.Add(scenarioListBox.SelectedItems[i] as string); } for (int i = 0; i < selectedFiles.Count; i++) { ScnMemoryEstimate scnEst = new ScnMemoryEstimate(); XboxModelEstimate xme = new XboxModelEstimate(); xme.estimateMemory(selectedFiles[i], CalcScnMemEst.gameDirectory, scnEst); XboxTerrainEstimate xte = new XboxTerrainEstimate(); xte.estimateMemory(selectedFiles[i], CalcScnMemEst.gameDirectory, scnEst); scnEst.exportToFile(outputDir + Path.GetFileNameWithoutExtension(selectedFiles[i]) + ".csv"); } DDXBridge.destroy(); Process.Start(outputDir); }
public void estimateMemory(string scenarioName, string gameWorkDirectory, ScnMemoryEstimate memEst) { scnName = scenarioName; gameDirectory = gameWorkDirectory; mMemEst = memEst; calculateXTDMemory(); calculateXTHMemory(); calculateXTTMemory(); calculateXSDMemory(); }
public void estimateMemory(string scenarioName, string gameWorkDirectory, ScnMemoryEstimate memEst) { gameDirectory = gameWorkDirectory; scenarioName = Path.ChangeExtension(scenarioName, null); generateFileList(scenarioName); //file will be in form of "<filename>_fileList.txt" : _memestsave_FileList.txt processFileList(Path.GetFileNameWithoutExtension(scenarioName) + "_FileList.txt", memEst); quickDeleteFile(scenarioName); }
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(); } }