What can we really do with RAIL?
n//Create the RAssemblyDef representation of the Teste3.exe assembly
nRAssemblyDef rAssembly = RAssemblyDef.LoadAssembly("Teste3.exe");
n//Get the RTypeDef object for the type where teh properties are declared
nRTypeDef rtd = (RTypeDef)rAssembly.RModuleDef.GetType("FooBar");
n//Get the constructor method where to apply the changes
nRConstructorDef rcd = (RConstructorDef)rtd.GetConstructor(new RType[0]);
n//Get the property to be replaced
nRProperty rpro1 = rtd.GetProperty("Prop");
n//Get the replacement property
nRProperty rpro2 = rtd.GetProperty("Prop2");
n//Create the code transformer object
nCodeTransformer cc = new CodeTransformer();
n//Set the transformations to make in the code
ncc.RedirectPropertyAccess(rpro1,rpro2);
n//Aplly th changes
nrcd.Accept(cc);
n//Save the assembly
nrAssembly.SaveAssembly("Teste3.exe");
Redirect property access