diff --git a/clio/Common/FileSystem.cs b/clio/Common/FileSystem.cs index 5627a3f5..2a6373e2 100644 --- a/clio/Common/FileSystem.cs +++ b/clio/Common/FileSystem.cs @@ -6,329 +6,326 @@ using System.Security.Cryptography; using System.Threading; using Ms = System.IO.Abstractions; -namespace Clio.Common -{ +namespace Clio.Common; - #region Class: FileSystem +#region Class: FileSystem - public class FileSystem : IFileSystem - { +public class FileSystem : IFileSystem +{ - private readonly Ms.IFileSystem _msFileSystem; - public FileSystem(Ms.IFileSystem msFileSystem){ - _msFileSystem = msFileSystem; - } + private readonly Ms.IFileSystem _msFileSystem; + public FileSystem(Ms.IFileSystem msFileSystem){ + _msFileSystem = msFileSystem; + } - #region Methods: Public + #region Methods: Public - public static void CreateLink(string link, string target) { - Process mklinkProcess = Process.Start( - new ProcessStartInfo("cmd", $"/c mklink /D \"{link}\" \"{target}\"") { - CreateNoWindow = true - }); - mklinkProcess.WaitForExit(); - } + public static void CreateLink(string link, string target) { + Process mklinkProcess = Process.Start( + new ProcessStartInfo("cmd", $"/c mklink /D \"{link}\" \"{target}\"") { + CreateNoWindow = true + }); + mklinkProcess.WaitForExit(); + } - public Ms.IFileSystemInfo CreateSymLink(string path, string pathToTarget){ - path.CheckArgumentNullOrWhiteSpace(nameof(path)); - pathToTarget.CheckArgumentNullOrWhiteSpace(nameof(pathToTarget)); - if(_msFileSystem.File.Exists(path)) { - return CreateFileSymLink(path, pathToTarget); - } - if(_msFileSystem.Directory.Exists(path)) { - return CreateDirectorySymLink(path, pathToTarget); - } - throw new ArgumentOutOfRangeException(nameof(path), $"Path {path} does not exist"); + public Ms.IFileSystemInfo CreateSymLink(string path, string pathToTarget){ + path.CheckArgumentNullOrWhiteSpace(nameof(path)); + pathToTarget.CheckArgumentNullOrWhiteSpace(nameof(pathToTarget)); + if(_msFileSystem.File.Exists(path)) { + return CreateFileSymLink(path, pathToTarget); } - public Ms.IFileSystemInfo CreateFileSymLink(string path, string pathToTarget) => - _msFileSystem.File.CreateSymbolicLink(path, pathToTarget); - public Ms.IFileSystemInfo CreateDirectorySymLink(string path, string pathToTarget) => - _msFileSystem.Directory.CreateSymbolicLink(path, pathToTarget); - - public void CheckOrDeleteExistsFile(string filePath, bool delete) { - if (!_msFileSystem.File.Exists(filePath)) { - return; - } - if (delete) { - DeleteFile(filePath); - } else { - throw new Exception($"The file {filePath} already exist"); - } + if(_msFileSystem.Directory.Exists(path)) { + return CreateDirectorySymLink(path, pathToTarget); } + throw new ArgumentOutOfRangeException(nameof(path), $"Path {path} does not exist"); + } + public Ms.IFileSystemInfo CreateFileSymLink(string path, string pathToTarget) => + _msFileSystem.File.CreateSymbolicLink(path, pathToTarget); + public Ms.IFileSystemInfo CreateDirectorySymLink(string path, string pathToTarget) => + _msFileSystem.Directory.CreateSymbolicLink(path, pathToTarget); - public void CopyFiles(IEnumerable filesPaths, string destinationDirectory, bool overwrite) { - filesPaths.CheckArgumentNull(nameof(filesPaths)); - destinationDirectory.CheckArgumentNullOrWhiteSpace(nameof(destinationDirectory)); - foreach (string sourceFilePath in filesPaths) { - Ms.IFileInfoFactory fileInfoFactory = _msFileSystem.FileInfo; - Ms.IFileInfo sourceFileInfo = fileInfoFactory.New(sourceFilePath); - string destinationFilePath = Path.Combine(destinationDirectory, sourceFileInfo.Name); - _msFileSystem.File.Copy(sourceFilePath, destinationFilePath, overwrite); - } + public void CheckOrDeleteExistsFile(string filePath, bool delete) { + if (!_msFileSystem.File.Exists(filePath)) { + return; } - - public void CopyFile(string from, string to, bool overwrite){ - _msFileSystem.File.Copy(from, to, overwrite); + if (delete) { + DeleteFile(filePath); + } else { + throw new Exception($"The file {filePath} already exist"); } + } - public bool DeleteFile(string filePath) { - filePath.CheckArgumentNullOrWhiteSpace(nameof(filePath)); - if (IsReadOnlyFile(filePath)) { - ResetFileReadOnlyAttribute(filePath); - } - _msFileSystem.File.Delete(filePath); - //TODO: Discuss with P.Makarchuk - //why return type is bool when always true - return true; + public void CopyFiles(IEnumerable filesPaths, string destinationDirectory, bool overwrite) { + filesPaths.CheckArgumentNull(nameof(filesPaths)); + destinationDirectory.CheckArgumentNullOrWhiteSpace(nameof(destinationDirectory)); + foreach (string sourceFilePath in filesPaths) { + Ms.IFileInfoFactory fileInfoFactory = _msFileSystem.FileInfo; + Ms.IFileInfo sourceFileInfo = fileInfoFactory.New(sourceFilePath); + string destinationFilePath = Path.Combine(destinationDirectory, sourceFileInfo.Name); + _msFileSystem.File.Copy(sourceFilePath, destinationFilePath, overwrite); } + } + + public void CopyFile(string from, string to, bool overwrite){ + _msFileSystem.File.Copy(from, to, overwrite); + } + + public bool DeleteFile(string filePath) { + filePath.CheckArgumentNullOrWhiteSpace(nameof(filePath)); + if (IsReadOnlyFile(filePath)) { + ResetFileReadOnlyAttribute(filePath); + } + _msFileSystem.File.Delete(filePath); + //TODO: Discuss with P.Makarchuk + //why return type is bool when always true + return true; + } - public bool DeleteFileIfExists(string filePath) => - _msFileSystem.File.Exists(filePath) && DeleteFile(filePath); + public bool DeleteFileIfExists(string filePath) => + _msFileSystem.File.Exists(filePath) && DeleteFile(filePath); - public bool ExistsFile(string filePath) => _msFileSystem.File.Exists(filePath); + public bool ExistsFile(string filePath) => _msFileSystem.File.Exists(filePath); - public string ExtractFileNameFromPath(string filePath) { - filePath.CheckArgumentNullOrWhiteSpace(nameof(filePath)); - var packageFileInfo = new FileInfo(filePath); - return GetFileNameWithoutExtension(packageFileInfo); - } + public string ExtractFileNameFromPath(string filePath) { + filePath.CheckArgumentNullOrWhiteSpace(nameof(filePath)); + var packageFileInfo = new FileInfo(filePath); + return GetFileNameWithoutExtension(packageFileInfo); + } - public string ExtractFileExtensionFromPath(string filePath) { - filePath.CheckArgumentNullOrWhiteSpace(nameof(filePath)); - //var fileInfo = new FileInfo(filePath); - Ms.IFileInfoFactory fileInfoFactory = _msFileSystem.FileInfo; - Ms.IFileInfo fileInfo = fileInfoFactory.New(filePath); - return fileInfo.Extension; - } + public string ExtractFileExtensionFromPath(string filePath) { + filePath.CheckArgumentNullOrWhiteSpace(nameof(filePath)); + //var fileInfo = new FileInfo(filePath); + Ms.IFileInfoFactory fileInfoFactory = _msFileSystem.FileInfo; + Ms.IFileInfo fileInfo = fileInfoFactory.New(filePath); + return fileInfo.Extension; + } - public string GetFileNameWithoutExtension(FileInfo fileInfo) { - fileInfo.CheckArgumentNull(nameof(fileInfo)); - return fileInfo.Name - .Substring(0, fileInfo.Name.Length - fileInfo.Extension.Length); - } + public string GetFileNameWithoutExtension(FileInfo fileInfo) { + fileInfo.CheckArgumentNull(nameof(fileInfo)); + return fileInfo.Name + .Substring(0, fileInfo.Name.Length - fileInfo.Extension.Length); + } - public string[] GetFiles(string directoryPath) { - //TODO: Should probably be IEnumerable instead of string[] - directoryPath.CheckArgumentNullOrWhiteSpace(nameof(directoryPath)); - return _msFileSystem.Directory.GetFiles(directoryPath); - } + public string[] GetFiles(string directoryPath) { + //TODO: Should probably be IEnumerable instead of string[] + directoryPath.CheckArgumentNullOrWhiteSpace(nameof(directoryPath)); + return _msFileSystem.Directory.GetFiles(directoryPath); + } - public string[] GetFiles(string directoryPath, string searchPattern, SearchOption searchOption) { - directoryPath.CheckArgumentNullOrWhiteSpace(nameof(directoryPath)); - return _msFileSystem.Directory.GetFiles(directoryPath, searchPattern, searchOption); - } + public string[] GetFiles(string directoryPath, string searchPattern, SearchOption searchOption) { + directoryPath.CheckArgumentNullOrWhiteSpace(nameof(directoryPath)); + return _msFileSystem.Directory.GetFiles(directoryPath, searchPattern, searchOption); + } - public FileInfo[] GetFilesInfos(string directoryPath, string searchPattern, SearchOption searchOption) { - directoryPath.CheckArgumentNullOrWhiteSpace(nameof(directoryPath)); - var directoryInfo = new DirectoryInfo(directoryPath); + public FileInfo[] GetFilesInfos(string directoryPath, string searchPattern, SearchOption searchOption) { + directoryPath.CheckArgumentNullOrWhiteSpace(nameof(directoryPath)); + var directoryInfo = new DirectoryInfo(directoryPath); - //TODO: Discuss with P.Makarchuk - //directoryInfo.GetFiles causes System.IO.DirectoryNotFoundException when Schemas does not exist - if (directoryInfo.Exists){ - return directoryInfo.GetFiles(searchPattern, searchOption); - } - return new FileInfo[0] ; + //TODO: Discuss with P.Makarchuk + //directoryInfo.GetFiles causes System.IO.DirectoryNotFoundException when Schemas does not exist + if (directoryInfo.Exists){ + return directoryInfo.GetFiles(searchPattern, searchOption); } + return new FileInfo[0] ; + } - public bool IsReadOnlyFile(string filePath) { - if (!_msFileSystem.File.Exists(filePath)) { - return false; - } - return (_msFileSystem.File.GetAttributes(filePath) & FileAttributes.ReadOnly) != 0; + public bool IsReadOnlyFile(string filePath) { + if (!_msFileSystem.File.Exists(filePath)) { + return false; } + return (_msFileSystem.File.GetAttributes(filePath) & FileAttributes.ReadOnly) != 0; + } - public void MoveFile(string oldFilePath, string newFilePath) => - _msFileSystem.File.Move(oldFilePath, newFilePath); + public void MoveFile(string oldFilePath, string newFilePath) => + _msFileSystem.File.Move(oldFilePath, newFilePath); - public void ResetFileReadOnlyAttribute(string filePath) { - if (!_msFileSystem.File.Exists(filePath)) { - return; - } - if (IsReadOnlyFile(filePath)) { - _msFileSystem.File.SetAttributes(filePath, _msFileSystem.File.GetAttributes(filePath) & ~FileAttributes.ReadOnly); - } + public void ResetFileReadOnlyAttribute(string filePath) { + if (!_msFileSystem.File.Exists(filePath)) { + return; + } + if (IsReadOnlyFile(filePath)) { + _msFileSystem.File.SetAttributes(filePath, _msFileSystem.File.GetAttributes(filePath) & ~FileAttributes.ReadOnly); } + } - public string ReadAllText(string filePath) => - _msFileSystem.File.ReadAllText(filePath); + public string ReadAllText(string filePath) => + _msFileSystem.File.ReadAllText(filePath); - public void WriteAllTextToFile(string filePath, string contents) => - _msFileSystem.File.WriteAllText(filePath, contents); + public void WriteAllTextToFile(string filePath, string contents) => + _msFileSystem.File.WriteAllText(filePath, contents); - public void ClearOrCreateDirectory(string directoryPath) { - if (_msFileSystem.Directory.Exists(directoryPath)) { - ClearDirectory(directoryPath); - } - _msFileSystem.Directory.CreateDirectory(directoryPath); + public void ClearOrCreateDirectory(string directoryPath) { + if (_msFileSystem.Directory.Exists(directoryPath)) { + ClearDirectory(directoryPath); } + _msFileSystem.Directory.CreateDirectory(directoryPath); + } - public void CreateOrOverwriteExistsDirectoryIfNeeded(string directoryPath, bool overwrite) { - if (!_msFileSystem.Directory.Exists(directoryPath)) { - _msFileSystem.Directory.CreateDirectory(directoryPath); - return; - } - if (!overwrite) { - return; - } - ClearDirectory(directoryPath); + public void CreateOrOverwriteExistsDirectoryIfNeeded(string directoryPath, bool overwrite) { + if (!_msFileSystem.Directory.Exists(directoryPath)) { + _msFileSystem.Directory.CreateDirectory(directoryPath); + return; + } + if (!overwrite) { + return; } + ClearDirectory(directoryPath); + } - public void ClearDirectory(string directoryPath) { - directoryPath.CheckArgumentNullOrWhiteSpace(nameof(directoryPath)); - string[] files = GetFiles(directoryPath); - foreach (string filePath in files) { - DeleteFileIfExists(filePath); - } - string[] directories = GetDirectories(directoryPath); - foreach (string childDirectoryPath in directories) { - SafeDeleteDirectory(childDirectoryPath); - } + public void ClearDirectory(string directoryPath) { + directoryPath.CheckArgumentNullOrWhiteSpace(nameof(directoryPath)); + string[] files = GetFiles(directoryPath); + foreach (string filePath in files) { + DeleteFileIfExists(filePath); } + string[] directories = GetDirectories(directoryPath); + foreach (string childDirectoryPath in directories) { + SafeDeleteDirectory(childDirectoryPath); + } + } - public void CopyDirectory(string source, string destination, bool overwrite) { - source.CheckArgumentNullOrWhiteSpace(nameof(source)); - destination.CheckArgumentNullOrWhiteSpace(nameof(destination)); - CreateOrOverwriteExistsDirectoryIfNeeded(destination, overwrite); - foreach (string filePath in _msFileSystem.Directory.GetFiles(source)) { - _msFileSystem.File.Copy(filePath, Path.Combine(destination, Path.GetFileName(filePath)), true); - } - foreach (string directoryPath in _msFileSystem.Directory.GetDirectories(source)) { - CopyDirectory(directoryPath, Path.Combine(destination, Path.GetFileName(directoryPath)), overwrite); - } + public void CopyDirectory(string source, string destination, bool overwrite) { + source.CheckArgumentNullOrWhiteSpace(nameof(source)); + destination.CheckArgumentNullOrWhiteSpace(nameof(destination)); + CreateOrOverwriteExistsDirectoryIfNeeded(destination, overwrite); + foreach (string filePath in _msFileSystem.Directory.GetFiles(source)) { + _msFileSystem.File.Copy(filePath, Path.Combine(destination, Path.GetFileName(filePath)), true); } + foreach (string directoryPath in _msFileSystem.Directory.GetDirectories(source)) { + CopyDirectory(directoryPath, Path.Combine(destination, Path.GetFileName(directoryPath)), overwrite); + } + } - public Ms.IDirectoryInfo CreateDirectory(string directoryPath) => - _msFileSystem.Directory.CreateDirectory(directoryPath); + public Ms.IDirectoryInfo CreateDirectory(string directoryPath) => + _msFileSystem.Directory.CreateDirectory(directoryPath); - public void CreateDirectoryIfNotExists(string directoryPath) { - if (_msFileSystem.Directory.Exists(directoryPath)) { - return; - } - _msFileSystem.Directory.CreateDirectory(directoryPath); + public void CreateDirectoryIfNotExists(string directoryPath) { + if (_msFileSystem.Directory.Exists(directoryPath)) { + return; } + _msFileSystem.Directory.CreateDirectory(directoryPath); + } - public void CreateOrClearDirectory(string directoryPath) { - if (_msFileSystem.Directory.Exists(directoryPath)) { - ClearDirectory(directoryPath); - } else { - _msFileSystem.Directory.CreateDirectory(directoryPath); - } + public void CreateOrClearDirectory(string directoryPath) { + if (_msFileSystem.Directory.Exists(directoryPath)) { + ClearDirectory(directoryPath); + } else { + _msFileSystem.Directory.CreateDirectory(directoryPath); } + } - public void DeleteDirectory(string directoryPath) { - DeleteDirectory(directoryPath, false); - } + public void DeleteDirectory(string directoryPath) { + DeleteDirectory(directoryPath, false); + } - public void DeleteDirectory(string directoryPath, bool recursive) { - directoryPath.CheckArgumentNullOrWhiteSpace(nameof(directoryPath)); - _msFileSystem.Directory.Delete(directoryPath, recursive); - } + public void DeleteDirectory(string directoryPath, bool recursive) { + directoryPath.CheckArgumentNullOrWhiteSpace(nameof(directoryPath)); + _msFileSystem.Directory.Delete(directoryPath, recursive); + } - public void DeleteDirectoryIfExists(string directoryPath) { - directoryPath.CheckArgumentNull(nameof(directoryPath)); - if (_msFileSystem.Directory.Exists(directoryPath)) { - _msFileSystem.Directory.Delete(directoryPath, true); - } + public void DeleteDirectoryIfExists(string directoryPath) { + directoryPath.CheckArgumentNull(nameof(directoryPath)); + if (_msFileSystem.Directory.Exists(directoryPath)) { + _msFileSystem.Directory.Delete(directoryPath, true); } + } - public bool ExistsDirectory(string directoryPath) => _msFileSystem.Directory.Exists(directoryPath); + public bool ExistsDirectory(string directoryPath) => _msFileSystem.Directory.Exists(directoryPath); - public string GetCurrentDirectoryIfEmpty(string directoryPath) { - return string.IsNullOrWhiteSpace(directoryPath) - ? _msFileSystem.Directory.GetCurrentDirectory() - : directoryPath; - } + public string GetCurrentDirectoryIfEmpty(string directoryPath) { + return string.IsNullOrWhiteSpace(directoryPath) + ? _msFileSystem.Directory.GetCurrentDirectory() + : directoryPath; + } - public bool IsEmptyDirectory() => - !_msFileSystem.Directory.GetFileSystemEntries(_msFileSystem.Directory.GetCurrentDirectory()).Any(); + public bool IsEmptyDirectory() => + !_msFileSystem.Directory.GetFileSystemEntries(_msFileSystem.Directory.GetCurrentDirectory()).Any(); - public string GetDestinationFileDirectory(string filePath, string destinationPath) { - filePath.CheckArgumentNullOrWhiteSpace(nameof(filePath)); - destinationPath.CheckArgumentNullOrWhiteSpace(nameof(destinationPath)); - string fileName = ExtractFileNameFromPath(filePath); - return Path.Combine(destinationPath, fileName); - } + public string GetDestinationFileDirectory(string filePath, string destinationPath) { + filePath.CheckArgumentNullOrWhiteSpace(nameof(filePath)); + destinationPath.CheckArgumentNullOrWhiteSpace(nameof(destinationPath)); + string fileName = ExtractFileNameFromPath(filePath); + return Path.Combine(destinationPath, fileName); + } - public string[] GetDirectories(string directoryPath) { - directoryPath.CheckArgumentNullOrWhiteSpace(nameof(directoryPath)); - return _msFileSystem.Directory.GetDirectories(directoryPath); - } + public string[] GetDirectories(string directoryPath) { + directoryPath.CheckArgumentNullOrWhiteSpace(nameof(directoryPath)); + return _msFileSystem.Directory.GetDirectories(directoryPath); + } - public void OverwriteExistsDirectory(string directoryPath) { - directoryPath.CheckArgumentNullOrWhiteSpace(nameof(directoryPath)); - if (!_msFileSystem.Directory.Exists(directoryPath)) { - return; - } - _msFileSystem.Directory.Delete(directoryPath, true); - _msFileSystem.Directory.CreateDirectory(directoryPath); + public void OverwriteExistsDirectory(string directoryPath) { + directoryPath.CheckArgumentNullOrWhiteSpace(nameof(directoryPath)); + if (!_msFileSystem.Directory.Exists(directoryPath)) { + return; } + _msFileSystem.Directory.Delete(directoryPath, true); + _msFileSystem.Directory.CreateDirectory(directoryPath); + } - public void SafeDeleteDirectory(string directoryPath) { - directoryPath.CheckArgumentNullOrWhiteSpace(nameof(directoryPath)); - ClearDirectory(directoryPath); - DeleteDirectory(directoryPath, recursive: false); - while (ExistsDirectory(directoryPath)) { - Thread.Sleep(0); - } + public void SafeDeleteDirectory(string directoryPath) { + directoryPath.CheckArgumentNullOrWhiteSpace(nameof(directoryPath)); + ClearDirectory(directoryPath); + DeleteDirectory(directoryPath, recursive: false); + while (ExistsDirectory(directoryPath)) { + Thread.Sleep(0); } + } - public string ConvertToRelativePath(string path, string rootDirectoryPath) { - rootDirectoryPath = rootDirectoryPath.TrimEnd(Path.DirectorySeparatorChar); - int rootDirectoryPathLength = rootDirectoryPath.Length; - string relativePath = path.Substring(rootDirectoryPathLength); - return relativePath.TrimStart(Path.DirectorySeparatorChar); - } + public string ConvertToRelativePath(string path, string rootDirectoryPath) { + rootDirectoryPath = rootDirectoryPath.TrimEnd(Path.DirectorySeparatorChar); + int rootDirectoryPathLength = rootDirectoryPath.Length; + string relativePath = path.Substring(rootDirectoryPathLength); + return relativePath.TrimStart(Path.DirectorySeparatorChar); + } - public string NormalizeFilePathByPlatform(string filePath) { - if (string.IsNullOrWhiteSpace(filePath)) { - return filePath; - } - string[] filePathItem = filePath.Split(new char[] { '\\', '/' }, StringSplitOptions.None); - return Path.Combine(filePathItem); + public string NormalizeFilePathByPlatform(string filePath) { + if (string.IsNullOrWhiteSpace(filePath)) { + return filePath; } + string[] filePathItem = filePath.Split(new char[] { '\\', '/' }, StringSplitOptions.None); + return Path.Combine(filePathItem); + } - public enum Algorithm - { - SHA1, - SHA256, - SHA384, - SHA512, - MD5 - } + public enum Algorithm + { + SHA1, + SHA256, + SHA384, + SHA512, + MD5 + } - public string GetFileHash(Algorithm algorithm, string fileName){ - HashAlgorithm hashAlgorithm = algorithm switch { - Algorithm.SHA1 => SHA1.Create(), - Algorithm.SHA256 => SHA256.Create(), - Algorithm.SHA384 => SHA384.Create(), - Algorithm.SHA512 => SHA512.Create(), - Algorithm.MD5 => MD5.Create(), - var _ => throw new ArgumentOutOfRangeException(nameof(algorithm), algorithm, null) - }; + public string GetFileHash(Algorithm algorithm, string fileName){ + HashAlgorithm hashAlgorithm = algorithm switch { + Algorithm.SHA1 => SHA1.Create(), + Algorithm.SHA256 => SHA256.Create(), + Algorithm.SHA384 => SHA384.Create(), + Algorithm.SHA512 => SHA512.Create(), + Algorithm.MD5 => MD5.Create(), + var _ => throw new ArgumentOutOfRangeException(nameof(algorithm), algorithm, null) + }; - using Ms.FileSystemStream stream = _msFileSystem.File.OpenRead(fileName); - byte[] hash = hashAlgorithm.ComputeHash(stream); - return BitConverter.ToString(hash).Replace("-", string.Empty); - } + using Ms.FileSystemStream stream = _msFileSystem.File.OpenRead(fileName); + byte[] hash = hashAlgorithm.ComputeHash(stream); + return BitConverter.ToString(hash).Replace("-", string.Empty); + } - public bool CompareFiles(string first, string second) => CompareFiles(Algorithm.MD5, first, second); - public string[] GetDirectories() { - return GetDirectories(Directory.GetCurrentDirectory()); - } + public bool CompareFiles(string first, string second) => CompareFiles(Algorithm.MD5, first, second); + public string[] GetDirectories() { + return GetDirectories(Directory.GetCurrentDirectory()); + } - public bool CompareFiles(Algorithm algorithm, string first, string second){ - if (!_msFileSystem.File.Exists(first) || !_msFileSystem.File.Exists(second)){ - return false; - } - return GetFileHash(algorithm, first) == GetFileHash(algorithm, second); + public bool CompareFiles(Algorithm algorithm, string first, string second){ + if (!_msFileSystem.File.Exists(first) || !_msFileSystem.File.Exists(second)){ + return false; } - - #endregion - + return GetFileHash(algorithm, first) == GetFileHash(algorithm, second); } - + #endregion -} \ No newline at end of file +} + +#endregion \ No newline at end of file diff --git a/qodana.yaml b/qodana.yaml index 1e2e55e0..6623d3ee 100644 --- a/qodana.yaml +++ b/qodana.yaml @@ -31,6 +31,25 @@ exclude: - name: SuggestVarOrType_BuiltInTypes - name: SuggestVarOrType_DeconstructionDeclarations dot-net: - solution: clio.sln -dotnet: + solution: clio.sln +dotnet: project: ./clio/clio.csproj +include: + - name: UseArrayEmptyMethod + - name: RedundantPatternParentheses + - name: ArrangeNamespaceBody + - name: UseVerbatimString + - name: CA1822 + - name: ConvertIfStatementToReturnStatement + - name: RedundantIfElseBlock + - name: SuggestBaseTypeForParameter + - name: ArrangeTrailingCommaInMultilineLists + - name: MemberCanBeMadeStatic.Local + - name: RedundantEmptyObjectCreationArgumentList + - name: ReplaceSubstringWithRangeIndexer + - name: ArrangeTypeModifiers + - name: BuiltInTypeReferenceStyle + - name: CA1825 + - name: ConvertToConstant.Local + - name: RedundantArrayCreationExpression + - name: RedundantLambdaSignatureParentheses