private string NormalizeFileName()
{
// here, we need to flip the backslashes to forward-slashes,
// also, we need to trim the \\server\share syntax from any UNC path.
// and finally, we need to remove any leading .\
string SlashFixed = FileName.Replace("\\", "/");
string s1 = null;
if ((_TrimVolumeFromFullyQualifiedPaths) && (FileName.Length >= 3)
&& (FileName[1] == ':') && (SlashFixed[2] == '/'))
{
// trim off volume letter, colon, and slash
s1 = SlashFixed.Substring(3);
}
else if ((FileName.Length >= 4)
&& ((SlashFixed[0] == '/') && (SlashFixed[1] == '/')))
{
int n = SlashFixed.IndexOf('/', 2);
if (n == -1)
throw new ArgumentException("The path for that entry appears to be badly formatted");
s1 = SlashFixed.Substring(n + 1);
}
else if ((FileName.Length >= 3)
&& ((SlashFixed[0] == '.') && (SlashFixed[1] == '/')))
{
// trim off dot and slash
s1 = SlashFixed.Substring(2);
}
else
{
s1 = SlashFixed;
}
return s1;
}