示例#1
0
        public static Ambertation.Scenes.Scene BuildScene(out SimPe.Interfaces.Scenegraph.IScenegraphFileIndex fii, MmatWrapper mmat, SimPe.Interfaces.Files.IPackageFile package, out SimPe.Interfaces.Files.IPackageFile npkg)
        {
            npkg = null;
            Wait.Start();
            fii = FileTable.FileIndex.AddNewChild();
            try
            {
                return(BuildScene(fii, mmat, package, out npkg));
            }
            catch (System.IO.FileNotFoundException)
            {
                Wait.Stop();
                if (MessageBox.Show("The Microsoft Managed DirectX Extensions were not found on your System. Without them, the Preview is not available.\n\nYou can install them manually, by extracting the content of the DirectX\\ManagedDX.CAB on your Sims 2 Installation CD #1. If you double click on the extracted msi File, all needed Files will be installed.\n\nYou can also let SimPE install it automatically. SimPE will download the needed Files (3.5MB) from the SimPE Homepage and install them. Do you want SimPE to download and install the Files?", "Warning", MessageBoxButtons.YesNo) == DialogResult.Yes)
                {
                    if (WebUpdate.InstallMDX())
                    {
                        MessageBox.Show("Managed DirectX Extension were installed succesfully!");
                    }
                }

                return(null);
            }

            finally
            {
                FileTable.FileIndex.RemoveChild(fii);
                Wait.Stop();
            }

            //return null;
        }
示例#2
0
        public TextureLocator(SimPe.Interfaces.Files.IPackageFile package)
        {
            this.package = package;
            fii          = SimPe.FileTable.FileIndex.AddNewChild();

            //fii.AddIndexFromPackage(package);
        }
示例#3
0
        /// <summary>
        /// Creates the List for the specific Folder
        /// </summary>
        /// <param name="folder">The Folder with the Character Files</param>
        public SimNames(string folder, Interfaces.Providers.IOpcodeProvider opcodes) : base()
        {
            BaseFolder   = folder;
            this.opcodes = opcodes;

            ArrayList folders = new ArrayList();

            foreach (SimPe.ExpansionItem ei in SimPe.PathProvider.Global.Expansions)
            {
                if (!ei.Exists)
                {
                    continue;
                }

                foreach (string s in ei.SimNameDeepSearch)
                {
                    string path = System.IO.Path.Combine(SimPe.PathProvider.Global.Latest.InstallFolder, s);
                    if (!Directory.Exists(path))
                    {
                        path = System.IO.Path.Combine(ei.InstallFolder, s);
                    }
                    if (Directory.Exists(path))
                    {
                        folders.Add(new SimPe.FileTableItem(path));
                    }
                }
            }


            characterfi = new SimPe.Plugin.FileIndex(folders);
        }
示例#4
0
        /// <summary>
        /// Show the Graph
        /// </summary>
        /// <param name="pkg"></param>
        /// <param name="fileindex"></param>
        /// <remarks>Do not run twice</remarks>
        public void BuildGraph(SimPe.Interfaces.Files.IPackageFile pkg, SimPe.Interfaces.Scenegraph.IScenegraphFileIndex fileindex)
        {
            gc.BeginUpdate();
            gc.Clear();
            gc.SaveBounds = false;
            gc.AutoSize   = true;
            this.coords.Clear();
            this.names.Clear();
            if (WaitingScreen.Running)
            {
                WaitingScreen.UpdateMessage("Scaning MMAT Tree");
            }
            SimPe.Interfaces.Files.IPackedFileDescriptor[] pfds = pkg.FindFiles(Data.MetaData.MMAT);
            foreach (SimPe.Interfaces.Files.IPackedFileDescriptor pfd in pfds)
            {
                AddItem(pfd, pkg, null, fileindex);
            }

            if (WaitingScreen.Running)
            {
                WaitingScreen.UpdateMessage("Scaning CRES Tree");
            }
            pfds = pkg.FindFiles(Data.MetaData.CRES);
            foreach (SimPe.Interfaces.Files.IPackedFileDescriptor pfd in pfds)
            {
                AddItem(pfd, pkg, null, fileindex);
            }

            gc.AutoSize   = false;
            gc.SaveBounds = true;
            gc.EndUpdate();
        }
