|
Bounz wrote:
myClient = new SmtpClient(serverName, Convert.ToInt32(serverPort));
You may use IPAddress or the Dns Name of the server also. But the quicker trick would be CDOSys can be configured to relay to the local server and have the local server relay to a SmartHost in the network, which would do all relay, authorization checks etc to send the mail.
That way, our application is freed up from using a slow costly network communication resource through its process.
Vasudevan Deepak Kumar
Personal Web: http://www.lavanyadeepak.tk/
I Blog At: http://deepak.blogdrive.com/
|
|
|
|
|
|
How can i perfom case-NONsensitive replacing in string? Advice, please..
--
Digitally yours, Bounz
|
|
|
|
|
You could use a regular expression.
---
b { font-weight: normal; }
|
|
|
|
|
Give an example, please.
I want Replace() to find "thurman" in "Uma Thurman"... How can I implement this?
--
Digitally yours, Bounz
|
|
|
|
|
pattern like [Tt]hurman will work
Regex rx=new Regex("[Tt]est");
string strRep=rx.Replace("Test test testable Mohhahahah","XZXXX");
MessageBox.Show(strRep);
MCAD
|
|
|
|
|
thanks a lot to all..
i found answer:
i have to use
Regex rx = new Regex("(?i)WhatIWantToReplace"); <br />
string strRep = rx.Replace("TextInWhichReplace", "WithWhichReplace");
--
Digitally yours, Bounz
|
|
|
|
|
if you dont know the first character use
[\ws] which mean any character
so pattern would be like this [\ws]est
which will match test and best and so on
MCAD
|
|
|
|
|
Simply:
string result = Regex.Replace("Uma Thurman", "thurman", "whatever", RegexOptions.IgnoreCase);
---
b { font-weight: normal; }
|
|
|
|
|
Thanks a lot. I have learned a lot of new...
--
Digitally yours, Bounz
|
|
|
|
|
How can I get the actual directory of an assembly that has been placed into the GAC?
If I use the following code
System.Reflection.Assembly.GetExecutingAssembly().CodeBase
I get the GAC path back, e.g.
file:\c:\windows\assembly\gac\testGacLocation\1.0.0.0__826f0e5396cfccdecb
What I actually want it the real directory of the testGacLocation.dll file which is
C:\DirectoryA\DirectoryB\testGacLocation.dll
I cant hard code this as this directory may change but the DLL will always be gac'd.
The reason I need to do this is that there is text file in the testGacLocation.dll that the dll needs to read, when running an application that calls the read function in the dll it attempts to read from the application directory and not the dll directory.
post.mode = postmodes.signature;
SELECT everything FROM everywhere WHERE something = something_else;
> 1 Row Returned
> 42
|
|
|
|
|
|
Unfortunately that returns the directory of the executable directory
As an extended example I have the a DLL which is located here :
C:\Gactest\RefTestDll.dll
Which has the following code :
using System;
namespace RefTestDll
{
public class Dll
{
public string GetRefDirectory()
{
return System.Reflection.Assembly.GetEntryAssembly().CodeBase;
}
}
}
This dll is added to the GAC
I then have an application located here :
c:\GacTestApp\gactestapp.exe
Which uses the GAC reference to the DLL mentioned above using the following code:
using System;
namespace RefTestApp
{
class Class1
{
[STAThread]
static void Main(string[] args)
{
RefTestDll.Dll d = new RefTestDll.Dll();
Console.WriteLine(d.GetRefDirectory());
}
}
}
The only directories I seem to be able to get back from the Reflection namespace is either the real GAC directory or the directory of the calling application.
|
|
|
|
|
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;
Assembly executingAssembly = Assembly.GetExecutingAssembly();
if( ( true == executingAssembly.GlobalAssemblyCache ))
{
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
|
|
|
|
|
Hello gurus,
I'd like to know how it is possible to serialize the content of an ImageList class?
I wish to load and save the content of an ImageList from/to a file.
Can someone show me a code snipet please?
Best regards.
Fred.
There is no spoon.
|
|
|
|
|
|
And how to do that???
Fred.
There is no spoon.
|
|
|
|
|
Hello...
Here is an example without exception handling:
// serialize
FileStream fs = new FileStream("C:\\imagelist.iml",FileMode.CreateNew);
BinaryFormatter bf = new BinaryFormatter();
bf.Serialize(fs,il.ImageStream);
fs.Close();
// deserialize
FileStream fs = new FileStream("C:\\imagelist.iml",FileMode.Open);
BinaryFormatter bf = new BinaryFormatter();
il.ImageStream = (ImageListStreamer)bf.Deserialize(fs);
fs.Close();
|
|
|
|
|
After searching for a few "minutes", that's the way I have found in the MSDN.
It works fine.
Thanks
Fred.
There is no spoon.
|
|
|
|
|
Hi all,
any one can tell me how to maintain my form window on the desktop and not minimized when the user presses LWin (win logo) + D
thanks
kevin smoke
|
|
|
|
|
The only way to do that is to use a Low Level Keyboard hook. There are articles on this here at CP. Just don't pass that key combination to the next handler.
Also, Microsoft does NOT recommend doing this in their UI Guidelines. If I need to get to the desktop and your app gets in my way, my next mouse clicks go straight to Add/Remove programs...
Articles[^]
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Here's my problem:
When I load an assembly that has been renamed (its filename is not the same as the one in the manifest), loading it throws an exception.
I have tried both AppDomain.Load(byte[]) and having it be auto-loaded using AppDomain.CreateInstance(string, string) and both throw exceptions. (Serialization exception in the Load() case and some obscure assembly load exception in the second case).
I haven't tried Assembly.Load() since I need to load it in another domain and I haven't found a way to use it for that.
What's going on? How can I get it to ignore the name in the manifest and just load the assembly I give it?
|
|
|
|
|
|
That can't be it - the original assembly does not exist, only the renamed one.
|
|
|
|
|