public GetServerFolderShare ( string sInPath, string &sServerFolderShare ) : bool | ||
sInPath | string | |
sServerFolderShare | string | |
리턴 | bool |
public bool GetServerFolderShare(string sInPath, out string sServerFolderShare)
{
sServerFolderShare = string.Empty;
const char cPathDel = SlashC;
if(sInPath == null)
{
return false;
}
if(sInPath.Length <= 8)
{
return false;
}
if(sInPath[0] != cPathDel || sInPath[1] != cPathDel)
{
return false;
}
int environmentModel;
int iShare;
if((environmentModel = sInPath.IndexOf(cPathDel, 2)) == -1) //somewhere in hell
{
return false;
}
if((iShare = sInPath.IndexOf(cPathDel, environmentModel + 1)) == -1)
{
if(Directory.Exists(sInPath))
{
sServerFolderShare = sInPath.ToUpper() + cPathDel;
return true;
}
return false;
}
sServerFolderShare = sInPath.ToUpper().Substring(0, iShare + 1);
return true;
}
}
public void FileSystemQuery_GetServerFolderShare_PathLength_ExpectFalse() { //------------Setup for test-------------------------- //------------Execute Test--------------------------- var query = new FileSystemQuery(); string sServerFolderShare; var res = query.GetServerFolderShare("bob", out sServerFolderShare); //------------Assert Results------------------------- Assert.IsFalse(res); }