public void Apply()
{
string newRelativePath;
string newShortRelativePath;
if (!_oldFullPath.StartsWithIgnoreCase(_rootDirectory))
{
if (IsFileAllowed(_rootDirectory, _fullPath, _fileSystem, _fileSystemFilter, out newRelativePath, out newShortRelativePath))
{
_entries.AddFile(newRelativePath, newShortRelativePath);
}
return;
}
var oldRelativePath = PathHelper.MakeRelative(_rootDirectory, _oldFullPath);
if (IsFileAllowed(_rootDirectory, _fullPath, _fileSystem, _fileSystemFilter, out newRelativePath, out newShortRelativePath))
{
if (_entries.ContainsFileEntry(oldRelativePath))
{
_entries.RenameFile(oldRelativePath, newRelativePath, newShortRelativePath);
}
else
{
_entries.AddFile(newRelativePath, newShortRelativePath);
}
}
else
{
_entries.DeleteFile(oldRelativePath);
}
}