AlternateKeyGenerator
using System;
namespace Relativity.Transfer.Aspera
{
internal class AlternateKeyGenerator : ITransferPathKeyGenerator
{
private readonly IFileSystemService fileSystemService;
public AlternateKeyGenerator(IFileSystemService service)
{
fileSystemService = service;
}
public long GetKey(string path)
{
return PrimaryKeyGenerator.CreateKey(path);
}
public long GetKey(TransferPath path)
{
if (path == (TransferPath)null)
throw new ArgumentNullException("path");
string text = path.TargetFileName;
if (string.IsNullOrEmpty(text))
text = fileSystemService.GetFileName(path.SourcePath);
if (!string.IsNullOrEmpty(text))
return GetKey(string.IsNullOrEmpty(path.TargetPath) ? text : fileSystemService.Combine(path.TargetPath, text));
return 0;
}
}
}