Exemplo n.º 1
0
        public void ExportResource(string output, UInt32 resType)
        {
            switch (resType)
            {
            case 0:      // 以名称标注的资源,一般是自定义格式资源,按二进制输出
            {
                File.WriteAllBytes(output + "\\Rawdata.bin", Data);
                break;
            }

            case 1:      // 光标
            {
                IMAGE_CURSOR imgCursor = (IMAGE_CURSOR)Instance;
                imgCursor.Export(output + "\\Cursor.cur");
                File.WriteAllBytes(output + "\\Rawdata.bin", Data);
                break;
            }

            case 2:      // 位图
            {
                File.WriteAllBytes(output + "\\Rawdata.bin", Data);
                RESOURCE_BITMAP bmp = new RESOURCE_BITMAP(Data);
                bmp.Export(output + "\\Resource.bmp");
                break;
            }

            case 3:       // 图标
            {
                IMAGE_ICON imgIcon = (IMAGE_ICON)Instance;
                imgIcon.Export(output + "\\Icon.ico");
                File.WriteAllBytes(output + "\\Rawdata.bin", Data);
                break;
            }

            case 4:
            {
                File.WriteAllBytes(output + "\\Rawdata.bin", Data);
                break;
            }

            case 5:
            {
                File.WriteAllBytes(output + "\\Rawdata.bin", Data);
                break;
            }

            case 6:      // 字符串
            {
                string strBlock           = "";
                Resource_String_Table rst = new Resource_String_Table(Data);
                for (int i = 0; i < rst.StringTable.Length; i++)
                {
                    strBlock += "String " + (i + 1).ToString() + ":" + rst.StringTable[i].ToString() + "\r\n";
                    string temp = rst.StringTable[i].ToString();
                }
                File.WriteAllText(output + "\\String.txt", strBlock);
                File.WriteAllBytes(output + "\\Rawdata.bin", Data);
                break;
            }

            case 12:
            {
                GROUP_CURSOR gCursor = (GROUP_CURSOR)Instance;
                gCursor.Export(output + "\\GroupCursorDetails.txt");
                File.WriteAllBytes(output + "\\Rawdata.bin", Data);
                break;
            }

            case 14:
            {
                GROUP_ICON gIcon = (GROUP_ICON)Instance;
                gIcon.Export(output + "\\GroupIconDetails.txt");
                File.WriteAllBytes(output + "\\Rawdata.bin", Data);
                break;
            }

            case 16:       // 版本信息
            {
                VS_VERSION_INFO vi = new VS_VERSION_INFO(Data);
                vi.Export(output + "\\FileVersion.txt");
                File.WriteAllBytes(output + "\\Rawdata.bin", Data);
                break;
            }

            default:
            {
                File.WriteAllBytes(output + "\\Rawdata.bin", Data);
                break;
            }
            }
        }
Exemplo n.º 2
0
        public void ExportResource(string output, UInt32 resType)
        {
            switch (resType)
            {
            case 0:      // 以名称标注的资源,一般是自定义格式资源,按二进制输出
            {
                File.WriteAllBytes(output + "\\Rawdata.bin", Data);
                break;
            }

            case 1:      // 光标
            {
                File.WriteAllBytes(output + "\\Rawdata.bin", Data);
                break;
            }

            case 2:      // 图标
            {
                File.WriteAllBytes(output + "\\Rawdata.bin", Data);
                break;
            }

            case 3:       // 位图
            {
                File.WriteAllBytes(output + "\\Rawdata.bin", Data);
                break;
            }

            case 4:
            {
                File.WriteAllBytes(output + "\\Rawdata.bin", Data);
                break;
            }

            case 5:
            {
                File.WriteAllBytes(output + "\\Rawdata.bin", Data);
                break;
            }

            case 6:      // 字符串
            {
                string strBlock           = "";
                Resource_String_Table rst = new Resource_String_Table(Data);
                for (int i = 0; i < rst.StringTable.Length; i++)
                {
                    strBlock += "String " + (i + 1).ToString() + ":" + rst.StringTable[i].ToString() + "\r\n";
                    string temp = rst.StringTable[i].ToString();
                }
                File.WriteAllText(output + "\\String.txt", strBlock);
                File.WriteAllBytes(output + "\\Rawdata.bin", Data);
                break;
            }

            case 16:       // 版本信息
            {
                VS_VERSION_INFO vi = new VS_VERSION_INFO(Data);
                vi.Export(output + "\\FileVersion.txt");
                File.WriteAllBytes(output + "\\Rawdata.bin", Data);
                break;
            }

            default:
            {
                File.WriteAllBytes(output + "\\Rawdata.bin", Data);
                break;
            }
            }
        }