Добавьте файлы проекта.
This commit is contained in:
39
SQLLinter/Infrastructure/Parser/FileSystemWrapper.cs
Normal file
39
SQLLinter/Infrastructure/Parser/FileSystemWrapper.cs
Normal file
@@ -0,0 +1,39 @@
|
||||
using SQLLinter.Core.Interfaces;
|
||||
|
||||
namespace SQLLinter.Infrastructure.Parser
|
||||
{
|
||||
public class FileSystemWrapper : IFileSystemWrapper
|
||||
{
|
||||
|
||||
public bool FileExists(string path)
|
||||
{
|
||||
path = RemoveQuotes(path);
|
||||
return File.Exists(path);
|
||||
}
|
||||
|
||||
public bool PathIsValidForLint(string path)
|
||||
{
|
||||
path = RemoveQuotes(path);
|
||||
if (!File.Exists(path))
|
||||
{
|
||||
return Directory.Exists(path) || PathContainsWildCard(path);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private static bool PathContainsWildCard(string filePath)
|
||||
{
|
||||
return filePath.Contains("*") || filePath.Contains("?");
|
||||
}
|
||||
|
||||
private string RemoveQuotes(string path)
|
||||
{
|
||||
return path.Replace("\"", string.Empty);
|
||||
}
|
||||
|
||||
public string CombinePath(params string[] paths)
|
||||
{
|
||||
return Path.Combine(paths);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user