示例#5
0
        public static void DeAssignFileTable()
        {
            if (mfi != null)
            {
                FileTable.FileIndex.RemoveChild(mfi);
                mfi.Clear();
                mfi.ClearChilds();
            }

            mfi = null;
        }
示例#6
0
 public static void AssignFileTable()
 {
     DeAssignFileTable();
     if (mfi == null)
     {
         mfi = FileTable.FileIndex.AddNewChild();
     }
     else
     {
         FileTable.FileIndex.AddChild(mfi);
     }
 }
示例#7
0
        public static Ambertation.Scenes.Scene BuildScene(SimPe.Interfaces.Scenegraph.IScenegraphFileIndex fii, MmatWrapper mmat, SimPe.Interfaces.Files.IPackageFile package, out SimPe.Interfaces.Files.IPackageFile npkg)
        {
            npkg = null;
            try
            {
                FileTable.FileIndex.Load();
                if (System.IO.File.Exists(package.SaveFileName))
                {
                    fii.AddIndexFromFolder(System.IO.Path.GetDirectoryName(package.SaveFileName));
                }

                npkg = SimPe.Plugin.Tool.Dockable.ObjectWorkshopHelper.CreatCloneByCres(mmat.ModelName);
                try
                {
                    foreach (SimPe.Interfaces.Files.IPackedFileDescriptor pfd in package.Index)
                    {
                        SimPe.Interfaces.Files.IPackedFileDescriptor npfd = pfd.Clone();
                        npfd.UserData = package.Read(pfd).UncompressedData;
                        if (pfd == mmat.FileDescriptor)
                        {
                            mmat.ProcessData(npfd, npkg);
                        }

                        npkg.Add(npfd, true);
                    }

                    fii.AddIndexFromPackage(npkg, true);
                    //fii.WriteContentToConsole();

                    return(RenderScene(mmat));
                }
                finally
                {
                }
            }
            catch (System.IO.FileNotFoundException)
            {
                Wait.Stop();
                if (MessageBox.Show("The Microsoft Managed DirectX Extensions were not found on your System. Without them, the Preview is not available.\n\nYou can install them manually, by extracting the content of the DirectX\\ManagedDX.CAB on your Sims 2 Installation CD #1. If you double click on the extracted msi File, all needed Files will be installed.\n\nYou can also let SimPE install it automatically. SimPE will download the needed Files (3.5MB) from the SimPE Homepage and install them. Do you want SimPE to download and install the Files?", "Warning", MessageBoxButtons.YesNo) == DialogResult.Yes)
                {
                    if (WebUpdate.InstallMDX())
                    {
                        MessageBox.Show("Managed DirectX Extension were installed succesfully!");
                    }
                }

                return(null);
            }


            //return null;
        }
示例#8
0
        /// <summary>
        /// Updates and Loads the Memory Cache
        /// </summary>
        /// <returns></returns>
        public static MemoryCacheFile InitCacheFile(SimPe.Interfaces.Scenegraph.IScenegraphFileIndex fileindex)
        {
            Wait.SubStart();
            Wait.Message = "Loading Memorycache";

            MemoryCacheFile cachefile = new MemoryCacheFile();

            cachefile.Load(Helper.SimPeLanguageCache, true);
            cachefile.ReloadCache(fileindex, true);
            Wait.SubStop();

            return(cachefile);
        }
