/// <summary> /// Loads a QQ game resource package (.PKG file) and adds a root-level /// node into the tree view on the left of the main window. /// </summary> /// <param name="pkg"></param> private void LoadPackage(QQGame.PkgArchive ar) { // TODO: dispose the PkgArchive objects when they are removed from // the treeview. // TODO: Only create a PkgArchive object when the node is selected. PackageFolder f = new PackageFolder(ar); vFolderTreeView.AddRootFolder(f); }
public PackageItem(QQGame.PkgArchiveEntry ent) { entry = ent; }
private int CountColors(QQGame.MifImage mif, out int alphaCount, out int maxColorCount) { byte[] pixels = new byte[mif.Width * mif.Height * 4]; HashSet<int> colors = new HashSet<int>(); HashSet<int> alphas = new HashSet<int>(); maxColorCount = 0; for (int i = 0; i < mif.FrameCount; i++) { HashSet<int> frameColors = new HashSet<int>(); mif.FrameIndex = i; using (PixelBuffer pixelBuffer = new BitmapPixelBuffer( mif.Frame as Bitmap, PixelFormat.Format32bppArgb, ImageLockMode.ReadOnly)) { pixelBuffer.Read(0, pixels, 0, pixels.Length); } for (int j = 0; j < mif.Width * mif.Height; j++) { int c = BitConverter.ToInt32(pixels, j * 4); colors.Add(c); frameColors.Add(c); alphas.Add((c >> 24) & 0xFF); } maxColorCount = Math.Max(maxColorCount, frameColors.Count); } alphaCount = alphas.Count; return colors.Count; }
public PackageFolder(QQGame.PkgArchive ar) { this.archive = ar; }