Ejemplo n.º 1
0
        public object FindTxtr(string name)
        {
            if (name == null)
            {
                return(null);
            }
            string file = System.IO.Path.Combine(SimPe.PathProvider.Global[Expansions.BaseGame].InstallFolder, "TSData\\Res\\Sims3D\\Sims07.package");

            if (System.IO.File.Exists(file))
            {
                SimPe.Interfaces.Files.IPackageFile      package = SimPe.Packages.File.LoadFromFile(file);
                Interfaces.Files.IPackedFileDescriptor[] pfds    = package.FindFile(name, 0x1C4A276C);

                //look for the right one
                foreach (Interfaces.Files.IPackedFileDescriptor pfd in pfds)
                {
                    SimPe.Plugin.Txtr rcol = new SimPe.Plugin.Txtr(null, false);
                    rcol.ProcessData(pfd, package);
                    if (rcol.FileName.Trim().ToLower() == name.Trim().ToLower())
                    {
                        return(rcol);
                    }
                }
            }

            return(null);
        }
Ejemplo n.º 2
0
        protected Alias AddSim(SimPe.Interfaces.Files.IPackageFile fl, IPackedFileDescriptor objdpfd, ref int ct, int step)
        {
            SimPe.PackedFiles.Wrapper.ExtObjd objd = new SimPe.PackedFiles.Wrapper.ExtObjd();
            objd.ProcessData(objdpfd, fl);

            return(AddSim(objd, ref ct, step, false));
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Add all Files that could be borrowed from the current package by the passed one, to the passed package
        /// </summary>
        /// <param name="orgmodelnames">List of available modelnames in this package</param>
        /// <param name="pkg">The package that should receive the Files</param>
        /// <remarks>Simply Copies MMAT, LIFO, TXTR and TXMT Files</remarks>
        public void AddParentFiles(string[] orgmodelnames, SimPe.Interfaces.Files.IPackageFile pkg)
        {
            if (WaitingScreen.Running)
            {
                WaitingScreen.UpdateMessage("Loading Parent Files");
            }
            ArrayList names = new ArrayList();

            foreach (string s in orgmodelnames)
            {
                names.Add(s);
            }

            ArrayList types = new ArrayList();

            types.Add(Data.MetaData.MMAT);
            types.Add(Data.MetaData.TXMT);
            types.Add(Data.MetaData.TXTR);
            types.Add(Data.MetaData.LIFO);

            foreach (uint type in types)
            {
                SimPe.Interfaces.Files.IPackedFileDescriptor[] pfds = package.FindFiles(type);
                foreach (SimPe.Interfaces.Files.IPackedFileDescriptor pfd in pfds)
                {
                    if (pkg.FindFile(pfd) != null)
                    {
                        continue;
                    }

                    SimPe.Interfaces.Files.IPackedFile file = package.Read(pfd);
                    pfd.UserData = file.UncompressedData;

                    //Update the modeName in the MMAT
                    if ((pfd.Type == Data.MetaData.MMAT) && (names.Count > 0))
                    {
                        SimPe.Plugin.MmatWrapper mmat = new MmatWrapper();
                        mmat.ProcessData(pfd, package);

                        string n = mmat.ModelName.Trim().ToLower();
                        if (!n.EndsWith("_cres"))
                        {
                            n += "_cres";
                        }

                        if (!names.Contains(n))
                        {
                            n = names[0].ToString();
                            //n = n.Substring(0, n.Length-5);
                            mmat.ModelName = n;
                            mmat.SynchronizeUserData();
                        }
                    }

                    pkg.Add(pfd);
                }
            }             //foreach type
        }
Ejemplo n.º 4
0
 void SetProvider(SimPe.Interfaces.Files.IPackageFile pkg)
 {
     FileTable.ProviderRegistry.SimFamilynameProvider.BasePackage  = pkg;
     FileTable.ProviderRegistry.SimDescriptionProvider.BasePackage = pkg;
     FileTable.ProviderRegistry.SimNameProvider.BaseFolder         = System.IO.Path.Combine(System.IO.Path.GetDirectoryName(pkg.FileName), "Characters");
     FileTable.ProviderRegistry.LotProvider.BaseFolder             = System.IO.Path.Combine(System.IO.Path.GetDirectoryName(pkg.FileName), "Lots");
     eft = new ExtFamilyTies();
     IPackedFileDescriptor[] pfds = pkg.FindFiles(SimPe.Data.MetaData.FAMILY_TIES_FILE);
     if (pfds != null && pfds.Length > 0)
     {
         eft.ProcessData(pfds[0], pkg);
     }
 }
Ejemplo n.º 5
0
        protected void LoadSkinFormPackage(SimPe.Interfaces.Files.IPackageFile package)
        {
            Interfaces.Files.IPackedFileDescriptor[] pfds = package.FindFiles(0xEBCF3E27);

            foreach (Interfaces.Files.IPackedFileDescriptor pfd in pfds)
            {
                try
                {
                    SimPe.PackedFiles.Wrapper.Cpf cpf = new SimPe.PackedFiles.Wrapper.Cpf();
                    cpf.ProcessData(pfd, package);
                    sets.Add(cpf);
                }
                catch (Exception) {}
            }
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Returns the Property Set (=cpf) of a Skin
        /// </summary>
        /// <param name="spfd">The File Description of the File you are looking for</param>
        /// <returns>null or the Property Set File</returns>
        public string FindTxtrName(string matdname)
        {
            if (matdname == null)
            {
                return(null);
            }
            string file = System.IO.Path.Combine(SimPe.PathProvider.Global[Expansions.BaseGame].InstallFolder, "TSData\\Res\\Sims3D\\Sims02.package");

            if (System.IO.File.Exists(file))
            {
                SimPe.Interfaces.Files.IPackageFile      package = SimPe.Packages.File.LoadFromFile(file);
                Interfaces.Files.IPackedFileDescriptor[] pfds    = package.FindFile(matdname.Replace("CASIE_", ""), 0x49596978);
                if (pfds.Length == 0)
                {
                    pfds = package.FindFile(matdname, 0x49596978);
                }
                //try another Package

                /*if (pfds.Length==0)
                 * {
                 *      file = System.IO.Path.Combine(Helper.WindowsRegistry.SimsPath, "TSData\\Res\\Sims3D\\Sims07.package");
                 *      if (System.IO.File.Exists(file))
                 *      {
                 *              package = SimPe.Packages.GeneratableFile.LoadFromFile(file);
                 *              pfds = package.FindFile(matdname, 0x49596978);
                 *      }
                 * }*/

                //look for the right one
                foreach (Interfaces.Files.IPackedFileDescriptor pfd in pfds)
                {
                    SimPe.Plugin.Rcol rcol = new SimPe.Plugin.GenericRcol(null, false);
                    rcol.ProcessData(pfd, package);
                    if ((rcol.FileName.Trim().ToLower() == matdname.Trim().ToLower()) || (rcol.FileName.Trim().ToLower() == matdname.Replace("CASIE_", "").Trim().ToLower()))
                    {
                        foreach (SimPe.Plugin.MaterialDefinition md in rcol.Blocks)
                        {
                            return(md.GetProperty("stdMatBaseTextureName").Value + "_txtr");
                        }
                    }
                }
            }
            return(null);
        }
Ejemplo n.º 7
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();
        }
Ejemplo n.º 8
0
        protected void LoadSkinImageFormPackage(SimPe.Interfaces.Files.IPackageFile package)
        {
            Interfaces.Files.IPackedFileDescriptor[] pfds = package.FindFiles(0xAC506764);
            foreach (Interfaces.Files.IPackedFileDescriptor pfd in pfds)
            {
                try
                {
                    SimPe.Plugin.RefFile reffile = new SimPe.Plugin.RefFile();
                    reffile.ProcessData(pfd, package);
                    refs.Add(reffile);
                }
                catch (Exception) {}
            }

            pfds = package.FindFiles(0x49596978);
            foreach (Interfaces.Files.IPackedFileDescriptor pfd in pfds)
            {
                try
                {
                    SimPe.Plugin.Rcol matd = new SimPe.Plugin.GenericRcol(null, true);
                    matd.ProcessData(pfd, package);
                    matds.Add(matd);
                }
                catch (Exception) {}
            }

            //Material Files
            Interfaces.Files.IPackedFileDescriptor[] nmap_pfd = package.FindFiles(Data.MetaData.NAME_MAP);
            pfds = package.FindFiles(0x49596978);
            Plugin.Nmap nmap = new SimPe.Plugin.Nmap(null);
            if (nmap_pfd.Length > 0)
            {
                nmap.ProcessData(nmap_pfd[0], package);
            }
            bool check = false;

            foreach (Interfaces.Files.IPackedFileDescriptor pfd in pfds)
            {
                try
                {
                    SimPe.Plugin.Rcol matd = new SimPe.Plugin.GenericRcol(null, true);
                    check = false;

                    foreach (Interfaces.Files.IPackedFileDescriptor epfd in nmap.Items)
                    {
                        if (
                            (epfd.Group == pfd.Group) &&
                            (epfd.Instance == pfd.Instance)
                            )
                        {
                            matd.FileDescriptor = pfd;
                            matd.Package        = package;
                            matds.Add(matd);
                            check = true;
                        }
                    }

                    //not found in the FileMap, so process Normally
                    if (!check)
                    {
                        matd.ProcessData(pfd, package);
                        matds.Add(matd);
                    }
                }
                catch (Exception) {}
            }

            //Texture Files
            nmap_pfd = package.FindFiles(Data.MetaData.NAME_MAP);
            pfds     = package.FindFiles(0x1C4A276C);
            check    = false;

            foreach (Interfaces.Files.IPackedFileDescriptor pfd in pfds)
            {
                try
                {
                    SimPe.Plugin.Txtr txtr = new SimPe.Plugin.Txtr(null, true);
                    check = false;

                    foreach (Interfaces.Files.IPackedFileDescriptor epfd in nmap.Items)
                    {
                        if (
                            (epfd.Group == pfd.Group) &&
                            (epfd.Instance == pfd.Instance)
                            )
                        {
                            txtr.FileDescriptor = pfd;
                            txtr.Package        = package;
                            txtrs.Add(epfd.Filename, txtr);
                            continue;
                        }
                    }

                    //not found in the FileMap, so process Normally
                    if (!check)
                    {
                        txtr.ProcessData(pfd, package);
                        foreach (SimPe.Plugin.ImageData id in txtr.Blocks)
                        {
                            txtrs.Add(id.NameResource.FileName.ToLower(), txtr);
                        }
                    }
                }
                catch (Exception) {}
            }
        }
Ejemplo n.º 9
0
 public SimPe.Interfaces.Plugin.IToolResult ShowDialog(ref SimPe.Interfaces.Files.IPackedFileDescriptor pfd, ref SimPe.Interfaces.Files.IPackageFile package)
 {
     if (!IsReallyEnabled(pfd, package))
     {
         System.Windows.Forms.MessageBox.Show(SimPe.Localization.GetString("This is not an appropriate context in which to use this tool"),
                                              L.Get("pjSML"));
         return(new SimPe.Plugin.ToolResult(false, false));
     }
     Main();
     return(new SimPe.Plugin.ToolResult(false, false));
 }
Ejemplo n.º 10
0
 public SimPe.Interfaces.Plugin.IToolResult ShowDialog(ref SimPe.Interfaces.Files.IPackedFileDescriptor pfd, ref SimPe.Interfaces.Files.IPackageFile package)
 {
     currentPackage = package;
     if (package == null)
     {
         System.Windows.Forms.MessageBox.Show(SimPe.Localization.GetString("This is not an appropriate context in which to use this tool"),
                                              L.Get("pjSME"));
         return(new SimPe.Plugin.ToolResult(false, false));
     }
     if (packs == null)
     {
         packs = new List <string>();
         SetPacks();
         SimPe.FileTable.FileIndex.FILoad += new EventHandler(FileIndex_FILoad);
     }
     Main();
     return(new SimPe.Plugin.ToolResult(false, false));
 }
Ejemplo n.º 11
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);
        }
