Esempio n. 1
0
 static void SetFunctionSortForXObj(SimPe.PackedFiles.Wrapper.Cpf cpf, SimPe.Cache.ObjectCacheItem oci)
 {
     oci.ObjectFunctionSort = (uint)ObjectPreview.GetFunctionSort(cpf);
 }
Esempio n. 2
0
        public static Image GetXThumbnail(SimPe.PackedFiles.Wrapper.Cpf cpf)
        {
            if (xthumbs == null)
            {
                xthumbs = SimPe.Packages.File.LoadFromFile(System.IO.Path.Combine(PathProvider.SimSavegameFolder, "Thumbnails\\BuildModeThumbnails.package"));
            }

            SimPe.Packages.File      tmbs = xthumbs;
            Data.XObjFunctionSubSort fss  = ObjectPreview.GetFunctionSort(cpf);

            uint inst = cpf.GetSaveItem("guid").UIntegerValue;
            uint grp  = cpf.FileDescriptor.Group;

            if (cpf.GetItem("thumbnailinstanceid") != null)
            {
                inst = cpf.GetSaveItem("thumbnailinstanceid").UIntegerValue;
                grp  = cpf.GetSaveItem("thumbnailgroupid").UIntegerValue;
            }


            //get Thumbnail Type
            uint[] types = new uint[] { 0x8C311262, 0x8C31125E };           //floors, walls
            if (fss == Data.XObjFunctionSubSort.Roof)
            {
                types = new uint[] { 0xCC489E46 }
            }
            ;
            else if (fss == Data.XObjFunctionSubSort.Fence_Rail || fss == Data.XObjFunctionSubSort.Fence_Halfwall)
            {
                types = new uint[] { 0xCC30CDF8 }
            }
            ;
            else if (fss == Data.XObjFunctionSubSort.Roof)
            {
                types = new uint[] { 0xCC489E46 }
            }
            ;
            else if (fss == Data.XObjFunctionSubSort.Terrain)
            {
                types = new uint[] { 0xEC3126C4 };
                if (cpf.GetItem("texturetname") != null)
                {
                    inst = Hashes.GetCrc32(Hashes.StripHashFromName(cpf.GetItem("texturetname").StringValue.Trim().ToLower()));
                }
            }
            else if (cpf.FileDescriptor.Type == Data.MetaData.XNGB)
            {
                types = new uint[] { 0x4D533EDD };
                if (nthumbs == null)
                {
                    nthumbs = SimPe.Packages.File.LoadFromFile(System.IO.Path.Combine(PathProvider.SimSavegameFolder, "Thumbnails\\CANHObjectsThumbnails.package"));
                }
                tmbs = nthumbs;
            }


            return(GetThumbnail(cpf.GetSaveItem("name").StringValue, types, grp, inst, tmbs));
            //tmbs = null;

            /*ArrayList types = new ArrayList();
             * types.Add(0xEC3126C4); // Terrain
             * types.Add(0xCC30CDF8); //fences
             * types.Add(0x8C311262); //floors
             * types.Add(0xCC489E46); //roof
             * types.Add(0x8C31125E); //wall*/
        }