Beispiel #1
0
        /// <summary>
        /// Searches BHAV Files
        /// </summary>
        /// <param name="pfd"></param>
        /// <param name="package"></param>
        /// <param name="prov"></param>
        /// <returns>Null if no match or a valid SearchItem Object</returns>
        public SearchItem BhavSearch(Interfaces.Files.IPackedFileDescriptor pfd, Interfaces.Files.IPackageFile package, Interfaces.IProviderRegistry prov)
        {
            ushort opcode = Convert.ToUInt16(this.tbOpcode.Text, 16);

            //group Filter
            if (tbbhavgroup.Text.Trim() != "")
            {
                uint group = Convert.ToUInt32(this.tbbhavgroup.Text, 16);
                if (pfd.Group != group)
                {
                    return(null);
                }
            }

            Bhav bhav = new Bhav(prov.OpcodeProvider);

            bhav.ProcessData(pfd, package);

            foreach (Instruction i in bhav)
            {
                if (i.OpCode == opcode)
                {
                    return(new SearchItem(bhav.FileName, pfd));
                }
            }

            return(null);
        }
Beispiel #2
0
        internal Interfaces.Files.IPackedFileDescriptor Execute(Interfaces.Files.IPackageFile package)
        {
            this.package = package;
            this.pfd     = null;
            RemoteControl.ShowSubForm(this);

            return(pfd);
        }
Beispiel #3
0
        /// <summary>
        /// Init the Plastic Surgery
        /// </summary>
        /// <param name="ngbh">The Neighborhood the Sim lives in (needed for DNA)</param>
        /// <param name="patient">The Sim that should be changed</param>
        /// <param name="archetype">The Template Sime</param>
        public PlasticSurgery(Interfaces.Files.IPackageFile ngbh, Interfaces.Files.IPackageFile patient, SDesc spatient, Interfaces.Files.IPackageFile archetype, SDesc sarchetype)
        {
            this.patient   = patient;
            this.archetype = archetype;
            this.ngbh      = ngbh;

            this.spatient   = spatient;
            this.sarchetype = sarchetype;
        }
Beispiel #4
0
        public void Execute(Interfaces.Files.IPackageFile package)
        {
            if (package != null)
            {
                this.tbtext.Text = System.IO.Path.GetFileNameWithoutExtension(package.FileName).ToLower();
            }

            this.Show();
        }
Beispiel #5
0
        /// <summary>
        /// Searches Sims
        /// </summary>
        /// <param name="pfd"></param>
        /// <param name="package"></param>
        /// <param name="prov"></param>
        /// <returns>Null if no match or a valid SearchItem Object</returns>
        public SearchItem GuidSearch(Interfaces.Files.IPackedFileDescriptor pfd, Interfaces.Files.IPackageFile package, Interfaces.IProviderRegistry prov)
        {
            uint guid = Convert.ToUInt32(tbguid.Text, 16);

            SimPe.PackedFiles.Wrapper.ExtObjd objd = new SimPe.PackedFiles.Wrapper.ExtObjd();
            objd.ProcessData(pfd, package);

            if (objd.Guid == guid)
            {
                return(new SearchItem(objd.FileName, pfd));
            }
            return(null);
        }
Beispiel #6
0
        /// <summary>
        /// Searches RCOL Files
        /// </summary>
        /// <param name="pfd"></param>
        /// <param name="package"></param>
        /// <param name="prov"></param>
        /// <returns>Null if no match or a valid SearchItem Object</returns>
        public SearchItem RcolSearch(Interfaces.Files.IPackedFileDescriptor pfd, Interfaces.Files.IPackageFile package, Interfaces.IProviderRegistry prov)
        {
            string flname = Hashes.StripHashFromName(tbflname.Text);
            uint   inst   = Hashes.InstanceHash(flname);
            uint   st     = Hashes.SubTypeHash(flname);

            if ((pfd.Instance == inst) && ((pfd.SubType == st) || pfd.SubType == 0))
            {
                SimPe.Plugin.Rcol rcol = new GenericRcol(prov, false);
                rcol.ProcessData(pfd, package);
                return(new SearchItem(rcol.FileName, pfd));
            }


            return(null);
        }
