Esempio n. 1
0
        protected virtual SimPe.PackedFiles.Wrapper.StrItemList GetCtssItems(Interfaces.Files.IPackedFileDescriptor ctss, SimPe.Interfaces.Files.IPackageFile pkg)
        {
            if (ctss != null)
            {
                SimPe.PackedFiles.Wrapper.Str str = new SimPe.PackedFiles.Wrapper.Str();
                str.ProcessData(ctss, pkg);

                return(str.FallbackedLanguageItems(Helper.WindowsRegistry.LanguageCode));
            }

            return(null);
        }
Esempio n. 2
0
        /// <summary>
        /// Loads String Resource from the Package
        /// </summary>
        /// <param name="list">The List where you want to store the Resource</param>
        /// <param name="instance">The Instance of the TextFile</param>
        /// <param name="lang">The Language Number</param>
        public void LoadData(ref ArrayList list, ushort instance, ushort lang)
        {
            list = new ArrayList();
            if (BasePackage == null)
            {
                return;
            }

            IPackedFileDescriptor pfd = BasePackage.FindFile(Data.MetaData.STRING_FILE, 0x00000000, 0x7FE59FD0, instance);

            SimPe.PackedFiles.Wrapper.Str str = new SimPe.PackedFiles.Wrapper.Str();
            str.ProcessData(pfd, BasePackage);
            SimPe.PackedFiles.Wrapper.StrItemList sis = str.FallbackedLanguageItems((SimPe.Data.MetaData.Languages)lang);
            for (ushort i = 0; i < sis.Length; i++)
            {
                list.Add(sis[i].Title);
            }                   //for
        }
Esempio n. 3
0
        protected override void StartThread()
        {
            lotfi.Load();
            SimPe.Interfaces.Scenegraph.IScenegraphFileIndexItem[] items = lotfi.FindFile(0x856DDBAC, Data.MetaData.LOCAL_GROUP, 0x35CA0002, null);
            bool run = Wait.Running;

            if (!run)
            {
                Wait.Start();
            }
            Wait.SubStart(items.Length);
            try
            {
                int ct   = 0;
                int step = Math.Max(2, Wait.MaxProgress / 100);
                foreach (SimPe.Interfaces.Scenegraph.IScenegraphFileIndexItem item in items)
                {
                    if (this.HaveToStop)
                    {
                        break;
                    }


                    SimPe.Interfaces.Files.IPackageFile pkg = item.Package;

                    SimPe.Interfaces.Files.IPackedFileDescriptor pfd = pkg.FindFile(Data.MetaData.STRING_FILE, 0, Data.MetaData.LOCAL_GROUP, 0x00000A46);
                    string name = SimPe.Localization.GetString("Unknown");
                    if (pfd != null)
                    {
                        SimPe.PackedFiles.Wrapper.Str str = new SimPe.PackedFiles.Wrapper.Str();
                        str.ProcessData(pfd, pkg);

                        SimPe.PackedFiles.Wrapper.StrItemList list = str.FallbackedLanguageItems(Helper.WindowsRegistry.LanguageCode);
                        if (list.Count > 0)
                        {
                            name = list[0].Title;
                        }
                    }

                    SimPe.PackedFiles.Wrapper.Picture pic = new SimPe.PackedFiles.Wrapper.Picture();
                    pic.ProcessData(item);

                    uint inst = GetInstanceFromFilename(pkg.SaveFileName);

                    SimPe.Interfaces.Scenegraph.IScenegraphFileIndexItem[] ltxtitems = ngbhfi.FindFile(0x0BF999E7, Data.MetaData.LOCAL_GROUP, inst, null);
                    SimPe.Interfaces.Scenegraph.IScenegraphFileIndexItem   ltxt      = null;
                    if (ltxtitems.Length > 0)
                    {
                        ltxt = ltxtitems[0];
                    }

                    LotItem li = new LotItem(inst, name, pic.Image, ltxt);
                    if (LoadingLot != null)
                    {
                        LoadingLot(this, li);
                    }
                    content[li.Instance] = li;
                    ct++;
                    if (ct % step == 0)
                    {
                        Wait.Message  = name;
                        Wait.Progress = ct;
                    }
                }                //foreach
            }
#if !DEBUG
            catch (Exception ex)
            {
                Helper.ExceptionMessage(ex);
            }
#endif
            finally
            {
                Wait.SubStop();
                if (!run)
                {
                    Wait.Stop();
                }
            }

            ended.Set();
        }
