<PackageReference Include="Relativity.Server.Transfer.SDK" Version="7.7.0" />

ResourceServerNameFormatter

public static class ResourceServerNameFormatter
using Relativity.Transfer.Resources; using System; using System.Globalization; using System.Linq; using System.Text.RegularExpressions; namespace Relativity.Transfer { public static class ResourceServerNameFormatter { public static int GetCloudFileShareNumber(string name) { if (string.IsNullOrEmpty(name)) throw new ArgumentNullException("name"); MatchCollection cloudRegexMatches = GetCloudRegexMatches(name); if (cloudRegexMatches != null) try { string value = cloudRegexMatches[0].Groups[1].Value; return string.IsNullOrEmpty(value) ? 1 : Convert.ToInt32(value); } catch (Exception innerException) { throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, CoreStrings.FileShareNumberNotFoundExceptionMessage, name), innerException); } throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, CoreStrings.FileShareNumberNotFoundExceptionMessage, name)); } public static string GetCloudTenantId(string name) { if (string.IsNullOrEmpty(name)) throw new ArgumentNullException("name"); MatchCollection cloudRegexMatches = GetCloudRegexMatches(name); if (cloudRegexMatches != null) try { return cloudRegexMatches[0].Groups[2].Value; } catch (Exception innerException) { throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, CoreStrings.TenantIdNotFoundExceptionMessage, name), innerException); } throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, CoreStrings.TenantIdNotFoundExceptionMessage, name)); } private static MatchCollection GetCloudRegexMatches(string name) { return (from pattern in GlobalSettings.Instance.CloudFileShareRegexPatterns select Regex.Matches(name, pattern, RegexOptions.IgnoreCase)).FirstOrDefault(delegate(MatchCollection matches) { if (matches.Count == 1) return matches[0].Groups.Count >= 2; return false; }); } } }