public static string GetRoleName(string rootPath, string currentPath)
{
bool found = false;
string roleName = null;
if (!(rootPath.Length >= currentPath.Length))
{
string difference = currentPath.Replace(rootPath, string.Empty);
roleName = difference.Split(new char[] { Path.DirectorySeparatorChar }, StringSplitOptions.RemoveEmptyEntries).GetValue(0).ToString();
CloudServiceProject service = new CloudServiceProject(rootPath, null);
found = service.Components.RoleExists(roleName);
}
if (!found)
{
throw new ArgumentException(string.Format(Resources.CannotFindRole, currentPath));
}
return roleName;
}