Jump to content
Tuts 4 You

Comparing code


CloneWa

Recommended Posts

Hi. I am trying to find the best way to programatically "map" and compare code. Basically I have different versions of an application which is partly obfuscated and thus the names are different in every version and I'd like to find certain changes.

For example, there could be a class like this:

namespace ns1
{
  public class SomeClass1
  {
    public string MyProperty1 { get; set }
    
    public void Method1()
    {
      // Code
    }
    
    public void Method2()
    {
      // Code
    }
  }
}

Then, in another version of the source code, it could look like this:

namespace ns183
{
  public class AnotherClass112
  {
    public string someProperty1 { get; set }
    
    public void DoStuff22()
    {
      // Same code, but also with different names
    }
    
    public void LL234()
    {
      // Same code, but also with different names
    }
  }
}

So both of these are the same, but everything just has different names, and maybe some things are switched around. So basically I'm asking if anyone have a good idea for a way to "map" this code, without being able to look up the same names, so that I can find the same classes, and know if code has been removed or added? (So that I can first analyze one version and then find differences in other versions)

I'm thinking it would be easy to do it for the classes which have a lot of code that can be used to compare with. But what if there is little to no code in a class, how would I find the same class in a different version? Or if there are multiple classes that are very similar to eachother? I guess I'd then have it analyze where that class is used throughout the project, and then determine it from there?

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...