2022-10-11 08:28:37 +05:00
|
|
|
|
using AsbCloudApp.Data;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.IO;
|
2022-10-06 13:41:46 +05:00
|
|
|
|
using System.Threading;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
2022-10-06 14:37:03 +05:00
|
|
|
|
namespace AsbCloudApp.Repositories
|
2022-10-06 13:41:46 +05:00
|
|
|
|
{
|
2022-10-11 08:28:37 +05:00
|
|
|
|
#nullable enable
|
2022-10-06 13:41:46 +05:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Репозиторий хранения фалов
|
|
|
|
|
/// </summary>
|
|
|
|
|
public interface IFileStorageRepository
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Директория хранения файлов
|
|
|
|
|
/// </summary>
|
|
|
|
|
string RootPath { get; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Получение длинны фала и проверка его наличия, если отсутствует падает исключение
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="srcFilePath"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
long GetLengthFile(string srcFilePath);
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Перемещение файла
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="srcFilePath"></param>
|
|
|
|
|
/// <param name="filePath"></param>
|
2022-10-06 14:37:03 +05:00
|
|
|
|
void MoveFile(string srcFilePath, string filePath);
|
2022-10-06 13:41:46 +05:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Копирование файла
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
Task CopyFileAsync(string filePath, Stream fileStream, CancellationToken token);
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Удаление файла
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="fileName"></param>
|
|
|
|
|
void DeleteFile(string fileName);
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Проверка наличия файла
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="fullPath"></param>
|
|
|
|
|
/// <param name="fileName"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
bool FileExists(string fullPath, string fileName);
|
2022-10-11 08:28:37 +05:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Удаление всех файлов с диска о которых нет информации в базе
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="idWell"></param>
|
|
|
|
|
/// <param name="idsFiles"></param>
|
|
|
|
|
int DeleteFilesNotExistStorage(int idWell, IEnumerable<int> idsFiles);
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Вывод списка всех файлов из базы, для которых нет файла на диске
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="idWell"></param>
|
|
|
|
|
/// <param name="files"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
IEnumerable<FileInfoDto> GetListFilesNotDisc(int idWell, IEnumerable<FileInfoDto> files);
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Получение пути к файлу
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="idWell"></param>
|
|
|
|
|
/// <param name="idCategory"></param>
|
|
|
|
|
/// <param name="fileFullName"></param>
|
|
|
|
|
/// <param name="fileId"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
string MakeFilePath(int idWell, int idCategory, string fileFullName, int fileId);
|
2022-10-06 13:41:46 +05:00
|
|
|
|
}
|
2022-10-11 08:28:37 +05:00
|
|
|
|
#nullable disable
|
2022-10-06 13:41:46 +05:00
|
|
|
|
}
|