示例#9
0
        /// <summary>
        /// Build the SceneGraph
        /// </summary>
        /// <param name="prov"></param>
        /// <param name="simpe_pkg"></param>
        public void Execute(IProviderRegistry prov, SimPe.Interfaces.Files.IPackageFile simpe_pkg, ref SimPe.Interfaces.Files.IPackedFileDescriptor pfd)
        {
            this.pfd      = pfd;
            this.open_pkg = simpe_pkg;
            WaitingScreen.Wait();
            try
            {
                llopen.Enabled = false;
                SimPe.Interfaces.Files.IPackageFile orgpkg = simpe_pkg;

                DateTime start = DateTime.Now;
                FileTable.FileIndex.Load();
                SimPe.Interfaces.Scenegraph.IScenegraphFileIndex fileindex = FileTable.FileIndex.Clone();
                fileindex.AddIndexFromPackage(simpe_pkg);

                SimPe.Interfaces.Scenegraph.IScenegraphFileIndex oldfileindex = FileTable.FileIndex;
                FileTable.FileIndex = fileindex;

                //find txtr File

                /*WaitingScreen.UpdateMessage("Collecting Global Files");
                 * string[] modelnames = Scenegraph.FindModelNames(simpe_pkg);
                 * try
                 * {
                 *  ObjectCloner oc = new ObjectCloner();
                 *  oc.RcolModelClone(modelnames, false, false);
                 *  simpe_pkg = oc.Package;
                 * }
                 * catch (ScenegraphException) {}*/

                FileTable.FileIndex = oldfileindex;


                gb.BuildGraph(simpe_pkg, fileindex);
                gb.FindUnused(orgpkg);

                WaitingScreen.Stop();
                TimeSpan runtime = DateTime.Now.Subtract(start);
                if (Helper.WindowsRegistry.HiddenMode)
                {
                    Text = "Runtime: " + runtime.TotalSeconds + " sek. = " + runtime.TotalMinutes + " min.";
                }
                RemoteControl.ShowSubForm(this);

                pfd = this.pfd;
            }
#if !DEBUG
            catch (Exception ex) { Helper.ExceptionMessage("", ex); }
#endif
            finally { WaitingScreen.Stop(); }
        }
示例#10
0
        public static Ambertation.Scenes.Scene BuildScene(SimPe.Interfaces.Scenegraph.IScenegraphFileIndex fii, MmatWrapper mmat, SimPe.Interfaces.Files.IPackageFile package)
        {
            SimPe.Interfaces.Files.IPackageFile npkg;
            Ambertation.Scenes.Scene            scn = BuildScene(fii, mmat, package, out npkg);

            if (npkg != null)
            {
                npkg.Close();
                if (npkg is SimPe.Packages.GeneratableFile)
                {
                    ((SimPe.Packages.GeneratableFile)npkg).Dispose();
                }
            }
            npkg = null;

            return(scn);
        }
示例#11
0
        /// <summary>
        /// Creates the List for the specific Folder
        /// </summary>
        /// <param name="folder">The Folder with the Character Files</param>
        public LotProvider(string folder) : base()
        {
            BaseFolder = folder;

            ArrayList folders = new ArrayList();

            /*if (Helper.WindowsRegistry.EPInstalled>=1)
             * {
             *      folders.Add(new SimPe.FileTableItem(System.IO.Path.Combine(Helper.WindowsRegistry.SimsEP1Path, @"TSData\Res\NeighborhoodTemplate\U001\Lots\")));
             *      folders.Add(new SimPe.FileTableItem(System.IO.Path.Combine(Helper.WindowsRegistry.SimsEP1Path, @"TSData\Res\NeighborhoodTemplate\U002\Lots\")));
             *      folders.Add(new SimPe.FileTableItem(System.IO.Path.Combine(Helper.WindowsRegistry.SimsEP1Path, @"TSData\Res\NeighborhoodTemplate\U003\Lots\")));
             * }
             * if (Helper.WindowsRegistry.EPInstalled>=2)
             * {
             *      folders.Add(new SimPe.FileTableItem(System.IO.Path.Combine(Helper.WindowsRegistry.SimsEP2Path, @"TSData\Res\NeighborhoodTemplate\D001\Lots\")));
             * }*/

            lotfi  = new SimPe.Plugin.FileIndex(folders);
            ngbhfi = lotfi.AddNewChild();
        }
