PS:可以写成静态方法,编译到动态库里,到处都可以用了。
using System.IO;
using System.Reflection;
public class Configs
{
private string m_CurrentPath;
private string Platform
{
get
{
return Environment.OSVersion.Platform.ToString();
}
}
public string CurrentPath
{
get
{
if(Platform.Equals("WinCE"))
{
m_CurrentPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().GetName().CodeBase);
}
else if(Platform.Equals("Win32NT"))
{
m_CurrentPath = Directory.GetCurrentDirectory();
}
return m_CurrentPath;
}
}
public Configs()
{
}
}