Esempio n. 1
0
        private void ParamForm_Load(object sender, EventArgs e)
        {
            VPKLoader vpkLoader = new VPKLoader();

            vpkLoader.LoadVPK(path);
            this.textBoxSFOInfo.Lines = new string[]
            {
                string.Format("{0}:    {1}", "Content ID  ", vpkLoader.Package_CONTENT_ID),
                string.Format("{0}:    {1}", "STITLE      ", vpkLoader.Package_STITLE),
                string.Format("{0}:    {1}", "TITLE       ", vpkLoader.Package_TITLE),
                string.Format("{0}:    {1}", "TITLE ID    ", vpkLoader.Package_TITLE_ID),
                string.Format("{0}:    {1}", "DISP VER    ", vpkLoader.Package_PSP2_DISP_VER),
                string.Format("{0}:    {1}", "SYSTEM VER  ", vpkLoader.Package_PSP2_SYSTEM_VER),
                string.Format("{0}:    {1}", "VERSION     ", vpkLoader.Package_VERSION),
                string.Format("{0}:    {1}", "APP VER     ", vpkLoader.Package_APP_VER)
            };
        }
        protected override Icon GetIcon(bool smallIcon, uint iconSize)
        {
            Bitmap m_icon = null;

            if (m_icon == null)
            {
                try
                {
                    VPKLoader loader = new VPKLoader();
                    loader.LoadVPK(SelectedItemPath);
                    if (loader.isVitaVPK)
                    {
                        m_icon = loader.Icon;
                        if (m_icon == null)
                        {
                            Properties.Resources.VPK_ICON0.ToBitmap();
                        }

                        switch (loader.Type)
                        {
                        case VPKType.Normal_VPK:
                            m_icon = TextureTool.MergeTex(m_icon,
                                                          Properties.Resources.VPK_SIG_NORMAL,
                                                          new Rectangle((int)(m_icon.Width * 0), 0, (int)(m_icon.Width * 1), (int)(m_icon.Height * 1)),
                                                          new Rectangle((int)(m_icon.Width * 0), 0, (int)(m_icon.Width * 1), (int)(m_icon.Height * 1)),
                                                          m_icon.Width,
                                                          m_icon.Height);
                            break;

                        case VPKType.Vitamin_VPK:
                            m_icon = TextureTool.MergeTex(m_icon,
                                                          Properties.Resources.VPK_SIG_VITAMIN,
                                                          new Rectangle((int)(m_icon.Width * 0), 0, (int)(m_icon.Width * 1), (int)(m_icon.Height * 1)),
                                                          new Rectangle((int)(m_icon.Width * 0), 0, (int)(m_icon.Width * 1), (int)(m_icon.Height * 1)),
                                                          m_icon.Width,
                                                          m_icon.Height);
                            break;

                        case VPKType.Mai_VPK:
                            m_icon = TextureTool.MergeTex(m_icon,
                                                          Properties.Resources.VPK_SIG_MAI,
                                                          new Rectangle((int)(m_icon.Width * 0), 0, (int)(m_icon.Width * 1), (int)(m_icon.Height * 1)),
                                                          new Rectangle((int)(m_icon.Width * 0), 0, (int)(m_icon.Width * 1), (int)(m_icon.Height * 1)),
                                                          m_icon.Width,
                                                          m_icon.Height);
                            break;

                        case VPKType.Danger_VPK:
                            m_icon = TextureTool.MergeTex(m_icon,
                                                          Properties.Resources.VPK_SIG_DANGER,
                                                          new Rectangle((int)(m_icon.Width * 0), 0, (int)(m_icon.Width * 1), (int)(m_icon.Height * 1)),
                                                          new Rectangle((int)(m_icon.Width * 0), 0, (int)(m_icon.Width * 1), (int)(m_icon.Height * 1)),
                                                          m_icon.Width,
                                                          m_icon.Height);
                            break;

                        default:
                            break;
                        }
                    }
                    else
                    {
                        return(null);
                    }
                }
                catch
                {
                    //m_icon = Properties.Resources.VPK_ICON0.ToBitmap();
                    Logger.Log(this.ToString(), string.Format("Cant'load vpk from {0}", SelectedItemPath));
                    return(null);
                }
            }
            GC.Collect();
            return(Icon.FromHandle(TextureTool.ResizeTex(m_icon, new Size((int)iconSize, (int)iconSize)).GetHicon()));
        }