UncPathToDocRootConverter
using Relativity.Transfer.Exceptions;
using System;
namespace Relativity.Transfer
{
public static class UncPathToDocRootConverter
{
private const string FilesPart = "Files";
public static string Convert(string uncPath, bool validateConvention = true)
{
if (uncPath == null)
throw new ArgumentException("UNC path cannot be null.");
if (uncPath.Trim().Length == 0)
throw new ArgumentException("Empty string is not a valid UNC path.");
string text = uncPath.Replace('\\', '/');
if (validateConvention)
ValidateNamingConvention(text);
int num = text.LastIndexOf("Files");
if (num < 0)
return text;
return text.Remove(num);
}
public static void ValidateNamingConvention(string uncPath)
{
if (uncPath.LastIndexOf("Files") < 0)
throw new FileshareConfigurationException(uncPath);
}
}
}