Ejemplo n.º 12
0
 /// <summary>
 /// Creates an Alias out of a Memory File
 /// </summary>
 /// <returns>the IAlias Object</returns>
 protected static void ProcessMemoryFile(Interfaces.Files.IPackedFileDescriptor pfd, SimPe.PackedFiles.Wrapper.ExtObjd objd, SimPe.PackedFiles.Wrapper.ExtObjd objd_pr, SimPe.PackedFiles.Wrapper.Str str, ArrayList list, ref Hashtable memories, SimPe.Interfaces.Files.IPackageFile BasePackage)
 {
 }
Ejemplo n.º 13
0
        /// <summary>
        /// Loads all package Files in the directory and scans them for Name Informations
        /// </summary>
        public void LoadSimsFromFolder()
        {
            names = new Hashtable();
            if (BasePackage == null)
            {
                return;
            }

            SimPe.PackedFiles.Wrapper.Fami fami = new SimPe.PackedFiles.Wrapper.Fami(null);
            Hashtable al = new Hashtable();

            foreach (uint type in fami.AssignableTypes)
            {
                IPackedFileDescriptor[] list = BasePackage.FindFiles(type);

                foreach (IPackedFileDescriptor pfd in list)
                {
                    fami.ProcessData(pfd, BasePackage);
                    al[(ushort)pfd.Instance] = fami.Name;

                    foreach (uint simid in fami.Members)
                    {
                        Alias a = new Alias(simid, fami.Name);
                        if (!names.Contains(simid))
                        {
                            names.Add(simid, a);
                        }
                    }
                }
            }            //foreach

            ///add unlisted Sims
            foreach (SimPe.PackedFiles.Wrapper.SDesc sdesc in FileTable.ProviderRegistry.SimDescriptionProvider.SimInstance.Values)
            {
                //load extern Fami Name
                if (!names.Contains(sdesc.SimId))
                {
                    if (sdesc.Package.SaveFileName.Trim().ToLower() != BasePackage.SaveFileName.Trim().ToLower())
                    {
                        SimPe.Interfaces.Files.IPackageFile pkg = sdesc.Package;
                        if (pkg != null)
                        {
                            SimPe.Interfaces.Files.IPackedFileDescriptor pfd = pkg.FindFile(fami.AssignableTypes[0], 0, Data.MetaData.LOCAL_GROUP, sdesc.FamilyInstance);
                            if (pfd != null)
                            {
                                fami.ProcessData(pfd, pkg);
                                Alias a = new Alias(sdesc.SimId, fami.Name);
                                names.Add(sdesc.SimId, a);
                            }
                        }
                    }
                    else
                    {
                        object o = al[sdesc.FamilyInstance];
                        if (o != null)
                        {
                            Alias a = new Alias(sdesc.SimId, o.ToString());
                            names.Add(sdesc.SimId, a);
                        }
                    }
                }
            }

            al.Clear();

            /*names = new Alias[al.Count];
             * al.CopyTo(names);*/
        }
