Ejemplo n.º 1
0
        protected void ResetPanel(Wrapper.FamilyTies famt)
        {
            form.cballtieablesims.Items.Clear();
            form.cballtieablesims.Sorted = false;
            Interfaces.Files.IPackedFileDescriptor[] pfds = famt.Package.FindFiles(Data.MetaData.SIM_DESCRIPTION_FILE);
            Wrapper.SDesc sdesc = new SimPe.PackedFiles.Wrapper.SDesc(famt.NameProvider, null, null);
            foreach (Interfaces.Files.IPackedFileDescriptor pfd in pfds)
            {
                Wrapper.Supporting.FamilyTieSim fts = new FamilyTieSim((ushort)pfd.Instance, null, famt);
                form.cballtieablesims.Items.Add(fts);
            }

            form.cballtieablesims.Sorted = true;

            form.cbtietype.Items.Clear();
            form.cbtietype.Items.Add(new LocalizedFamilyTieTypes(Data.MetaData.FamilyTieTypes.MyMotherIs));
            form.cbtietype.Items.Add(new LocalizedFamilyTieTypes(Data.MetaData.FamilyTieTypes.MyFatherIs));
            form.cbtietype.Items.Add(new LocalizedFamilyTieTypes(Data.MetaData.FamilyTieTypes.ImMarriedTo));
            form.cbtietype.Items.Add(new LocalizedFamilyTieTypes(Data.MetaData.FamilyTieTypes.MySiblingIs));
            form.cbtietype.Items.Add(new LocalizedFamilyTieTypes(Data.MetaData.FamilyTieTypes.MyChildIs));
            form.cbtietype.SelectedIndex = 2;

            form.btaddtie.Enabled    = false;
            form.btdeletetie.Enabled = false;
            form.btnewtie.Enabled    = false;

            form.lbties.Items.Clear();
        }
