예제 #1
0
        public void ScanPackage(ScannerItem si, SimPe.Cache.PackageState ps, System.Windows.Forms.ListViewItem lvi)
        {
            SimPe.Interfaces.Files.IPackedFileDescriptor[] pfds = si.Package.FindFiles(Data.MetaData.MMAT);
            //ArrayList list = new ArrayList();

            ps.State = TriState.True;
            //FileTable.FileIndex.StoreCurrentState();
            if (!FileTable.FileIndex.ContainsPath(System.IO.Path.GetDirectoryName(si.FileName)))
            {
                FileIndex.AddIndexFromFolder(System.IO.Path.GetDirectoryName(si.FileName));
            }

            FileIndex.AddIndexFromPackage(si.Package);
            foreach (SimPe.Interfaces.Files.IPackedFileDescriptor pfd in pfds)
            {
                SimPe.Plugin.MmatWrapper mmat = new MmatWrapper();
                mmat.ProcessData(pfd, si.Package, false);

                string m = mmat.ModelName.Trim().ToLower();
                if (!m.EndsWith("_cres"))
                {
                    m += "_cres";
                }

                //Add the current package
                SimPe.Interfaces.Scenegraph.IScenegraphFileIndexItem item = FileTable.FileIndex.FindFileByName(m, Data.MetaData.CRES, Data.MetaData.LOCAL_GROUP, true);

                if (item == null)
                {
                    ps.State = TriState.False;
                }

                item = null;
                mmat.Dispose();
                m = null;
            }
            //FileTable.FileIndex.RestoreLastState();

            UpdateState(si, ps, lvi);
        }