Ejemplo n.º 14
0
 bool ITool.IsEnabled(SimPe.Interfaces.Files.IPackedFileDescriptor pfd, SimPe.Interfaces.Files.IPackageFile package)
 {
     return(true);
 }
Ejemplo n.º 15
0
        SimPe.Interfaces.Plugin.IToolResult ITool.ShowDialog(ref SimPe.Interfaces.Files.IPackedFileDescriptor pfd, ref SimPe.Interfaces.Files.IPackageFile package)
        {
            if (!System.IO.Directory.Exists(PathProvider.Global.NeighborhoodFolder))
            {
                System.Windows.Forms.MessageBox.Show("The Folder " + PathProvider.Global.NeighborhoodFolder + " was not found.\n" +
                                                     "Please specify the correct SaveGame Folder in the Options Dialog.");
                return(new ToolResult(false, false));
            }

            System.Windows.Forms.FolderBrowserDialog fbd = new System.Windows.Forms.FolderBrowserDialog();
            fbd.Description         = L.Get("ChooseFolder");
            fbd.SelectedPath        = SimPe.PathProvider.SimSavegameFolder;
            fbd.ShowNewFolderButton = true;
            System.Windows.Forms.DialogResult dr = fbd.ShowDialog();
            if (dr != System.Windows.Forms.DialogResult.OK)
            {
                return(new ToolResult(false, false));
            }


            NeighborhoodForm nfm = new NeighborhoodForm();

            nfm.LoadNgbh          = false;
            nfm.ShowBackupManager = false;
            nfm.Text = L.Get("nfmTitle");
            SimPe.Interfaces.Plugin.IToolResult ret = nfm.Execute(ref package, null);

            string hood = "";

            if (nfm.DialogResult == System.Windows.Forms.DialogResult.OK && nfm.SelectedNgbh != null)
            {
                hood = Path.GetFileName(Path.GetDirectoryName(nfm.SelectedNgbh));
            }

            try
            {
                SimPe.WaitingScreen.Wait();
                splash = delegate(string message) { SimPe.WaitingScreen.UpdateMessage(message); };
                Rufio(fbd.SelectedPath, hood, 0);
                return(new SimPe.Plugin.ToolResult(false, false));
            }
            finally
            {
                SimPe.WaitingScreen.Stop();
            }
        }
