Beispiel #1
0
        public ScenegraphResultItem(SimPe.Interfaces.Scenegraph.IScenegraphFileIndexItem fii)
            : base(SimPe.Localization.GetString("Unknown"))
        {
            this.fii = fii;
            SimPe.Interfaces.Plugin.Internal.IPackedFileWrapper wrp = FileTable.WrapperRegistry.FindHandler(fii.FileDescriptor.Type);
            if (wrp != null)
            {
                ((SimPe.Interfaces.Plugin.AbstractWrapper)wrp).Package        = fii.Package;
                ((SimPe.Interfaces.Plugin.AbstractWrapper)wrp).FileDescriptor = fii.FileDescriptor;
                this.Text = wrp.ResourceName;
            }
            else
            {
                this.Text = fii.FileDescriptor.ToString();
            }

            this.SubItems.Add("0x" + Helper.HexString(fii.FileDescriptor.Type));
            this.SubItems.Add("0x" + Helper.HexString(fii.FileDescriptor.Group));
            this.SubItems.Add("0x" + Helper.HexString(fii.FileDescriptor.LongInstance));
            this.SubItems.Add("0x" + Helper.HexString(fii.FileDescriptor.Offset));
            this.SubItems.Add("0x" + Helper.HexString(fii.FileDescriptor.Size));
            this.SubItems.Add(fii.Package.SaveFileName);

            /*this.SubItems.Add("    Type: 0x"+Helper.HexString(fii.FileDescriptor.Type));
             * this.SubItems.Add("    Group: 0x"+Helper.HexString(fii.FileDescriptor.Group));
             * this.SubItems.Add("    Instance: 0x"+Helper.HexString(fii.FileDescriptor.LongInstance));
             * this.SubItems.Add("    Offset: 0x"+Helper.HexString(fii.FileDescriptor.Offset));
             * this.SubItems.Add("    Size: 0x"+Helper.HexString(fii.FileDescriptor.Size));
             * this.SubItems.Add("    "+fii.Package.SaveFileName);*/
        }
Beispiel #2
0
        internal static int GetIndexForResourceType(uint type)
        {
            if (Helper.WindowsRegistry.DecodeFilenamesState)
            {
                SimPe.Interfaces.Plugin.Internal.IPackedFileWrapper wrp = FileTable.WrapperRegistry.FindHandler(type);
                if (wrp != null)
                {
                    return(wrp.WrapperDescription.IconIndex);
                }
            }

            return(0);
        }
Beispiel #3
0
        public SimPe.Interfaces.Plugin.Internal.IPackedFileWrapper SiblingResource(uint type)
        {
            if (FileDescriptor == null)
            {
                return(null);
            }

            pjse.FileTable.Entry[] items = pjse.FileTable.GFT[type, FileDescriptor.Group, FileDescriptor.Instance];
            if (items == null || items.Length == 0)
            {
                return(null);
            }

            SimPe.Interfaces.Plugin.Internal.IPackedFileWrapper wrp = SimPe.FileTable.WrapperRegistry.FindHandler(type);
            wrp.ProcessData(items[0].PFD, items[0].Package);

            return(wrp);
        }
Beispiel #4
0
        public void AddResourceLoop(long fid, SimPe.Packages.PackedFileDescriptor pfd, SimPe.Interfaces.Plugin.Internal.IPackedFileWrapper wrp)
        {
            DataRow row = tbl.NewRow();

            row[1] = pfd.Type;
            row[2] = pfd.Group;
            row[3] = pfd.SubType;
            row[4] = pfd.Instance;
            if (wrp != null)
            {
                row[5] = wrp.ResourceName;
            }
            else
            {
                row[5] = "";
            }
            row[6] = 1;

            tbl.Rows.Add(row);
        }
Beispiel #5
0
        public string GetRealName()
        {
            if (realname == null)
            {
                if (Helper.WindowsRegistry.DecodeFilenamesState)
                {
                    SimPe.Interfaces.Plugin.Internal.IPackedFileWrapper wrp = FileTable.WrapperRegistry.FindHandler(pfd.Type);
                    if (wrp != null)
                    {
                        lock (wrp)
                        {
                            //System.Diagnostics.Debug.WriteLine("Processing " + pfd.Type.ToString("X")+" "+pfd.Offset.ToString("X"));
                            SimPe.Interfaces.Files.IPackedFileDescriptor bakpfd = null;
                            SimPe.Interfaces.Files.IPackageFile          bakpkg = null;
                            if (wrp is SimPe.Interfaces.Plugin.AbstractWrapper)
                            {
                                SimPe.Interfaces.Plugin.AbstractWrapper awrp = (SimPe.Interfaces.Plugin.AbstractWrapper)wrp;
                                if (!awrp.AllowMultipleInstances)
                                {
                                    bakpfd = awrp.FileDescriptor;
                                    bakpkg = awrp.Package;
                                }

                                awrp.FileDescriptor = pfd;
                                awrp.Package        = pkg;
                            }
                            try
                            {
                                realname = wrp.ResourceName;
                            }
#if DEBUG
                            catch (Exception ex)
                            {
                                realname = ex.Message;
                            }
#else
                            catch { realname = pfd.ToResListString(); }
#endif
                            finally
                            {
                                if (bakpfd != null || bakpkg != null)
                                {
                                    if (wrp is SimPe.Interfaces.Plugin.AbstractWrapper)
                                    {
                                        SimPe.Interfaces.Plugin.AbstractWrapper awrp = (SimPe.Interfaces.Plugin.AbstractWrapper)wrp;
                                        if (!awrp.AllowMultipleInstances)
                                        {
                                            awrp.FileDescriptor = bakpfd;
                                            awrp.Package        = bakpkg;
                                        }
                                    }
                                }
                            }
                        } //lock
                    }
                }
                if (realname == null)
                {
                    realname = pfd.ToResListString();
                }
            }

            return(realname);
        }