private string ExpandFileName(string sourceFile)
{
if (String.IsNullOrEmpty(sourceFile)) return sourceFile;
if (sourceFile.StartsWith(_dataDirectory, StringComparison.OrdinalIgnoreCase))
{
string dataDirectory;
#if PLATFORM_COMPACTFRAMEWORK
dataDirectory = Path.GetDirectoryName(System.Reflection.Assembly.GetCallingAssembly().GetName().CodeBase);
#else
dataDirectory = AppDomain.CurrentDomain.GetData("DataDirectory") as string;
if (String.IsNullOrEmpty(dataDirectory))
dataDirectory = AppDomain.CurrentDomain.BaseDirectory;
#endif
if (sourceFile.Length > _dataDirectory.Length)
{
if (sourceFile[_dataDirectory.Length] == Path.DirectorySeparatorChar ||
sourceFile[_dataDirectory.Length] == Path.AltDirectorySeparatorChar)
sourceFile = sourceFile.Remove(_dataDirectory.Length, 1);
}
sourceFile = Path.Combine(dataDirectory, sourceFile.Substring(_dataDirectory.Length));
}
#if !PLATFORM_COMPACTFRAMEWORK
sourceFile = Path.GetFullPath(sourceFile);
#endif
return sourceFile;
}