Localizing CrystalReportViewer

I'm describing here the procedure how to localize CrystalReportViewer in .NET 1.1 framework, in an _almost_ proper way (i.e., we actually create a satellite assembly containing resources). We have to do some hacking though, because the assembly containing the English resources is strong-named, so the satellite assemblies ought to be signed by the same private key which we obviously do not have.

I will assume that you are familiar with "programming" in Command prompt and are skilled enough to solve possible problems yourself. Use at your risk only.

I'm doing this for Windows Forms version of CrystalReportViewer. I guess the same could be done for Webforms. Only replace "Windows.Forms" with "Web", and "CRViewerSys" with "ViewerSys" in all filenames.

Step 1: Extracting the resources

  1. Create a working directory, e.g., C:\crystalresources, and copy the file "C:\Program Files\Common Files\Crystal Decisions\1.1\Managed\CrystalDecisions.Windows.Forms.dll" (or wherever it is located) to the created directory
  2. Run Visual Studio .NET 2003 Command Prompt from the start menu, and change the current directory (I assume in all the following snippets that you are located in C:\crystalresources):
    cd C:\crystalresources
        
  3. Disassemble the assembly. Don't extract the code, we are interested only in the resources.
    ildasm CrystalDecisions.Windows.Forms.dll /OUT=CrystalDecisions.Windows.Forms.il /ITEM=
        
  4. Convert the resources to the XML format.
    resgen CrystalDecisions.Windows.Forms.CRViewerSys.resources CrystalDecisions.Windows.Forms.CRViewerSys.resx
        
  5. You may delete all files in C:\crystalresources except the .resx, .il, and .dll, since we'll need them later.
You have extracted resources to the .resx file. Create a localized version to the file "CrystalDecisions.Windows.Forms.CRViewerSys.CULTURE.resx" where CULTURE is the desired culture (for example sk-SK). Of course, replace CULTURE with the same culture in all commands below.

Step 2: Creating the satellite assembly

  1. Compile the created resource file:
    resgen CrystalDecisions.Windows.Forms.CRViewerSys.CULTURE.resx CrystalDecisions.Windows.Forms.CRViewerSys.CULTURE.resources
        
  2. Create the directory C:\vs7\keys, and create a fake key:
    sn -k C:\vs7\keys\crystalpublickey.snk
        
  3. Create the satellite assembly
    al /embed:CrystalDecisions.Windows.Forms.CRViewerSys.CULTURE.resources /out:CrystalDecisions.Windows.Forms.resources.dll /template:CrystalDecisions.Windows.Forms.dll /culture:CULTURE
        
  4. Disassemble the created file:
    ildasm CrystalDecisions.Windows.Forms.resources.dll /out=CrystalDecisions.Windows.Forms.resources.il
        
  5. Open the file "CrystalDecisions.Windows.Forms.il" in the notepad and copy the part containing the public key, something like:
    .publickey = (00 00 00 .....               // ...
        ...                          // ...
        ...                          // ...
        AA AA AA ...               ) // ...
        
    to the clipboard.
  6. Open the file CrystalDecisions.Windows.Forms.resources.il in the notepad, and replace the publickey block (remove the old part and paste new there).
  7. Compile the file.
    ilasm /dll CrystalDecisions.Windows.Forms.resources.il
        
  8. Now fool the framework not to check the public key, like described here: http://www.grimes.demon.co.uk/workshops/fusionWSCrackOne.htm. So download snSig.cs and alterSn.cs to C:\crystalresources and execute:
    csc /t:library snSig.cs
        csc alterSn.cs /r:snSig.dll
        alterSn CrystalDecisions.Windows.Forms.resources.dll
        
  9. Create the subdirectory CULTURE in your application directory (where your .exes and .dlls reside). Copy CrystalDecisions.Windows.Forms.resources.dll to that directory.
Repeat step 2 for every culture you want to localize.

转载于:https://www.cnblogs.com/Luoke365/archive/2008/06/05/1214749.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值