Ejemplo n.º 16
0
        void AddSim(string outPath, string hood, string hoodName, StreamWriter w, ExtSDesc sdsc)
        {
            #region desc
            string desc = ",,";
            SimPe.Interfaces.Files.IPackageFile pkg = SimPe.Packages.File.LoadFromFile(sdsc.CharacterFileName);
            if (pkg == null)
            {
                System.Diagnostics.Trace.WriteLine("Could not find character package:\n" + sdsc.CharacterFileName);
                return;// severe problem...
            }
            IPackedFileDescriptor[] pfds = pkg.FindFiles(StrWrapper.CTSStype);
            if (pfds == null || pfds.Length == 0)
            {
                System.Diagnostics.Trace.WriteLine("Could not find CTSS packed file for sim");
                return;// severe problem...
            }
            try
            {
                StrWrapper ctss = new StrWrapper();
                ctss.ProcessData(pfds[0], pkg);
                desc = q(ctss[1, 0]) +       // firstname
                       "," + q(ctss[1, 2]) + // lastname
                       "," + q(ctss[1, 1]) + // description
                       ""
                ;
            }
            catch { }
            #endregion

            #region family
            string family             = ",,";
            IPackedFileDescriptor pfd = sdsc.Package.FindFile(0x46414D49, 0x00000000, 0xffffffff, sdsc.FamilyInstance); // FAMI
            if (pfd != null)
            {
                Fami fami = null;
                fami = new Fami(FileTable.ProviderRegistry.SimNameProvider);
                fami.ProcessData(pfd, sdsc.Package);

                family = sdsc.FamilyInstance +
                         "," + q(sdsc.HouseholdName) +
                         "," + fami.LotInstance +
                         ""
                ;
            }
            #endregion

            #region ties
            string ties = ",,";
            if (eft != null)
            {
                SDesc[] p = eft.ParentSims(sdsc);
                SDesc[] s = eft.SpouseSims(sdsc);
                ties = (p == null || p.Length < 2 ? "," : p[0].Instance + "," + p[1].Instance) +
                       "," + (s == null || s.Length < 1 ? "" : s[0].Instance + "") +
                       ""
                ;
            }
            #endregion

            #region ghost

            /*string ghost = "N(,,,)";
             * if (sdsc.CharacterDescription.GhostFlag.IsGhost)
             * {
             *  ghost = "Y(" + (sdsc.CharacterDescription.GhostFlag.CanPassThroughObjects ? "Y" : "N") +
             *      (sdsc.CharacterDescription.GhostFlag.CanPassThroughWalls ? "Y" : "N") +
             *      (sdsc.CharacterDescription.GhostFlag.CanPassThroughPeople ? "Y" : "N") +
             *      (sdsc.CharacterDescription.GhostFlag.IgnoreTraversalCosts ? "Y" : "N") +
             *      ")";
             * }*/
            #endregion

            #region genetics
            string genetics = sdsc.GeneticCharacter.Active +
                              "," + sdsc.GeneticCharacter.Neat +
                              "," + sdsc.GeneticCharacter.Nice +
                              "," + sdsc.GeneticCharacter.Outgoing +
                              "," + sdsc.GeneticCharacter.Playful +
                              ""
            ;
            #endregion

            #region character
            string character = sdsc.Character.Active +
                               "," + sdsc.Character.Neat +
                               "," + sdsc.Character.Nice +
                               "," + sdsc.Character.Outgoing +
                               "," + sdsc.Character.Playful +
                               ""
            ;
            #endregion

            #region interests
            string interests = sdsc.Interests.Animals +
                               "," + sdsc.Interests.Crime +
                               "," + sdsc.Interests.Culture +
                               "," + sdsc.Interests.Entertainment +
                               "," + sdsc.Interests.Environment +
                               "," + sdsc.Interests.Fashion +
                               "," + sdsc.Interests.FemalePreference +
                               "," + sdsc.Interests.Food +
                               "," + sdsc.Interests.Health +
                               "," + sdsc.Interests.MalePreference +
                               "," + sdsc.Interests.Money +
                               "," + sdsc.Interests.Paranormal +
                               "," + sdsc.Interests.Politics +
                               "," + sdsc.Interests.School +
                               "," + sdsc.Interests.Scifi +
                               "," + sdsc.Interests.Sports +
                               "," + sdsc.Interests.Toys +
                               "," + sdsc.Interests.Travel +
                               "," + sdsc.Interests.Weather +
                               "," + sdsc.Interests.Work +
                               ""
            ;
            #endregion

            #region skills
            string skills = sdsc.Skills.Body +
                            "," + sdsc.Skills.Charisma +
                            "," + sdsc.Skills.Cleaning +
                            "," + sdsc.Skills.Cooking +
                            "," + sdsc.Skills.Creativity +
                            "," + sdsc.Skills.Fatness +
                            "," + sdsc.Skills.Logic +
                            "," + sdsc.Skills.Mechanical +
                            "," + sdsc.Skills.Romance +
                            ""
            ;
            #endregion

            #region university
            string university = "N,,,,,,";
            if (sdsc.University != null && sdsc.University.OnCampus == 0x1)
            {
                university = "Y" +
                             "," + sdsc.University.Effort +
                             "," + sdsc.University.Grade +
                             "," + sdsc.University.Time +
                             "," + sdsc.University.Semester +
                             "," + sdsc.University.Influence +
                             "," + sdsc.University.Major
                ;
            }
            #endregion

            #region freetime
            string freetime = ",,,";
            if (sdsc.Freetime != null)
            {
                freetime = sdsc.Freetime.PrimaryAspiration +
                           "," + sdsc.Freetime.SecondaryAspiration +
                           "," + sdsc.Freetime.HobbyPredistined +
                           "," + sdsc.Freetime.LongtermAspiration // LifetimeWant ?
                ;
                //sdsc.Freetime.BugCollection -- no...
            }
            #endregion

            //sdsc.Business.LotID


            if (dt.Equals(new DateTime(0)) || wasUnk || dt.AddMilliseconds(200).CompareTo(DateTime.UtcNow) < 0)
            {
                System.Windows.Forms.Application.DoEvents();
                if (!((string)(sdsc.SimName + " " + sdsc.SimFamilyName)).Trim().ToLower().Equals("unknown"))
                {
                    dt     = new DateTime(DateTime.UtcNow.Ticks);
                    wasUnk = false;
                    splash("Saving " + sdsc.SimName + " " + sdsc.SimFamilyName);
                }
                else
                {
                    wasUnk = true;
                }
            }
            string csv = hood +
                         "," + q(hoodName) +
                         "," + sdsc.Instance +
                         "," + desc +
                         "," + family +
                         "," + (sdsc.AvailableCharacterData ? "Y" : "N") +
                         "," + (sdsc.Unlinked != 0x00 ? "Y" : "N") +
                         "," + ties +
                         //"," + ghost +
                         "," + (bodyType)(ushort)sdsc.CharacterDescription.BodyFlag +
                         //"," + sdsc.CharacterDescription.AutonomyLevel +
                         "," + sdsc.CharacterDescription.NPCType +
                         //"," + sdsc.CharacterDescription.MotivesStatic +
                         //"," + sdsc.CharacterDescription.VoiceType +
                         "," + sdsc.CharacterDescription.SchoolType +
                         "," + sdsc.CharacterDescription.Grade +
                         "," + sdsc.CharacterDescription.CareerPerformance +
                         "," + sdsc.CharacterDescription.Career +
                         "," + sdsc.CharacterDescription.CareerLevel +
                         "," + sdsc.CharacterDescription.ZodiacSign +
                         "," + sdsc.CharacterDescription.Aspiration +
                         "," + sdsc.CharacterDescription.Gender +
                         "," + sdsc.CharacterDescription.LifeSection +
                         "," + sdsc.CharacterDescription.Age +
                         "," + sdsc.CharacterDescription.PrevAgeDays +
                         "," + sdsc.CharacterDescription.AgeDuration +
                         "," + sdsc.CharacterDescription.BlizLifelinePoints +
                         "," + sdsc.CharacterDescription.LifelinePoints +
                         "," + sdsc.CharacterDescription.LifelineScore +
                         "," + genetics +
                         "," + character +
                         "," + interests +
                         "," + skills +
                         "," + university +
                         "," + (sdsc.Nightlife == null ? "Human" : sdsc.Nightlife.Species.ToString()) +
                         "," + (sdsc.Business == null ? (ushort)0 : sdsc.Business.Salary) +
                         "," + freetime +
                         //";Reputation" +
                         ""
            ;
            w.WriteLine(csv);

            AddImage(sdsc.Image, Path.Combine(Path.Combine(outPath, "SimImage"), hood + "_" + sdsc.Instance + ".png"));
        }