示例#1
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();
            }
        }
示例#2
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();
        }