Esempio n. 4
0
        /// <summary>
        /// Adds a Sim to the List
        /// </summary>
        /// <param name="objd"></param>
        /// <param name="ct"></param>
        /// <param name="step"></param>
        /// <returns>The Alias for that Sim</returns>
        /// <remarks>
        /// Alias.Tag has the following Structure:
        /// [0] : FileName of Character File (if NPC, this will be null)
        /// [1] : Thumbnail
        /// [2] : FamilyName
        /// [3] : Contains Age Data
        /// [4] : When NPC, this will get the Filename
        /// </remarks>
        protected Alias AddSim(SimPe.PackedFiles.Wrapper.ExtObjd objd, ref int ct, int step, bool npc)
        {
            //if (objd.Type!=Data.ObjectTypes.Person) return null;

            SimPe.Interfaces.Files.IPackageFile fl = objd.Package;
            //BinaryReader br = new BinaryReader(File.OpenRead(file));//new StreamReader(file)
            bool hasagedata = fl.FindFiles(0xAC598EAC).Length > 0;           //has Age Data

            object[] tags = new object[5];
            tags[0] = fl.FileName;
            tags[1] = null;
            tags[2] = Localization.Manager.GetString("Unknown");
            tags[3] = hasagedata;
            tags[4] = null;

            /*if (Helper.WindowsRegistry.HiddenMode)
             *      tags[5] = (!hasagedata) && (fl.FindFiles(0xAC506764).Length>0); //if this is true, the Sim has a Problem, and the package was probably split
             * else
             *      tags[5] = false;*/

            //set stuff for NPCs
            if (npc)
            {
                tags[4]  = tags[0];
                tags[0]  = "";
                tags[2] += " (NPC)";
            }

            Alias a = null;



            Interfaces.Files.IPackedFileDescriptor str_pfd = fl.FindFile(Data.MetaData.CTSS_FILE, 0, objd.FileDescriptor.Group, objd.CTSSInstance);

            if (str_pfd != null)
            {
                SimPe.PackedFiles.Wrapper.Str str = new SimPe.PackedFiles.Wrapper.Str();
                str.ProcessData(str_pfd, fl);
                SimPe.PackedFiles.Wrapper.StrItemList its = str.FallbackedLanguageItems(Helper.WindowsRegistry.LanguageCode);
                if (its.Length > 0)
                {
#if DEBUG
                    a = new Alias(objd.Guid, its[0].Title, "{name} {2} (0x{id})");
#else
                    a = new Alias(objd.Guid, its[0].Title, "{name} {2} (0x{id})");
#endif
                    if (its.Length > 2)
                    {
                        tags[2] = its[2].Title;
                    }
                }
            }


            if (a != null)
            {
                IPackedFileDescriptor[] piclist = fl.FindFiles(Data.MetaData.SIM_IMAGE_FILE);
                foreach (IPackedFileDescriptor pfd in piclist)
                {
                    if (pfd.Group != objd.FileDescriptor.Group)
                    {
                        continue;
                    }
                    if (pfd.Instance < 0x200)
                    {
                        SimPe.PackedFiles.Wrapper.Picture pic = new SimPe.PackedFiles.Wrapper.Picture();
                        pic.ProcessData(pfd, fl);

                        /*if (Helper.StartedGui==Executable.Classic)
                         *      WaitingScreen.UpdateImage(pic.Image);
                         * else
                         *      Wait.Image = pic.Image;								*/

                        tags[1] = pic.Image;
                        break;
                    }
                }

                a.Tag = tags;
                //if (Helper.StartedGui!=Executable.Classic)
                {
                    ct++;
                    if (ct % step == 1)
                    {
                        Wait.Message  = a.ToString();
                        Wait.Progress = ct;
                    }
                }

                //set stuff for NPCs
                if (npc)
                {
                    a.Tag[2] = a.Tag[2].ToString() + " (NPC)";
                }

                if (names == null)
                {
                    return(null);
                }
                if (!names.Contains(objd.Guid))
                {
                    names.Add(objd.Guid, a);
                }
            }

            return(a);
        }