Example #1
0
        /// <summary>
        /// Execute the Extended Form
        /// </summary>
        /// <param name="wrp">the sdsc you want to show</param>
        /// <returns>true, if something was changed</returns>
        public static bool Execute(SimPe.PackedFiles.Wrapper.SDesc wrp)
        {
            SdscExtendedForm f = new SdscExtendedForm();

            f.LoadWantTable(wrp.Version);
            byte[] data = wrp.CurrentStateData.ToArray();

            f.rbhex.Checked = (Ambertation.BaseChangeShort.DigitBase == 16);
            f.rbbin.Checked = (Ambertation.BaseChangeShort.DigitBase == 2);
            f.rbdec.Checked = (!f.rbhex.Checked && !f.rbbin.Checked);
            f.propchanged   = false;


            f.ShowData(data);
            f.ok    = false;
            f.Text += " (version=" + wrp.Version.ToString() + ")";
            f.ShowDialog();

            if (f.ok)
            {
                f.UpdateData(data);
                wrp.FileDescriptor.UserData = data;
                wrp.ProcessData(wrp.FileDescriptor, wrp.Package);
            }
            return(f.ok);
        }
Example #2
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);
        }