2015-01-20 21:44:52 +01:00
|
|
|
// Copyright (C) 2015, The Duplicati Team
|
2014-03-18 10:59:06 +01:00
|
|
|
|
2015-01-20 21:44:52 +01:00
|
|
|
// http://www.duplicati.com, info@duplicati.com
|
2014-03-18 10:59:06 +01:00
|
|
|
//
|
|
|
|
|
// This library is free software; you can redistribute it and/or modify
|
|
|
|
|
// it under the terms of the GNU Lesser General Public License as
|
|
|
|
|
// published by the Free Software Foundation; either version 2.1 of the
|
|
|
|
|
// License, or (at your option) any later version.
|
|
|
|
|
//
|
|
|
|
|
// This library is distributed in the hope that it will be useful, but
|
|
|
|
|
// WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
|
// Lesser General Public License for more details.
|
|
|
|
|
//
|
|
|
|
|
// You should have received a copy of the GNU Lesser General Public
|
|
|
|
|
// License along with this library; if not, write to the Free Software
|
|
|
|
|
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
|
using System;
|
|
|
|
|
using System.IO;
|
2014-03-20 15:07:30 +01:00
|
|
|
using System.Collections.Generic;
|
2018-11-01 17:56:48 +01:00
|
|
|
using Duplicati.Library.Interface;
|
|
|
|
|
|
2018-11-02 21:34:07 +01:00
|
|
|
namespace Duplicati.Library.Common.IO
|
2014-03-18 10:59:06 +01:00
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Interface for wrapping System.IO operations.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public interface ISystemIO
|
|
|
|
|
{
|
2018-11-01 17:56:48 +01:00
|
|
|
IFileEntry DirectoryEntry(string path);
|
2014-03-18 10:59:06 +01:00
|
|
|
void DirectoryDelete(string path);
|
|
|
|
|
void DirectoryDelete(string path, bool recursive);
|
|
|
|
|
void DirectoryCreate(string path);
|
|
|
|
|
bool DirectoryExists(string path);
|
|
|
|
|
void DirectorySetLastWriteTimeUtc(string path, DateTime time);
|
2014-11-06 01:23:31 +01:00
|
|
|
void DirectorySetCreationTimeUtc(string path, DateTime time);
|
|
|
|
|
DateTime DirectoryGetLastWriteTimeUtc(string path);
|
|
|
|
|
DateTime DirectoryGetCreationTimeUtc(string path);
|
2014-03-18 10:59:06 +01:00
|
|
|
|
2018-11-01 17:56:48 +01:00
|
|
|
|
|
|
|
|
IFileEntry FileEntry(string path);
|
2014-03-18 10:59:06 +01:00
|
|
|
void FileMove(string source, string target);
|
|
|
|
|
void FileDelete(string path);
|
2018-11-01 17:56:48 +01:00
|
|
|
void FileCopy(string source, string target, bool overwrite);
|
2014-03-18 10:59:06 +01:00
|
|
|
void FileSetLastWriteTimeUtc(string path, DateTime time);
|
2014-11-06 01:23:31 +01:00
|
|
|
void FileSetCreationTimeUtc(string path, DateTime time);
|
|
|
|
|
DateTime FileGetLastWriteTimeUtc(string path);
|
|
|
|
|
DateTime FileGetCreationTimeUtc(string path);
|
2014-03-18 10:59:06 +01:00
|
|
|
bool FileExists(string path);
|
|
|
|
|
long FileLength(string path);
|
2018-11-01 17:56:48 +01:00
|
|
|
FileStream FileOpenRead(string path);
|
|
|
|
|
FileStream FileOpenWrite(string path);
|
|
|
|
|
FileStream FileOpenReadWrite(string path);
|
|
|
|
|
FileStream FileCreate(string path);
|
2014-03-18 10:59:06 +01:00
|
|
|
FileAttributes GetFileAttributes(string path);
|
2014-11-06 01:23:31 +01:00
|
|
|
void SetFileAttributes(string path, FileAttributes attributes);
|
2014-03-18 10:59:06 +01:00
|
|
|
void CreateSymlink(string symlinkfile, string target, bool asDir);
|
2018-02-06 13:24:49 -07:00
|
|
|
string GetSymlinkTarget(string path);
|
2014-03-18 10:59:06 +01:00
|
|
|
string PathGetDirectoryName(string path);
|
2014-03-20 15:07:30 +01:00
|
|
|
string PathGetFileName(string path);
|
2014-03-18 10:59:06 +01:00
|
|
|
string PathGetExtension(string path);
|
2014-03-20 15:07:30 +01:00
|
|
|
string PathChangeExtension(string path, string extension);
|
2018-10-28 11:58:27 +01:00
|
|
|
string PathCombine(params string[] paths);
|
2018-11-01 17:56:48 +01:00
|
|
|
string PathGetFullPath(string path);
|
2018-10-25 10:23:50 +02:00
|
|
|
string GetPathRoot(string path);
|
2018-10-25 16:42:53 +02:00
|
|
|
string[] GetDirectories(string path);
|
2018-10-25 16:52:19 +02:00
|
|
|
string[] GetFiles(string path);
|
2018-10-30 17:16:13 +01:00
|
|
|
string[] GetFiles(string path, string searchPattern);
|
2018-10-25 16:52:19 +02:00
|
|
|
DateTime GetCreationTimeUtc(string path);
|
|
|
|
|
DateTime GetLastWriteTimeUtc(string path);
|
2014-03-20 15:07:30 +01:00
|
|
|
IEnumerable<string> EnumerateFileSystemEntries(string path);
|
2018-11-26 18:34:52 +01:00
|
|
|
IEnumerable<string> EnumerateFiles(string path);
|
2018-11-01 17:56:48 +01:00
|
|
|
IEnumerable<string> EnumerateDirectories(string path);
|
2014-11-06 01:23:31 +01:00
|
|
|
|
2014-11-30 21:32:31 +01:00
|
|
|
void SetMetadata(string path, Dictionary<string, string> metdata, bool restorePermissions);
|
2016-11-03 13:11:53 +01:00
|
|
|
Dictionary<string, string> GetMetadata(string path, bool isSymlink, bool followSymlink);
|
2014-03-18 10:59:06 +01:00
|
|
|
}
|
2018-11-01 17:56:48 +01:00
|
|
|
|
2014-03-18 10:59:06 +01:00
|
|
|
}
|
|
|
|
|
|