protected override Icon GetIcon(bool smallIcon, uint iconSize)
        {
            Bitmap m_icon = null;

            if (m_icon == null)
            {
                try
                {
                    if (File.Exists(Path.Combine(SelectedItemPath, @"sce_sys\icon0.png")) &&
                        File.Exists(Path.Combine(SelectedItemPath, @"sce_sys\param.sfo")))
                    {
                        m_icon = TextureTool.GetBitmapFromFile(Path.Combine(SelectedItemPath, @"sce_sys\icon0.png"));
                        if (m_icon == null)
                        {
                            Properties.Resources.VPK_ICON0.ToBitmap();
                        }
                        m_icon = TextureTool.MergeTex(m_icon,
                                                      Properties.Resources.VPK_SIG_FOLDER,
                                                      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);
                        GC.Collect();
                        return(Icon.FromHandle(TextureTool.ResizeTex(m_icon, new Size((int)iconSize, (int)iconSize)).GetHicon()));
                    }
                    else
                    {
                        return(null);
                    }
                }
                catch
                {
                    //m_icon = Properties.Resources.VPK_ICON0.ToBitmap();
                    Logger.Log(this.ToString(), string.Format("Cant'load icon from {0}", SelectedItemPath));
                    return(null);
                }
            }
            return(null);
        }
Ejemplo n.º 2
0
        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()));
        }