示例#12
0
        /// <summary>
        /// Returns the RCOL which lists this Resource in it's ReferencedFiles Attribute
        /// </summary>
        /// <returns>null or the RCOl Ressource</returns>
        public Rcol FindReferencingCRES()
        {
            Wait.SubStart();
            //WaitingScreen.Wait();
            try
            {
                SimPe.Interfaces.Scenegraph.IScenegraphFileIndex nfi = FileTable.FileIndex.AddNewChild();
                nfi.AddIndexFromPackage(this.Parent.Package);
                Rcol cres = FindReferencingCRES_Int();
                FileTable.FileIndex.RemoveChild(nfi);
                nfi.Clear();

                if (cres == null && !FileTable.FileIndex.Loaded)
                {
                    FileTable.FileIndex.Load();
                    cres = FindReferencingCRES_Int();
                }


                return(cres);
            }
            finally { Wait.SubStop(); /*WaitingScreen.Stop();*/ }
        }
示例#13
0
        protected void PostponedRender(object sender, EventArgs e)
        {
            Wait.SubStart();
            Wait.Message = "Building Preview";
            PackageInfo nfo = sender as PackageInfo;

            object[] data = nfo.RenderData as object[];
            tmppkg = SimPe.Packages.GeneratableFile.LoadFromFile(data[1].ToString());
            if (tmppkg == null)
            {
                return;
            }

            SimPe.Interfaces.Scenegraph.IScenegraphFileIndex fii = SimPe.Plugin.DownloadsToolFactory.TeleportFileIndex.AddNewChild();
            SimPe.Plugin.MmatWrapper mmat = data[0] as SimPe.Plugin.MmatWrapper;

            mmat.ProcessData(mmat.FileDescriptor, tmppkg);
            if (mmat != null)
            {
                fii.AddIndexFromPackage(mmat.Package, true);
                try
                {
                    Ambertation.Scenes.Scene scn = SimPe.Plugin.PreviewForm.RenderScene(mmat);
                    nfo.RenderedImage = Downloads.DefaultTypeHandler.Get3dPreview(scn);
                    scn.Dispose();
                    mmat.Dispose();
                }
                catch {}
            }


            fii.CloseAssignedPackages();
            SimPe.Plugin.DownloadsToolFactory.TeleportFileIndex.RemoveChild(fii);

            this.DisposeTmpPkg();
            Wait.SubStop();
        }
示例#14
0
        /// <summary>
        /// Create a 1:1 Clone based on the passed GUID
        /// </summary>
        /// <param name="guid"></param>
        /// <returns></returns>
        public static SimPe.Packages.GeneratableFile CreatCloneByGuid(uint guid)
        {
            SimPe.Packages.GeneratableFile         package = SimPe.Packages.GeneratableFile.CreateNew();
            SimPe.Interfaces.IAlias                a;
            Interfaces.Files.IPackedFileDescriptor pfd;
            uint            localgroup;
            OWCloneSettings cs;

            ObjectWorkshopHelper.PrepareForClone(package, out a, out localgroup, out pfd, out cs);
            SimPe.Interfaces.Scenegraph.IScenegraphFileIndex fii = FileTable.FileIndex.AddNewChild();

            SimPe.Cache.MemoryCacheItem mci = SimPe.PackedFiles.Wrapper.ObjectComboBox.ObjectCache.FindItem(guid);
            if (mci != null)
            {
                localgroup = mci.FileDescriptor.Group;
                if (localgroup == Data.MetaData.LOCAL_GROUP)
                {
                    SimPe.Interfaces.Wrapper.IGroupCacheItem gci = SimPe.FileTable.GroupCache.GetItem(mci.ParentCacheContainer.FileName);
                    if (gci != null)
                    {
                        if (!FileTable.FileIndex.Contains(mci.ParentCacheContainer.FileName))
                        {
                            fii.AddIndexFromPackage(mci.ParentCacheContainer.FileName);
                        }

                        localgroup = gci.LocalGroup;
                    }
                }
                ObjectWorkshopHelper.BaseClone(localgroup, package, false);
            }

            SimPe.Packages.GeneratableFile ret = ObjectWorkshopHelper.Start(package, a, ref pfd, localgroup, cs, true);
            fii.CloseAssignedPackages();
            FileTable.FileIndex.RemoveChild(fii);

            return(ret);
        }
