|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Explore an assembly programatically...I will write my self. 1st I want to write a skeletton library which feature all type/method I'm using (with no real code inside). For that I would like to go through my project, track every library object I'm using and all the method I'm calling and create a mock-up library where I would define all the types and and methods I'm using from the 3rd party lib. The thing is I would like to do it automatically through someting like reflection. Is there a way I could do that simply? Any tips or link? ==== here is an example: current code below ==== class MyProject { void AMethod(ALibObject1 obj) { obj.Method1(); ALibObject2 o2 = obj.Method2(); o2.Method3(new LibObject3()); } } I want to go through the code (or probably compiled assembly) above (automatically), by using reflection on the assembly (or something similar) and produce: public class ALibObject1 { public void Method1() {} ALibObject2 Method2() { return null; } } public class ALibObject2 { public void Method3(LibObject3 obj) {} } public class LibObject3 { } ==================== Any tip on how to do that simply in an automated way? One way I could think of is by using Lutz Roeder's Reflector and look for an
add-in that does something similar or maybe even write your own plugin for Reflector. You could to do this manually but that depends on the size of the library off course. Gabriel Lozano-Morán Show quote "Lloyd Dupont" <net.galador@ld> wrote in message news:OIwzMuaGHHA.1264@TK2MSFTNGP03.phx.gbl... > In my current project I want to replace a library I'm using by an other > one I will write my self. > > 1st I want to write a skeletton library which feature all type/method I'm > using (with no real code inside). > > For that I would like to go through my project, track every library object > I'm using and all the method I'm calling and create a mock-up library > where I would define all the types and and methods I'm using from the 3rd > party lib. > The thing is I would like to do it automatically through someting like > reflection. > > Is there a way I could do that simply? Any tips or link? > > > ==== here is an example: current code below ==== > class MyProject > { > void AMethod(ALibObject1 obj) > { > obj.Method1(); > ALibObject2 o2 = obj.Method2(); > o2.Method3(new LibObject3()); > } > } > > I want to go through the code (or probably compiled assembly) above > (automatically), by using reflection on the assembly (or something > similar) and produce: > public class ALibObject1 > { > public void Method1() {} > ALibObject2 Method2() { return null; } > } > public class ALibObject2 > { > public void Method3(LibObject3 obj) {} > } > public class LibObject3 > { > } > ==================== > > Any tip on how to do that simply in an automated way? > Indeed, I just found that:
http://msdn.microsoft.com/msdnmag/issues/06/03/TestRun/ Show quote "Gabriel Lozano-Morán" <ab***@frontbridge.com> wrote in message news:OEEu5CbGHHA.924@TK2MSFTNGP02.phx.gbl... > One way I could think of is by using Lutz Roeder's Reflector and look for > an add-in that does something similar or maybe even write your own plugin > for Reflector. You could to do this manually but that depends on the size > of the library off course. > > Gabriel Lozano-Morán > > "Lloyd Dupont" <net.galador@ld> wrote in message > news:OIwzMuaGHHA.1264@TK2MSFTNGP03.phx.gbl... >> In my current project I want to replace a library I'm using by an other >> one I will write my self. >> >> 1st I want to write a skeletton library which feature all type/method I'm >> using (with no real code inside). >> >> For that I would like to go through my project, track every library >> object I'm using and all the method I'm calling and create a mock-up >> library where I would define all the types and and methods I'm using from >> the 3rd party lib. >> The thing is I would like to do it automatically through someting like >> reflection. >> >> Is there a way I could do that simply? Any tips or link? >> >> >> ==== here is an example: current code below ==== >> class MyProject >> { >> void AMethod(ALibObject1 obj) >> { >> obj.Method1(); >> ALibObject2 o2 = obj.Method2(); >> o2.Method3(new LibObject3()); >> } >> } >> >> I want to go through the code (or probably compiled assembly) above >> (automatically), by using reflection on the assembly (or something >> similar) and produce: >> public class ALibObject1 >> { >> public void Method1() {} >> ALibObject2 Method2() { return null; } >> } >> public class ALibObject2 >> { >> public void Method3(LibObject3 obj) {} >> } >> public class LibObject3 >> { >> } >> ==================== >> >> Any tip on how to do that simply in an automated way? >> > > Good article:
http://www.codeproject.com/csharp/sdilreader.asp Show quote "Lloyd Dupont" <net.galador@ld> wrote in message news:OIwzMuaGHHA.1264@TK2MSFTNGP03.phx.gbl... > In my current project I want to replace a library I'm using by an other > one I will write my self. > > 1st I want to write a skeletton library which feature all type/method I'm > using (with no real code inside). > > For that I would like to go through my project, track every library object > I'm using and all the method I'm calling and create a mock-up library > where I would define all the types and and methods I'm using from the 3rd > party lib. > The thing is I would like to do it automatically through someting like > reflection. > > Is there a way I could do that simply? Any tips or link? > > > ==== here is an example: current code below ==== > class MyProject > { > void AMethod(ALibObject1 obj) > { > obj.Method1(); > ALibObject2 o2 = obj.Method2(); > o2.Method3(new LibObject3()); > } > } > > I want to go through the code (or probably compiled assembly) above > (automatically), by using reflection on the assembly (or something > similar) and produce: > public class ALibObject1 > { > public void Method1() {} > ALibObject2 Method2() { return null; } > } > public class ALibObject2 > { > public void Method3(LibObject3 obj) {} > } > public class LibObject3 > { > } > ==================== > > Any tip on how to do that simply in an automated way? > |
|||||||||||||||||||||||