Exemplo n.º 1
0
        void TreeResourcesOnSelectionChanged(object sender, EventArgs eventArgs)
        {
            if (!(((TreeGridItem)treeResources.SelectedItem)?.Values[3] is libexeinfo.NE.Resource resource))
            {
                pnlResource.Content = null;
                return;
            }

            byte[] data = ((libexeinfo.NE.Resource)((TreeGridItem)treeResources.SelectedItem).Values[3]).data;

            switch (((TreeGridItem)treeResources.SelectedItem).Values[2])
            {
            case "RT_STRING":
                pnlResource.Content = panelNeStrings;
                panelNeStrings.Update(data, libexeinfo.NE.TargetOS.OS2);
                break;

            case "RT_ACCELTABLE":
                pnlResource.Content = panelNeAccelerators;
                panelNeAccelerators.Update(data, libexeinfo.NE.TargetOS.OS2);
                break;

            case "RT_BITMAP":
            case "RT_POINTER":
                // TODO: Some do not contain valid OS/2 bitmaps
                try
                {
                    pnlResource.Content = panelOs2Bitmap;
                    panelOs2Bitmap.Update(data);
                }
                catch { goto default; }

                break;

            case "RT_MENU":
                if (BitConverter.ToUInt32(data, 0) == 40)
                {
                    // Some OS/2 executables contain Windows "RT_ICON" resources, in OS/2 NE format
                    pnlResource.Content = panelWindowsIcon;
                    panelWindowsIcon.Update(data);
                    break;
                }

                goto default;

            default:
                pnlResource.Content = panelHexDump;
                panelHexDump.Update(data);
                break;
            }
        }
Exemplo n.º 2
0
        void TreeResourcesOnSelectionChanged(object sender, EventArgs eventArgs)
        {
            if (((TreeGridItem)treeResources.SelectedItem)?.Values[3] == null)
            {
                pnlResource.Content = null;
                return;
            }

            byte[] data = ((TreeGridItem)treeResources.SelectedItem)?.Values[3] as byte[];
            string type = ((TreeGridItem)treeResources.SelectedItem)?.Values[2] as string;

            switch (type)
            {
            case "RT_STRING":
                pnlResource.Content = panelPeStrings;
                panelPeStrings.Update(data);
                break;

            case "RT_ICON":
                pnlResource.Content = panelWindowsIcon;
                panelWindowsIcon.Update(data);
                break;

            case "RT_VERSION":
                pnlResource.Content = panelPeVersion;
                panelPeVersion.Update(data);
                break;

            case "RT_MANIFEST":
                pnlResource.Content = panelText;
                panelText.Update(data, Encoding.UTF8);
                break;

            default:
                pnlResource.Content = panelHexDump;
                panelHexDump.Update(data);
                break;
            }
        }