示例#1
0
        private void RcolSearch(object sender, System.Windows.Forms.LinkLabelLinkClickedEventArgs e)
        {
            if (cbusefileindex.Checked)
            {
                WaitingScreen.Wait();
                try { SimPe.FileTable.FileIndex.Load(); }
                finally { WaitingScreen.Stop(this); }

                lblist.Items.Clear();
                SimPe.Packages.PackedFileDescriptor pfd = new SimPe.Packages.PackedFileDescriptor();
                pfd.SubType  = Hashes.SubTypeHash(Hashes.StripHashFromName(tbflname.Text));
                pfd.Instance = Hashes.InstanceHash(Hashes.StripHashFromName(tbflname.Text));

                SimPe.Interfaces.Scenegraph.IScenegraphFileIndexItem[] items = FileTable.FileIndex.FindFileByInstance(pfd.LongInstance);

                //short Index
                if (items.Length == 0)
                {
                    pfd.SubType = 0;
                    items       = FileTable.FileIndex.FindFileByInstance(pfd.LongInstance);
                }

                foreach (SimPe.Interfaces.Scenegraph.IScenegraphFileIndexItem item in items)
                {
                    lblist.Items.Add(item.Package.FileName);
                }

                btopen.Tag = true;
            }
            else
            {
                this.StartSearch(new SeekerFunction(this.RcolSearch), package.FindFile(Hashes.StripHashFromName(tbflname.Text)));
            }
        }
示例#2
0
        /// <summary>
        /// Create a new Instance and load the main Template Files
        /// </summary>
        /// <param name="package"></param>
        public PhotoStudioTemplate(Interfaces.Files.IPackageFile package)
        {
            this.package = package;

            Interfaces.Files.IPackedFileDescriptor pfd = package.FindFile(0xEBCF3E27, 0xffffffff, 0xffffffff, 0xffffffff);
            pset = new SimPe.PackedFiles.Wrapper.Cpf();
            ctss = null;
            if (pfd != null)
            {
                pset.ProcessData(pfd, package);

                pfd = package.FindFile(Data.MetaData.CTSS_FILE, 0xffffffff, 0xffffffff, pset.GetSaveItem("description").UIntegerValue);
                if (pfd != null)
                {
                    ctss = new SimPe.PackedFiles.Wrapper.Str();
                    ctss.ProcessData(pfd, package);
                }
            }
        }
示例#3
0
        /// <summary>
        /// Create a cloned Sim
        /// </summary>
        /// <returns>the new Package for the patient Sim</returns>
        public SimPe.Packages.GeneratableFile CloneSim()
        {
            SimPe.Packages.GeneratableFile ret = SimPe.Packages.GeneratableFile.LoadFromFile((string)null);



            ArrayList list = new ArrayList();

            list.Add((uint)0xAC506764);             //3IDR
            list.Add(Data.MetaData.GZPS);           //GZPS, Property Set
            list.Add((uint)0xAC598EAC);             //AGED
            list.Add((uint)0xCCCEF852);             //LxNR, Face
            list.Add((uint)0x856DDBAC);             //IMG
            list.Add((uint)0x534C4F54);             //SLOT
            list.AddRange(Data.MetaData.RcolList);

            uint hashgroup = this.GetPatientHash();


            foreach (Interfaces.Files.IPackedFileDescriptor pfd in archetype.Index)
            {
                if (list.Contains(pfd.Type))
                {
                    Interfaces.Files.IPackedFile fl = archetype.Read(pfd);

                    Interfaces.Files.IPackedFileDescriptor newpfd = ret.NewDescriptor(pfd.Type, pfd.SubType, pfd.Group, pfd.Instance);
                    newpfd.UserData = fl.UncompressedData;
                    ret.Add(newpfd);

                    ///This is a scenegraph Resource and needs a new Hash
                    if (Data.MetaData.RcolList.Contains(pfd.Type))
                    {
                        SimPe.Plugin.Rcol rcol = new GenericRcol(null, false);
                        rcol.ProcessData(newpfd, ret);

                        rcol.FileName = "#0x" + Helper.HexString(hashgroup) + "!" + Hashes.StripHashFromName(rcol.FileName);

                        switch (pfd.Type)
                        {
                        case Data.MetaData.SHPE:
                        {
                            Shape shp = (Shape)rcol.Blocks[0];
                            foreach (ShapeItem i in shp.Items)
                            {
                                i.FileName = "#0x" + Helper.HexString(hashgroup) + "!" + Hashes.StripHashFromName(i.FileName);
                            }
                            break;
                        }
                        }
                        rcol.SynchronizeUserData();
                    }
                }
            }

            list.Add((uint)0xE86B1EEF);             //make sure the compressed Directory won't be copied!
            foreach (Interfaces.Files.IPackedFileDescriptor pfd in patient.Index)
            {
                if (!list.Contains(pfd.Type))
                {
                    Interfaces.Files.IPackedFile fl = patient.Read(pfd);

                    Interfaces.Files.IPackedFileDescriptor newpfd = ret.NewDescriptor(pfd.Type, pfd.SubType, pfd.Group, pfd.Instance);
                    newpfd.UserData = fl.UncompressedData;
                    ret.Add(newpfd);
                }
            }

            //Copy DNA File
            Interfaces.Files.IPackedFileDescriptor dna = ngbh.FindFile(0xEBFEE33F, 0, Data.MetaData.LOCAL_GROUP, sarchetype.Instance);
            if (dna != null)
            {
                Interfaces.Files.IPackedFileDescriptor tna = ngbh.FindFile(0xEBFEE33F, 0, Data.MetaData.LOCAL_GROUP, spatient.Instance);
                if (tna == null)
                {
                    tna         = ngbh.NewDescriptor(0xEBFEE33F, 0, Data.MetaData.LOCAL_GROUP, spatient.Instance);
                    tna.Changed = true;
                    ngbh.Add(tna);
                }

                Interfaces.Files.IPackedFile fl = ngbh.Read(dna);

                tna.UserData = fl.UncompressedData;
            }

            UpdateFaceStructure(ret);
            return(ret);
        }