示例#15
0
        public void ReloadCache(SimPe.Interfaces.Scenegraph.IScenegraphFileIndex fileindex, bool save)
        {
            Interfaces.Scenegraph.IScenegraphFileIndexItem[] items = fileindex.FindFile(Data.MetaData.OBJD_FILE, true);

            bool added = false;

            Wait.MaxProgress = items.Length;
            Wait.Message     = "Updating Cache";
            int ct = 0;

            foreach (SimPe.Interfaces.Scenegraph.IScenegraphFileIndexItem item in items)
            {
                Interfaces.Scenegraph.IScenegraphFileIndexItem[] citems = this.FileIndex.FindFile(item.GetLocalFileDescriptor(), null);
                if (citems.Length == 0)
                {
                    SimPe.PackedFiles.Wrapper.ExtObjd objd = new SimPe.PackedFiles.Wrapper.ExtObjd();
                    objd.ProcessData(item);

                    this.AddItem(objd);
                    added = true;
                }
                Wait.Progress = ct++;
            }

            if (added)
            {
                this.map     = null;
                Wait.Message = "Saving Chache";
                if (save)
                {
                    this.Save(this.FileName);
                }
                this.LoadMemTable();
                this.LoadMemList();
            }
        }
示例#16
0
        //static Ambertation.Panel3D p3d;
        public static void Execute(SimPe.PackedFiles.Wrapper.Cpf cmmat, SimPe.Interfaces.Files.IPackageFile package)
        {
            if (!(cmmat is MmatWrapper))
            {
                return;
            }

            MmatWrapper mmat = cmmat as MmatWrapper;

            Wait.Start();
            SimPe.Interfaces.Scenegraph.IScenegraphFileIndex fii = FileTable.FileIndex.AddNewChild();
            try
            {
                FileTable.FileIndex.Load();
                fii.AddIndexFromPackage(package);
                if (System.IO.File.Exists(package.SaveFileName))
                {
                    fii.AddIndexFromFolder(System.IO.Path.GetDirectoryName(package.SaveFileName));
                }


                GenericRcol rcol = mmat.GMDC;
                if (rcol != null)
                {
                    GeometryDataContainerExt gmdcext = new GeometryDataContainerExt(rcol.Blocks[0] as GeometryDataContainer);
                    gmdcext.UserTxmtMap[mmat.SubsetName] = mmat.TXMT;
                    gmdcext.UserTxtrMap[mmat.SubsetName] = mmat.TXTR;
                    Ambertation.Scenes.Scene scene = gmdcext.GetScene(new SimPe.Plugin.Gmdc.ElementOrder(Gmdc.ElementSorting.Preview));

                    PreviewForm f = new PreviewForm();
                    f.dx.AddScene(scene);
                    f.dx.ResetDefaultViewport();
                    f.ShowDialog();
                    f.dx.Meshes.Clear(true);
                }
                else
                {
                    Exception();
                }
            }
            catch (System.IO.FileNotFoundException)
            {
                Wait.Stop();
                if (MessageBox.Show("The Microsoft Managed DirectX Extensions were not found on your System. Without them, the Preview is not available.\n\nYou can install them manually, by extracting the content of the DirectX\\ManagedDX.CAB on your Sims 2 Installation CD #1. If you double click on the extracted msi File, all needed Files will be installed.\n\nYou can also let SimPE install it automatically. SimPE will download the needed Files (3.5MB) from the SimPE Homepage and install them. Do you want SimPE to download and install the Files?", "Warning", MessageBoxButtons.YesNo) == DialogResult.Yes)
                {
                    if (WebUpdate.InstallMDX())
                    {
                        MessageBox.Show("Managed DirectX Extension were installed succesfully!");
                    }
                }

                return;
            }
            catch (Exception ex)
            {
                Wait.Stop();
                Helper.ExceptionMessage(ex);
            }
            finally
            {
                FileTable.FileIndex.RemoveChild(fii);
                fii.Clear();
            }
            Wait.Stop();
        }
