Click here to Skip to main content
15,923,281 members
Home / Discussions / C#
   

C#

 
GeneralRe: not case-sensitive string.Replace() Pin
Bounz14-Aug-05 11:21
Bounz14-Aug-05 11:21 
GeneralRe: not case-sensitive string.Replace() Pin
Mohamad Al Husseiny14-Aug-05 11:29
Mohamad Al Husseiny14-Aug-05 11:29 
GeneralRe: not case-sensitive string.Replace() Pin
Guffa14-Aug-05 12:03
Guffa14-Aug-05 12:03 
GeneralRe: not case-sensitive string.Replace() Pin
Bounz15-Aug-05 9:14
Bounz15-Aug-05 9:14 
GeneralGetting the real directory of a GAC'd assembly Pin
MrEyes14-Aug-05 8:56
MrEyes14-Aug-05 8:56 
GeneralRe: Getting the real directory of a GAC'd assembly Pin
leppie14-Aug-05 9:20
leppie14-Aug-05 9:20 
GeneralRe: Getting the real directory of a GAC'd assembly Pin
MrEyes14-Aug-05 9:41
MrEyes14-Aug-05 9:41 
GeneralRe: Getting the real directory of a GAC'd assembly Pin
MrEyes14-Aug-05 11:16
MrEyes14-Aug-05 11:16 
It seems that I have found a solution, its nasty, its hacky, it probably wont be reliable but at the moment it seems to work.

When an assembly is entered into the GAC it is placed into the following directory :

c:\windows\assembly\GAC\[assembly name]\[assembly name]_[strong name]\

This directory also contains the following file :

__AssemblyInfo__.ini

This INI file contains a URL parameter which contains the path I need

using the following code:

private static string GetConfigPath(string configFileName)
		{
			string assemblyDirectory = string.Empty;

			//get the executing assembly
			Assembly executingAssembly = Assembly.GetExecutingAssembly();

			if( ( true == executingAssembly.GlobalAssemblyCache ))
			{
				//if assembly is in gac use this nasty hack to get the real path to the file
				IniReader iniReader = new IniReader(String.Format( @"{0}\{1}", System.IO.Path.GetDirectoryName(executingAssembly.Location), "__AssemblyInfo__.ini" ) );
				assemblyDirectory = System.IO.Path.GetDirectoryName( iniReader.ReadString("AssemblyInfo", "URL", "") );
			}
			else
			{
				assemblyDirectory = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().CodeBase);
			}

			return String.Format(@"{0}\{1}", assemblyDirectory, configFileName );
		}


I can get the directory + the file name I specify

This function relies on an IniReader class which I obtained from:

http://www.mentalis.org

As mention above, this works but IMHO it hacking as hell, I am also not overly impressed that this sparkly .NET Framework thing uses INI files.


post.mode = postmodes.signature;
SELECT everything FROM everywhere WHERE something = something_else;
> 1 Row Returned
> 42
QuestionHow to serialize the content of an ImageList class? Pin
bouli14-Aug-05 8:29
bouli14-Aug-05 8:29 
AnswerRe: How to serialize the content of an ImageList class? Pin
leppie14-Aug-05 9:24
leppie14-Aug-05 9:24 
GeneralRe: How to serialize the content of an ImageList class? Pin
bouli15-Aug-05 2:18
bouli15-Aug-05 2:18 
GeneralRe: How to serialize the content of an ImageList class? Pin
HumanOsc15-Aug-05 3:57
HumanOsc15-Aug-05 3:57 
GeneralRe: How to serialize the content of an ImageList class? Pin
bouli15-Aug-05 3:58
bouli15-Aug-05 3:58 
GeneralI need to handle the LWin (win logo) + D Pin
kevin_smoke14-Aug-05 7:46
kevin_smoke14-Aug-05 7:46 
GeneralRe: I need to handle the LWin (win logo) + D Pin
Dave Kreskowiak14-Aug-05 16:39
mveDave Kreskowiak14-Aug-05 16:39 
GeneralLoading a renamed assembly into another AppDomain Pin
EssOEss14-Aug-05 6:26
EssOEss14-Aug-05 6:26 
GeneralRe: Loading a renamed assembly into another AppDomain Pin
leppie14-Aug-05 9:30
leppie14-Aug-05 9:30 
GeneralRe: Loading a renamed assembly into another AppDomain Pin
EssOEss15-Aug-05 0:49
EssOEss15-Aug-05 0:49 
GeneralRe: Loading a renamed assembly into another AppDomain Pin
leppie15-Aug-05 4:57
leppie15-Aug-05 4:57 
GeneralRe: Loading a renamed assembly into another AppDomain Pin
EssOEss15-Aug-05 11:49
EssOEss15-Aug-05 11:49 
GeneralRe: Loading a renamed assembly into another AppDomain Pin
leppie15-Aug-05 20:39
leppie15-Aug-05 20:39 
QuestionHow to group within a datagrid Pin
David M J14-Aug-05 5:31
David M J14-Aug-05 5:31 
AnswerRe: How to group within a datagrid Pin
Mohamad Al Husseiny14-Aug-05 7:26
Mohamad Al Husseiny14-Aug-05 7:26 
Generalextracting icons from exe files Pin
Mridang Agarwalla14-Aug-05 4:48
Mridang Agarwalla14-Aug-05 4:48 
GeneralRe: extracting icons from exe files Pin
Mohamad Al Husseiny14-Aug-05 5:17
Mohamad Al Husseiny14-Aug-05 5:17 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.