Exemple #1
0
        public object FindUserTxtr(string name)
        {
            if (txtrs == null)
            {
                this.LoadSkinImages();
            }
            if (txtrs == null)
            {
                return(null);
            }

            name = name.ToLower();
            SimPe.Plugin.Txtr txtr = (SimPe.Plugin.Txtr)txtrs[name];
            if (txtr == null)
            {
                txtr = (SimPe.Plugin.Txtr)txtrs[name + "_txtr"];
            }
            if (txtr == null)
            {
                return(null);
            }

            if (txtr.Fast)
            {
                txtr.Fast = false;
                SimPe.Packages.File fl = SimPe.Packages.File.LoadFromFile(txtr.Package.FileName);
                Interfaces.Files.IPackedFileDescriptor pfd = fl.FindFile(txtr.FileDescriptor.Type, txtr.FileDescriptor.SubType, txtr.FileDescriptor.Group, txtr.FileDescriptor.Instance);
                txtr.ProcessData(pfd, fl);
                //fl.Reader.Close();
            }

            return(txtr);
        }
Exemple #2
0
        public object FindTxtr(string name)
        {
            if (name == null)
            {
                return(null);
            }
            string file = System.IO.Path.Combine(SimPe.PathProvider.Global[Expansions.BaseGame].InstallFolder, "TSData\\Res\\Sims3D\\Sims07.package");

            if (System.IO.File.Exists(file))
            {
                SimPe.Interfaces.Files.IPackageFile      package = SimPe.Packages.File.LoadFromFile(file);
                Interfaces.Files.IPackedFileDescriptor[] pfds    = package.FindFile(name, 0x1C4A276C);

                //look for the right one
                foreach (Interfaces.Files.IPackedFileDescriptor pfd in pfds)
                {
                    SimPe.Plugin.Txtr rcol = new SimPe.Plugin.Txtr(null, false);
                    rcol.ProcessData(pfd, package);
                    if (rcol.FileName.Trim().ToLower() == name.Trim().ToLower())
                    {
                        return(rcol);
                    }
                }
            }

            return(null);
        }
Exemple #3
0
        protected void LoadSkinImageFormPackage(SimPe.Interfaces.Files.IPackageFile package)
        {
            Interfaces.Files.IPackedFileDescriptor[] pfds = package.FindFiles(0xAC506764);
            foreach (Interfaces.Files.IPackedFileDescriptor pfd in pfds)
            {
                try
                {
                    SimPe.Plugin.RefFile reffile = new SimPe.Plugin.RefFile();
                    reffile.ProcessData(pfd, package);
                    refs.Add(reffile);
                }
                catch (Exception) {}
            }

            pfds = package.FindFiles(0x49596978);
            foreach (Interfaces.Files.IPackedFileDescriptor pfd in pfds)
            {
                try
                {
                    SimPe.Plugin.Rcol matd = new SimPe.Plugin.GenericRcol(null, true);
                    matd.ProcessData(pfd, package);
                    matds.Add(matd);
                }
                catch (Exception) {}
            }

            //Material Files
            Interfaces.Files.IPackedFileDescriptor[] nmap_pfd = package.FindFiles(Data.MetaData.NAME_MAP);
            pfds = package.FindFiles(0x49596978);
            Plugin.Nmap nmap = new SimPe.Plugin.Nmap(null);
            if (nmap_pfd.Length > 0)
            {
                nmap.ProcessData(nmap_pfd[0], package);
            }
            bool check = false;

            foreach (Interfaces.Files.IPackedFileDescriptor pfd in pfds)
            {
                try
                {
                    SimPe.Plugin.Rcol matd = new SimPe.Plugin.GenericRcol(null, true);
                    check = false;

                    foreach (Interfaces.Files.IPackedFileDescriptor epfd in nmap.Items)
                    {
                        if (
                            (epfd.Group == pfd.Group) &&
                            (epfd.Instance == pfd.Instance)
                            )
                        {
                            matd.FileDescriptor = pfd;
                            matd.Package        = package;
                            matds.Add(matd);
                            check = true;
                        }
                    }

                    //not found in the FileMap, so process Normally
                    if (!check)
                    {
                        matd.ProcessData(pfd, package);
                        matds.Add(matd);
                    }
                }
                catch (Exception) {}
            }

            //Texture Files
            nmap_pfd = package.FindFiles(Data.MetaData.NAME_MAP);
            pfds     = package.FindFiles(0x1C4A276C);
            check    = false;

            foreach (Interfaces.Files.IPackedFileDescriptor pfd in pfds)
            {
                try
                {
                    SimPe.Plugin.Txtr txtr = new SimPe.Plugin.Txtr(null, true);
                    check = false;

                    foreach (Interfaces.Files.IPackedFileDescriptor epfd in nmap.Items)
                    {
                        if (
                            (epfd.Group == pfd.Group) &&
                            (epfd.Instance == pfd.Instance)
                            )
                        {
                            txtr.FileDescriptor = pfd;
                            txtr.Package        = package;
                            txtrs.Add(epfd.Filename, txtr);
                            continue;
                        }
                    }

                    //not found in the FileMap, so process Normally
                    if (!check)
                    {
                        txtr.ProcessData(pfd, package);
                        foreach (SimPe.Plugin.ImageData id in txtr.Blocks)
                        {
                            txtrs.Add(id.NameResource.FileName.ToLower(), txtr);
                        }
                    }
                }
                catch (Exception) {}
            }
        }