Beispiel #7
0
        /// <summary>
        /// Searches Sims
        /// </summary>
        /// <param name="pfd"></param>
        /// <param name="package"></param>
        /// <param name="prov"></param>
        /// <returns>Null if no match or a valid SearchItem Object</returns>
        public SearchItem SdscSearch(Interfaces.Files.IPackedFileDescriptor pfd, Interfaces.Files.IPackageFile package, Interfaces.IProviderRegistry prov)
        {
            string name = tbsimname.Text.Trim().ToLower();

            SimPe.PackedFiles.Wrapper.SDesc sdesc = new SimPe.PackedFiles.Wrapper.SDesc(prov.SimNameProvider, prov.SimFamilynameProvider, prov.SimDescriptionProvider);
            sdesc.ProcessData(pfd, package);

            string ext = "";

            if (sdesc.Unlinked != 0x00)
            {
                ext += "unlinked";
            }
            if (!sdesc.AvailableCharacterData)
            {
                if (ext.Trim() != "")
                {
                    ext += ", no Character Data";
                }
            }

            if (ext.Trim() != "")
            {
                ext = " (" + ext + ")";
            }

            string simname = sdesc.SimName + " " + sdesc.SimFamilyName;

            simname = simname.Trim().ToLower();
            if (simname == name)
            {
                return(new SearchItem(simname + ext, pfd));
            }

            simname = sdesc.SimName + " " + sdesc.HouseholdName;
            simname = simname.Trim().ToLower();
            if (simname == name)
            {
                return(new SearchItem(simname + ext, pfd));
            }


            return(null);
        }
Beispiel #8
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);
                }
            }
        }
Beispiel #9
0
        /// <summary>
        /// Searches BHAV Files
        /// </summary>
        /// <param name="pfd"></param>
        /// <param name="package"></param>
        /// <param name="prov"></param>
        /// <returns>Null if no match or a valid SearchItem Object</returns>
        public SearchItem GzpsSearch(Interfaces.Files.IPackedFileDescriptor pfd, Interfaces.Files.IPackageFile package, Interfaces.IProviderRegistry prov)
        {
            ushort opcode = Convert.ToUInt16(this.tbOpcode.Text, 16);

            SimPe.PackedFiles.Wrapper.Cpf cpf = new SimPe.PackedFiles.Wrapper.Cpf();
            cpf.ProcessData(pfd, package);


            //foreach (SimPe.PackedFiles.Wrapper.CpfItem i in cpf.Items)
            {
                bool   check = false;
                string s1    = cpf.GetSaveItem(tbpropname.Text).StringValue.Trim().ToLower();             //i.StringValue.Trim().ToLower();
                string s2    = tbpropval.Text.Trim().ToLower();
                if (rbfull.Checked)
                {
                    check = (s1 == s2);
                }
                if (rbstart.Checked)
                {
                    check = (s1.StartsWith(s2));
                }
                if (rbend.Checked)
                {
                    check = (s1.EndsWith(s2));
                }
                if (rbcont.Checked)
                {
                    check = (s1.IndexOf(s2) != -1);
                }
                if (check)
                {
                    return(new SearchItem(cpf.FileDescriptor.ToString(), pfd));
                }
            }

            return(null);
        }
Beispiel #10
0
 /// <summary>
 /// Set the Enabled state of the Toll MenuItems
 /// </summary>
 /// <param name="mi"></param>
 /// <param name="pfd"></param>
 /// <param name="package"></param>
 public void EnableMenuItems(System.Windows.Forms.MenuItem mi, Interfaces.Files.IPackedFileDescriptor pfd, Interfaces.Files.IPackageFile package)
 {
     foreach (System.Windows.Forms.MenuItem item in mi.MenuItems)
     {
         try
         {
             ToolMenuItem tmi = (ToolMenuItem)item;
             tmi.Package        = package;
             tmi.FileDescriptor = pfd;
             tmi.UpdateEnabledState();
         }
         catch (Exception) {}
     }
 }