/// <summary> /// µÃµ½Â·¾¶Ó³ÉäµÄ½á¹û /// </summary> /// <param name="sourcePath">Դ·¾¶</param> /// <param name="destPath">Ó³ÉäºóµÄ·¾¶£¬Èç¹ûûÓÐÓ³É䣬Ôò·µ»ØԴ·¾¶</param> /// <returns>ÊÇ·ñÓ³Éä</returns> public bool GetMappedPath(string sourcePath, out string destPath) { bool result = false; destPath = sourcePath; OrganizationMappingElement elem = FindNearestElement(sourcePath); if (elem != null) { destPath = elem.DestinationPath; result = true; } return(result); }
private OrganizationMappingElement FindNearestElement(string sourcePath) { int matchLengh = -1; OrganizationMappingElement result = null; foreach (OrganizationMappingElement elem in this) { if (sourcePath.IndexOf(elem.SourcePath, StringComparison.OrdinalIgnoreCase) == 0) { if (elem.SourcePath.Length > matchLengh) { result = elem; matchLengh = elem.SourcePath.Length; } } } return(result); }