예제 #1
0
 public void Update(libexeinfo.NE.Version version)
 {
     panelWin16Version.Update(version);
 }
예제 #2
0
        void TreeResourcesOnSelectionChanged(object sender, EventArgs eventArgs)
        {
            if (!(((TreeGridItem)treeResources.SelectedItem)?.Values[5] is libexeinfo.NE.Resource resource))
            {
                pnlResource.Content = null;
                return;
            }

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

            switch (((TreeGridItem)treeResources.SelectedItem).Values[3])
            {
            case "RT_VERSION":
                pnlResource.Content = panelWin16Version;
                panelWin16Version.Update(data);
                break;

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

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

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

            case "RT_BITMAP" when(libexeinfo.NE.TargetOS)((TreeGridItem)treeResources.SelectedItem).Values[4] ==
                libexeinfo.NE.TargetOS.OS2:
            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" when(libexeinfo.NE.TargetOS)((TreeGridItem)treeResources.SelectedItem).Values[4] ==
                libexeinfo.NE.TargetOS.OS2:
                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;

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

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