예제 #1
0
        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);
        }
예제 #2
0
        public int giveDependentTextureMemoryFootprint(String inFilename, ref bool specCache, ref bool selfCache, ref bool envCache)
        {
            int    totalMemory = 0;
            String filename    = inFilename;

            String[] extentionTypes = new String[] { "_df", "_nm", "_sp", "_em", "_rm", "_op" };

            for (int i = 0; i < extentionTypes.Length; i++)
            {
                if (Path.GetFileNameWithoutExtension(inFilename).LastIndexOf(extentionTypes[i]) != -1)
                {
                    filename = filename.Substring(0, filename.LastIndexOf(extentionTypes[i]));

                    break;
                }
            }

            //remove extention if it exists in the filename
            if (Path.GetExtension(filename) != "")
            {
                filename = Path.ChangeExtension(filename, "");
            }


            for (int i = 0; i < extentionTypes.Length; i++)
            {
                String tPath = gameDirectory + @"\art\terrain\" + filename + extentionTypes[i] + ".ddx";
                if (File.Exists(tPath))
                {
                    totalMemory += DDXBridge.give360TextureMemFootprint(tPath);

                    if (i == 2)
                    {
                        specCache |= true;
                    }
                    if (i == 3)
                    {
                        selfCache |= true;
                    }
                    if (i == 4)
                    {
                        envCache |= true;
                    }
                }
            }

            return(totalMemory);
        }
예제 #3
0
        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();
            }
        }