示例#17
0
        protected virtual bool BeforeLoadContent(SimPe.Cache.PackageType type, SimPe.Interfaces.Files.IPackageFile pkg)
        {
            bool ret = false;

            DisposeTmpPkg();

            SimPe.Interfaces.Files.IPackedFileDescriptor[] pfds = pkg.FindFiles(Data.MetaData.MMAT);
            if (pfds.Length > 0)
            {
                SimPe.Plugin.MmatWrapper mmat = new MmatWrapper();
                mmat.ProcessData(pfds[0], pkg);
                nfo.Name = mmat.ModelName + ", " + mmat.SubsetName;

                if (SimPe.Plugin.DownloadsToolFactory.Settings.LoadBasedataForRecolors)
                {
                    SimPe.Interfaces.Scenegraph.IScenegraphFileIndex fii = SimPe.Plugin.DownloadsToolFactory.TeleportFileIndex.AddNewChild();
                    if (System.IO.File.Exists(pkg.SaveFileName))
                    {
                        string   dir   = System.IO.Path.GetDirectoryName(pkg.SaveFileName);
                        string[] files = System.IO.Directory.GetFiles(dir);
                        foreach (string file in files)
                        {
                            if (file.EndsWith(".package") || file.EndsWith(".sims"))
                            {
                                if (!FileTable.FileIndex.Contains(file))
                                {
                                    fii.AddIndexFromPackage(file);
                                }
                            }
                        }
                    }

                    //SimPe.Plugin.DownloadsToolFactory.TeleportFileIndex.WriteContentToConsole();
                    tmppkg = SimPe.Plugin.Tool.Dockable.ObjectWorkshopHelper.CreatCloneByGuid(mmat.ObjectGUID);
                    if (SimPe.Plugin.DownloadsToolFactory.Settings.BuildPreviewForRecolors)
                    {
                        if (tmppkg.Index.Length > 0)
                        {
                            ret = true;
                        }
                        tmppkg.CopyDescriptors(pkg);
                        foreach (SimPe.Interfaces.Files.IPackedFileDescriptor pfd in tmppkg.Index)
                        {
                            if (pfd.Equals(mmat.FileDescriptor))
                            {
                                mmat.ProcessData(pfd, tmppkg);
                            }
                        }

                        string name  = "render.tmp";
                        int    index = 0;

                        string rname = null;
                        do
                        {
                            rname = System.IO.Path.Combine(Helper.SimPeTeleportPath, index + "_" + name);
                            index++;
                        } while (System.IO.File.Exists(rname));
                        tmppkg.Save(rname);

                        nfo.RenderData        = new object[] { mmat, tmppkg.SaveFileName };
                        nfo.PostponedRenderer = new EventHandler(PostponedRender);
                    }

                    fii.CloseAssignedPackages();
                    SimPe.Plugin.DownloadsToolFactory.TeleportFileIndex.RemoveChild(fii);
                }
            }

            return(ret);
        }
