FileCopyPolicyIsRemote method kinda shows the whole pattern

bool FileCopyPolicyIsRemote( Host h, string filename )
{
string host = h.Name;
/*string[] splits = filename.Split(new char[] {‘/’,’\\’} );// slash or backslash
string basename = splits[splits.Length-1];*/
string basename = Path.GetFileName(filename);
Match m;

if ( FileCopyPolicy==”overwrite” )
return true;
else if ( FileCopyPolicy==”rotate” )
return true;
else if ( FileCopyPolicy==”uselocal” )
return false;
else if ( ( null != (m = Regex.Match(FileCopyPolicy, @”uselocal-(\d+)day” ))) && m.Success )
{
short days = Convert.ToInt16(m.Groups[1].Value);
string returnfile = LocalCacheDirectory + host + Path.DirectorySeparatorChar + basename;
if ( File.Exists(returnfile) &&
( File.GetLastWriteTime(returnfile).AddDays(days) > DateTime.Now ) &&
( new FileInfo(returnfile).Length != 0 )
)
return false;
else
return true;
}
else
return false;//unknown policy

}