473,409 Members | 2,004 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,409 software developers and data experts.

Explore an assembly programatically...

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?
Dec 7 '06 #1
3 1259
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@ldwrote in message
news:OI**************@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?

Dec 7 '06 #2
Indeed, I just found that:
http://msdn.microsoft.com/msdnmag/issues/06/03/TestRun/

"Gabriel Lozano-Morán" <ab***@frontbridge.comwrote in message
news:OE*************@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@ldwrote in message
news:OI**************@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?


Dec 7 '06 #3
Good article:
http://www.codeproject.com/csharp/sdilreader.asp

"Lloyd Dupont" <net.galador@ldwrote in message
news:OI**************@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?

Dec 7 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: M Kenyon | last post by:
In stead of storing a string in my code of the current version that duplicates the assembly version, can I read the assembly version programatically? Thanks.
2
by: David | last post by:
Hi, I'm working on a client\server project and I would like the client to be able to check the server to see if it requires a new dll (all of the dlls are based on a single interface).. if so it...
6
by: Mats-Lennart Hansson | last post by:
Hi, Is there a way to define where the assembly should search for its referenced assemblies? I have my assemblies in different locations and I don't want to add them the GAC. Any help is...
3
by: Max | last post by:
Is there a way to register an assembly programatically?
14
by: Nak | last post by:
Hi there, Does anyone know how I would get the value of the assembly GUID in code from within the same application? Thanks in advance. Nick. --...
10
by: Mythran | last post by:
I wrote the XML file for a VB.Net assembly which *should* work in my opinion. How do I get this xml file to work so my assembly has the Intellisense features which C# has built in? (code commenting...
0
by: R Reyes | last post by:
ISSUE (reposted) =========================== Can someone please explain to me why I can't get the MS Word Interop assembly to work in my VS2005 project? For many people, they say they add the...
3
by: ibiza | last post by:
Hi, first, I must say that I don't know too much about an application "assembly name". However, I am trying to set a fixed one for my web project, as it seems to change for a random name almost...
7
by: chage | last post by:
Hi, I have been searching around to try adding reference assembly to another assembly during runtime, programatically. Is this possible in .Net? The reason for this is because i am having...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.