示例#18
0
        void AddItem(SimPe.Interfaces.Files.IPackedFileDescriptor pfd, SimPe.Interfaces.Files.IPackageFile pkg, GraphItem parent, SimPe.Interfaces.Scenegraph.IScenegraphFileIndex fileindex)
        {
            #region Default Setup
            int top  = -128;
            int left = 0;

            if (parent != null)
            {
                top = parent.Location.Y;
            }
            do
            {
                top += 128;
                if (coords.ContainsKey(top))
                {
                    left = (int)coords[top];
                }
                //if (parent!=null) if (left<parent.Location.X) left = parent.Location.X;
            } while (left > gc.Parent.Width && false);

            GraphItem gi = new GraphItem(new Ambertation.Collections.PropertyItems());
            gi.Text = Hashes.StripHashFromName(pfd.Filename);
            //gi.BeginUpdate();
            //gi.Location = new Point(left, top);
            gi.SetBounds(left, top, 200, 64);
            gi.GotFocus += new EventHandler(gi_GotFocus);
            gi.Tag       = Hashes.StripHashFromName(pfd.Filename);
            gi.Fade      = 0.7f;
            //gi.LinkColor = Color.FromArgb(35, Color.Black);
            //gi.SelectedLinkColor = Color.FromArgb(0xff, Color.DarkBlue);

            SimPe.Data.TypeAlias ta = Data.MetaData.FindTypeAlias(pfd.Type);
            gi.Properties["Type"].Value      = ta.shortname;
            gi.Properties["Available"].Value = "false";
            //gi.Parent = gc;
            #endregion

            //check if we already have a reource of that kind
            string name = gi.Text.Trim().ToLower();
            if (names.ContainsKey(name))
            {
                //gi.EndUpdate();
                gi = (GraphItem)names[name];

                if (parent != null)
                {
                    parent.ChildItems.Add(gi);
                }
            }
            else
            {
                #region find File
                SimPe.Interfaces.Scenegraph.IScenegraphItem  item   = null;
                SimPe.Interfaces.Files.IPackedFileDescriptor pkgpfd = pkg.FindFile(pfd);

                //not found in the passed package, look for a global File with that Name
                if (pkgpfd == null)
                {
                    SimPe.Interfaces.Scenegraph.IScenegraphFileIndexItem items = FileTable.FileIndex.FindFileByName(pfd.Filename, pfd.Type, pfd.Group, true);
                    if (items != null)
                    {
                        gi.Properties["Available"].Value = "extern";
                        gi.Properties["File"].Value      = items.Package.FileName;
                        gi.Size       = new Size(gi.Size.Width, 70);
                        gi.PanelColor = Color.Black;
                    }
                }
                #endregion

                //the file is available, so add it
                if (pkgpfd != null)
                {
                    gi.Properties["Available"].Value = "true";
                    if (colors.ContainsKey(ta.shortname))
                    {
                        gi.PanelColor = (Color)colors[ta.shortname];
                    }

                    if (Data.MetaData.RcolList.Contains(pfd.Type))
                    {
                        item = BuildRcol(pkgpfd, pkg, gi);
                    }
                    else if (pfd.Type == Data.MetaData.MMAT)
                    {
                        item = BuildMmat(pkgpfd, pkg, gi);
                    }

                    /*}
                     * else
                     * {
                     *      if (Data.MetaData.RcolList.Contains(pfd.Type)) item = BuildRcol(pkgpfd, altpkg, gi);
                     *      else if (pfd.Type==Data.MetaData.MMAT) item = BuildMmat(pkgpfd, altpkg, gi);
                     * }*/

                    //check again if we still don't have that file
                    name = gi.Text.Trim().ToLower();
                    if (names.ContainsKey(name))
                    {
                        //gi.EndUpdate();
                        gi = (GraphItem)names[name];
                    }
                    else
                    {
                        //now process the Reference Files
                        if (item != null)
                        {
                            Hashtable ht = item.ReferenceChains;
                            foreach (ArrayList list in ht.Values)
                            {
                                foreach (SimPe.Interfaces.Files.IPackedFileDescriptor spfd in list)
                                {
                                    AddItem(spfd, pkg, gi, fileindex);
                                }
                            }
                        }
                    }
                }

                gi.Invalidate();

                if (!names.ContainsKey(name))
                {
                    names.Add(name, gi);
                    gi.Parent   = gc;
                    coords[top] = left + 8 + gi.Size.Width;

                    if (pkgpfd == null)
                    {
                        gi.PanelColor  = Color.DarkRed;
                        gi.ForeColor   = Color.White;
                        gi.BorderColor = gi.ForeColor;

                        if ((string)gi.Properties["Available"].Value == "extern")
                        {
                            gi.PanelColor = Color.Black;
                        }
                    }
                }


                if (parent != null)
                {
                    parent.ChildItems.Add(gi);
                }
            }

            //gi.EndUpdate();
        }