Home - Forums-.NET - Spices.Net - Resources

Spices.Net

NET code security, tools to protect, obfuscate, tamper defense, code and data safety, recover, convert, optimize, explore, browse and analyze .Net software.

This forum related to following products: Spices.Net Suite, Spices.Net Obfuscator, Spices.Net Decompiler

Resources
Link Posted: 17-Feb-2006 10:58
Hello,

  I have an interesting problem.  We have Windows Forms application having some resources issues.  We've created a small test application with 1 form and 1 .Resources file.   So our file structure is:

Form1.vb
Form1.resx
_Form1.Resources

We use the .Resources file to hold different strings, images, etc.  Due to the nature of our application we'd like to use the Full obfusication.  Since we can't have 2 files with the same name IE: Form1.resx and Form1.Resources we place an underscore in front of the .Resources file for the same file name.

To load the _Form1.Resources we use:

Dim Rm as Resources.ResourceManager = New System.Resources.ResourceManager("WindowsApplication._Form1", Me.GetType.Assembly)


Then to get the resource from the .Resources file as a test, I'm just doing this:
Windows.Forms.MessageBox.Show(rm.GetString("STRING1"), "TEST")

Where STRING1 is a string in the .Resources file.

After obfuscation, this application won't run.  What is the suggested way around this .resources file issue?  Thanks.
Link Posted: 19-Feb-2006 11:19
When type _Form1 is obfuscated, resources connected to this types is also obfuscated(renamed) to be correctly loaded by standard way:
[c#]
  ResourceManager rm = new ResourceManager(typeof(_Form1));
  // Get the culture of the currently executing thread.
  // Retrieve the value of the string resource named "welcome"
  String str = rm.GetString("welcome");

use
[c#]
ResourceManager rm = new ResourceManager(typeof(_Form1));

[VB.Net]
Dim rm as ResourceManager = New ResourceManager(Me.GetType());


instead of
[VB.Net]
Dim rm as ResourceManager = new ResourceManager("WindowsApplication._Form1", Me.GetType.Assembly);