Ejemplo n.º 2
0
 private void pc_SelectedSimChanged(object sender, Image thumb, SimPe.PackedFiles.Wrapper.SDesc sdesc)
 {
     if (ngbh != null && pc != null)
     {
         if (pc.SelectedSim != null)
         {
             this.Slot = ngbh.GetSlots(st).GetInstanceSlot(pc.SelectedSim.FileDescriptor.Instance);
         }
         else
         {
             this.Slot = null;
         }
     }
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Adds the currently Available SimNames to the Map
        /// </summary>
        /// <remarks>Feeds the IProviderRegistry set in the FileTable!</remarks>
        public void AddSimNames()
        {
            Hashtable ht = new Hashtable();

            map[WantType.Sim] = ht;

            if (FileTable.ProviderRegistry == null)
            {
                return;
            }

            foreach (ushort inst in FileTable.ProviderRegistry.SimDescriptionProvider.SimInstance.Keys)
            {
                SimPe.Interfaces.Wrapper.ISDesc isdsc = FileTable.ProviderRegistry.SimDescriptionProvider.FindSim(inst);
                SimPe.PackedFiles.Wrapper.SDesc sdsc  = (SimPe.PackedFiles.Wrapper.SDesc)isdsc;
                sdsc.SetProviders(FileTable.ProviderRegistry);
                //Data.Alias a = new SimPe.Data.Alias(inst, sdsc.SimName+" "+sdsc.SimFamilyName+" ("+sdsc.HouseholdName+")");
                ht[(uint)inst] = sdsc.SimName + " " + sdsc.SimFamilyName + " (" + sdsc.HouseholdName + ")";      //a.Name;
            }
        }
Ejemplo n.º 4
0
        public void ExecuteEventHandler(object sender, SimPe.Events.ResourceEventArgs e)
        {
            if (!RealChangeEnabledStateEventHandler(null, e))
            {
                System.Windows.Forms.MessageBox.Show(SimPe.Localization.GetString("This is not an appropriate context in which to use this tool"),
                                                     this.ToString());
                return;
            }

            SimPe.Interfaces.Files.IPackedFileDescriptor[] pfds = e.LoadedPackage.Package.FindFiles(Data.MetaData.SIM_DESCRIPTION_FILE);

            SimPe.PackedFiles.Wrapper.SDesc sdesc = new SimPe.PackedFiles.Wrapper.SDesc(null, null, null);
            foreach (SimPe.Interfaces.Files.IPackedFileDescriptor pfd in pfds)
            {
                sdesc.ProcessData(pfd, e.LoadedPackage.Package);

                sdesc.Interests.Animals       = 1000;
                sdesc.Interests.Crime         = 1000;
                sdesc.Interests.Culture       = 1000;
                sdesc.Interests.Entertainment = 1000;
                sdesc.Interests.Environment   = 1000;
                sdesc.Interests.Fashion       = 1000;
                sdesc.Interests.Food          = 1000;
                sdesc.Interests.Health        = 1000;
                sdesc.Interests.Money         = 1000;
                sdesc.Interests.Paranormal    = 1000;
                sdesc.Interests.Politics      = 1000;
                sdesc.Interests.School        = 1000;
                sdesc.Interests.Scifi         = 1000;
                sdesc.Interests.Sports        = 1000;
                sdesc.Interests.Toys          = 1000;
                sdesc.Interests.Travel        = 1000;
                sdesc.Interests.Weather       = 1000;
                sdesc.Interests.Work          = 1000;

                sdesc.SynchronizeUserData();
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Is called by SimPe (through the Wrapper) when the Panel is going to be displayed, so
        /// you should updatet the Data displayed by the Panel with the Attributes stored in the
        /// passed Wrapper.
        /// </summary>
        /// <param name="wrapper">The Attributes of this Wrapper have to be displayed</param>
        public void UpdateGUI(IFileWrapper wrapper)
        {
            form.wrapper = (IFileWrapperSaveExtension)wrapper;

            Ngbh wrp = (Ngbh)wrapper;

            form.lv.BeginUpdate();
            form.lv.Items.Clear();
            form.ilist.Images.Clear();
            form.cbsub.Items.Clear();
            form.cbown.Items.Clear();
            form.gbmem.Enabled = false;
            form.lbmem.Items.Clear();

            Interfaces.Files.IPackedFileDescriptor[] pfds = wrp.Package.FindFiles(Data.MetaData.SIM_DESCRIPTION_FILE);
            form.cbsub.Items.Add(new Data.Alias(0, "---", "{name}"));
            form.cbsub.Sorted = false;
            form.cbown.Items.Add(new Data.Alias(0, "---", "{name}"));
            form.cbown.Sorted = false;
            foreach (Interfaces.Files.IPackedFileDescriptor spfd in pfds)
            {
                PackedFiles.Wrapper.SDesc sdesc = new SimPe.PackedFiles.Wrapper.SDesc(wrp.Provider.SimNameProvider, wrp.Provider.SimFamilynameProvider, null);

                Wait.SubStart();


                sdesc.ProcessData(spfd, wrp.Package);

                ListViewItem lvi = new ListViewItem();
                lvi.Text = sdesc.SimName + " " + sdesc.SimFamilyName;

#if DEBUG
                Data.Alias a = new Data.Alias(sdesc.SimId, lvi.Text);
                lvi.Text += " (0x" + Helper.HexString(sdesc.Instance) + ")";
#else
                Data.Alias a = new Data.Alias(sdesc.SimId, lvi.Text, "{name}");
#endif

                lvi.Tag = sdesc;

                a.Tag    = new object[1];
                a.Tag[0] = sdesc.Instance;
                form.cbsub.Items.Add(a);
                form.cbown.Items.Add(a);


                if (sdesc.HasImage)
                {
                    /*if (sdesc.Unlinked!=0x00)
                     * {
                     *      Image img = (Image)sdesc.Image.Clone();
                     *      System.Drawing.Graphics g = Graphics.FromImage(img);
                     *      g.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighQuality;
                     *      g.CompositingMode = System.Drawing.Drawing2D.CompositingMode.SourceOver;
                     *
                     *      Pen pen = new Pen(Color.FromArgb(0xD0, Color.DarkGreen), 3);
                     *
                     *      g.FillRectangle(pen.Brush, 0, 0, img.Width, img.Height);
                     *
                     *      form.ilist.Images.Add(img);
                     * } */
                    if ((sdesc.Unlinked != 0x00) || (!sdesc.AvailableCharacterData))
                    {
                        Image img = (Image)sdesc.Image.Clone();
                        System.Drawing.Graphics g = Graphics.FromImage(img);
                        g.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighQuality;
                        g.CompositingMode    = System.Drawing.Drawing2D.CompositingMode.SourceOver;

                        Pen pen = new Pen(Data.MetaData.SpecialSimColor, 3);

                        g.FillRectangle(pen.Brush, 0, 0, img.Width, img.Height);

                        int pos = 2;
                        if (sdesc.Unlinked != 0x00)
                        {
                            g.FillRectangle(new Pen(Data.MetaData.UnlinkedSim, 1).Brush, pos, 2, 25, 25);
                            pos += 28;
                        }
                        if (!sdesc.AvailableCharacterData)
                        {
                            g.FillRectangle(new Pen(Data.MetaData.InactiveSim, 1).Brush, pos, 2, 25, 25);
                            pos += 28;
                        }

                        form.ilist.Images.Add(img);
                    }
                    else
                    {
                        form.ilist.Images.Add(sdesc.Image);
                    }

                    lvi.ImageIndex = form.ilist.Images.Count - 1;
                }

                form.lv.Items.Add(lvi);
            }
            form.cbsub.Sorted = true;
            form.cbown.Sorted = true;
            form.lv.Sort();



            form.lv.EndUpdate();

            Wait.SubStop();
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Show the Relink Screen
        /// </summary>
        /// <param name="path">The Path where to look for character Files</param>
        /// <param name="wrp">The Sim Description Wrapper</param>
        /// <returns>The new SimID</returns>
        public static uint Execute(SimPe.PackedFiles.Wrapper.SDesc wrp)
        {
            Hashtable     ht  = wrp.nameprovider.StoredData;
            SimRelinkForm srf = new SimRelinkForm();

            WaitingScreen.Wait();
            try
            {
                foreach (SimPe.Data.Alias a in ht.Values)
                {
                    ListViewItem lvi = new ListViewItem(a.Name + " " + (string)a.Tag[2]);
                    lvi.Tag = a;

                    if (a.Tag[1] != null)
                    {
                        lvi.ImageIndex = srf.ilist.Images.Count;
                        Image img = SimPe.Plugin.ImageLoader.Preview((Image)a.Tag[1], srf.ilist.ImageSize);

                        if (wrp.sdescprovider.FindSim(a.Id) != null)
                        {
                            Graphics gr = Graphics.FromImage(img);
                            gr.FillRectangle(new Pen(Color.FromArgb(0x60, Color.Red), 1).Brush, 0, 0, img.Width, img.Height);
                        }

                        srf.ilist.Images.Add(img);
                    }

                    srf.lv.Items.Add(lvi);
                }
                srf.lv.Sort();
                srf.btlink.Enabled = false;
                srf.ok             = false;
            }
            finally { WaitingScreen.Stop(srf); }

            srf.ShowDialog();

            if (srf.ok)
            {
                SimPe.Data.Alias a = (SimPe.Data.Alias)srf.lv.SelectedItems[0].Tag;
                SimPe.Packages.GeneratableFile pkg = SimPe.Packages.GeneratableFile.LoadFromFile((string)a.Tag[0]);

                Interfaces.Files.IPackedFileDescriptor[] pfds = pkg.FindFiles(Data.MetaData.OBJD_FILE);
                if (pfds.Length == 1)
                {
                    SimPe.PackedFiles.Wrapper.Objd objd = new SimPe.PackedFiles.Wrapper.Objd(null);
                    objd.ProcessData(pfds[0], pkg);

                    if (srf.cbfile.Checked)
                    {
                        objd.Guid = wrp.SimId;
                        objd.SynchronizeUserData();
                        pkg.Save();
                    }
                    else
                    {
                        wrp.SimId = objd.Guid;
                    }
                }
            }

            return(wrp.SimId);
        }
Ejemplo n.º 7
0
        private void spc_SelectedSimChanged(object sender, System.Drawing.Image thumb, SimPe.PackedFiles.Wrapper.SDesc sdesc)
        {
/*			if (sdesc!=null)
 *                              lbName.Text = sdesc.SimName+" "+sdesc.SimFamilyName;
 *                      else
 *                              lbName.Text = SimPe.Localization.GetString("Unknown");*/
        }