protected override System.Windows.Forms.ContextMenuStrip CreateMenu() { var mainMenu = new ContextMenuStrip(); var itemExt = new ToolStripMenuItem { Text = "VPK Shell Ext..", Image = TextureTool.ResizeTex(Properties.Resources.VPK_ICON_CONTEXT.ToBitmap(), new System.Drawing.Size(mainMenu.Height - 2, mainMenu.Height - 2)) }; #region show settings var settingsMenu = new ToolStripMenuItem { Text = "Settings", Image = TextureTool.ResizeTex(Properties.Resources.VPK_ICON_CONTEXT.ToBitmap(), new System.Drawing.Size(mainMenu.Height - 2, mainMenu.Height - 2)) }; var paramMenu = new ToolStripMenuItem { Text = "Show param.sfo Info", Image = TextureTool.ResizeTex(Properties.Resources.VPK_ICON_CONTEXT.ToBitmap(), new System.Drawing.Size(mainMenu.Height - 2, mainMenu.Height - 2)) }; settingsMenu.Click += (sender, args) => showSettingsWindow(); paramMenu.Click += (sender, args) => showParamWindow(); itemExt.DropDownItems.Add(settingsMenu); itemExt.DropDownItems.Add(paramMenu); #endregion mainMenu.Items.Add(itemExt); return(mainMenu); }
private void genZIPStream(ZipFile zip) { Stream icon_stream = new MemoryStream(); Stream param_stream = new MemoryStream(); Stream eboot_stream = new MemoryStream(); //Stream stream = new FileStream(fName, FileMode.Open, FileAccess.Read, FileShare.Read); isVitaVPK = this.checkVPK(zip); if (isVitaVPK) { ZipEntry icon_entry = zip[VPK_icon0]; ZipEntry param_entry = zip[VPK_param]; ZipEntry eboot_entry = zip[VPK_eboot]; icon_entry.Extract(icon_stream); param_entry.Extract(param_stream); eboot_entry.Extract(eboot_stream); icon_stream.Position = 0; param_stream.Position = 0; eboot_stream.Position = 0; try { this.Icon = TextureTool.GetBitmapFromStream(icon_stream); byte[] paramByte = new byte[param_stream.Length]; param_stream.Read(paramByte, 0, paramByte.Length);//获取param.sfo param_data = paramByte; byte[] ebootByte = new byte[0x100]; eboot_stream.Read(ebootByte, 0, 0x100); //只获取eboot的前0x100字节 eboot_data = ebootByte; checkVPKType(zip); checkParamSFO(param_data); } catch { this.Icon = null; } } icon_stream.Close(); param_stream.Close(); eboot_stream.Close(); }
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); }
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())); }