2024-07-04 11:02:45 +05:00
|
|
|
|
using AsbCloudApp.Data;
|
2022-10-11 08:28:37 +05:00
|
|
|
|
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
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Репозиторий хранения фалов
|
|
|
|
|
/// </summary>
|
|
|
|
|
public interface IFileStorageRepository
|
|
|
|
|
{
|
2023-06-28 16:24:52 +05:00
|
|
|
|
|
2022-10-06 13:41:46 +05:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Получение длинны фала и проверка его наличия, если отсутствует падает исключение
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="srcFilePath"></param>
|
|
|
|
|
/// <returns></returns>
|
2022-10-11 14:42:04 +05:00
|
|
|
|
long GetFileLength(string srcFilePath);
|
2022-10-06 13:41:46 +05:00
|
|
|
|
|
|
|
|
|
/// <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>
|
2022-10-11 14:42:04 +05:00
|
|
|
|
/// <param name="filePathRec"></param>
|
|
|
|
|
/// <param name="fileStreamSrc"></param>
|
|
|
|
|
/// <param name="token"></param>
|
2022-10-06 13:41:46 +05:00
|
|
|
|
/// <returns></returns>
|
2022-10-11 14:42:04 +05:00
|
|
|
|
Task SaveFileAsync(string filePathRec, Stream fileStreamSrc, CancellationToken token);
|
2022-10-06 13:41:46 +05:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
2023-06-28 16:24:52 +05:00
|
|
|
|
/// Удаление пачки файлов
|
2022-10-06 13:41:46 +05:00
|
|
|
|
/// </summary>
|
2022-10-11 14:42:04 +05:00
|
|
|
|
/// <param name="filesName"></param>
|
2023-06-28 16:24:52 +05:00
|
|
|
|
void DeleteFiles(IEnumerable<string> filesName);
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Удаление одного файла
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="fileName"></param>
|
|
|
|
|
void DeleteFile(string fileName);
|
2022-10-11 08:28:37 +05:00
|
|
|
|
|
2023-08-10 11:45:05 +05:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Удаление директории
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="path"></param>
|
2023-09-14 11:33:46 +05:00
|
|
|
|
/// <param name="isRecursive"></param>
|
|
|
|
|
void DeleteDirectory(string path, bool isRecursive);
|
2023-08-10 11:45:05 +05:00
|
|
|
|
|
2022-10-11 08:28:37 +05:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Удаление всех файлов с диска о которых нет информации в базе
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="idWell"></param>
|
|
|
|
|
/// <param name="idsFiles"></param>
|
2022-10-17 08:58:28 +05:00
|
|
|
|
int DeleteFilesNotInList(int idWell, IEnumerable<int> idsFiles);
|
2022-10-11 08:28:37 +05:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Вывод списка всех файлов из базы, для которых нет файла на диске
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="files"></param>
|
|
|
|
|
/// <returns></returns>
|
2022-10-11 14:42:04 +05:00
|
|
|
|
IEnumerable<FileInfoDto> GetListFilesNotDisc(IEnumerable<FileInfoDto> files);
|
2022-10-11 08:28:37 +05:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
2023-06-28 16:24:52 +05:00
|
|
|
|
/// Создание пути для сохранения файла связанного со скважиной
|
2022-10-11 08:28:37 +05:00
|
|
|
|
/// </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);
|
2023-06-28 16:24:52 +05:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Создание пути для сохранения файла
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="path1"></param>
|
|
|
|
|
/// <param name="path2"></param>
|
|
|
|
|
/// <param name="path3"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
string MakeFilePath(string path1, string path2, string path3);
|
2022-10-11 14:42:04 +05:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
2023-06-28 16:24:52 +05:00
|
|
|
|
/// Получение пути к файлу связанного со скважиной
|
2022-10-11 14:42:04 +05:00
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="idWell"></param>
|
|
|
|
|
/// <param name="idCategory"></param>
|
|
|
|
|
/// <param name="idFile"></param>
|
2023-06-28 16:24:52 +05:00
|
|
|
|
/// <param name="dotExtenstion"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
string GetFilePath(int idWell, int idCategory, int idFile, string dotExtenstion);
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Получение пути файла лежащего на диске
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="path1"></param>
|
|
|
|
|
/// <param name="path2"></param>
|
|
|
|
|
/// <param name="idFile"></param>
|
|
|
|
|
/// <param name="dotExtenstion"></param>
|
2022-10-11 14:42:04 +05:00
|
|
|
|
/// <returns></returns>
|
2023-06-28 16:24:52 +05:00
|
|
|
|
string GetFilePath(string path1, string path2, int idFile, string dotExtenstion);
|
2022-10-06 13:41:46 +05:00
|
|
|
|
}
|
|
|
|
|
}
|