I have a .NET user control in C# and it has lots of exception messages(literals). If I extract these literals into a resource file and let these message stay the same. does this extraction help me to obfuscate my application?
Here is a small demo to explain what I said:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace TestResource
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button3_Click(object sender, EventArgs e)
{
int text1 = Convert.ToInt32(textBox1.Text);
int text2 = Convert.ToInt32(textBox2.Text);
int result = text1+text2;
if (result <= 100)
MessageBox.Show(result.ToString());
else
{
throw new ArgumentOutOfRangeException("exceeds the maximum upper bound 100");
}
}
}
}
now I extract this literal "exceeds the maximum upper bound 100" into a resource file and the following code as this:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace TestResource
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button3_Click(object sender, EventArgs e)
{
int text1 = Convert.ToInt32(textBox1.Text);
int text2 = Convert.ToInt32(textBox2.Text);
int result = text1+text2;
if (result <= 100)
MessageBox.Show(result.ToString());
else
{
throw new ArgumentOutOfRangeException(Resource.English.Exceeds100Message);
}
}
}
}
After I compiled this into an executable then run obfuscator software .
because this button click method is private, it will be obfuscated.
Does this "Resource.English.Exceeds100Message" variable help obfuscation?