mirror of
https://github.com/TalAloni/SMBLibrary.git
synced 2025-05-16 17:37:08 +02:00
Updated Utilities
This commit is contained in:
parent
41474b87ac
commit
73b6c288a4
2 changed files with 38 additions and 0 deletions
|
@ -22,6 +22,17 @@ namespace Utilities
|
||||||
return ListEntriesInDirectory(@"\");
|
return ListEntriesInDirectory(@"\");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public virtual List<KeyValuePair<string, ulong>> ListDataStreams(string path)
|
||||||
|
{
|
||||||
|
FileSystemEntry entry = GetEntry(path);
|
||||||
|
List<KeyValuePair<string, ulong>> result = new List<KeyValuePair<string, ulong>>();
|
||||||
|
if (!entry.IsDirectory)
|
||||||
|
{
|
||||||
|
result.Add(new KeyValuePair<string, ulong>("::$DATA", entry.Size));
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
public Stream OpenFile(string path, FileMode mode, FileAccess access, FileShare share)
|
public Stream OpenFile(string path, FileMode mode, FileAccess access, FileShare share)
|
||||||
{
|
{
|
||||||
return OpenFile(path, mode, access, share, FileOptions.None);
|
return OpenFile(path, mode, access, share, FileOptions.None);
|
||||||
|
@ -59,6 +70,24 @@ namespace Utilities
|
||||||
destinationStream.Close();
|
destinationStream.Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public virtual bool Exists(string path)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
GetEntry(path);
|
||||||
|
}
|
||||||
|
catch (FileNotFoundException)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
catch (DirectoryNotFoundException)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
public abstract string Name
|
public abstract string Name
|
||||||
{
|
{
|
||||||
get;
|
get;
|
||||||
|
|
|
@ -7,6 +7,8 @@ namespace Utilities
|
||||||
public interface IFileSystem
|
public interface IFileSystem
|
||||||
{
|
{
|
||||||
/// <exception cref="System.ArgumentException"></exception>
|
/// <exception cref="System.ArgumentException"></exception>
|
||||||
|
/// <exception cref="System.IO.DirectoryNotFoundException"></exception>
|
||||||
|
/// <exception cref="System.IO.FileNotFoundException"></exception>
|
||||||
/// <exception cref="System.IO.IOException"></exception>
|
/// <exception cref="System.IO.IOException"></exception>
|
||||||
/// <exception cref="System.UnauthorizedAccessException"></exception>
|
/// <exception cref="System.UnauthorizedAccessException"></exception>
|
||||||
FileSystemEntry GetEntry(string path);
|
FileSystemEntry GetEntry(string path);
|
||||||
|
@ -43,6 +45,13 @@ namespace Utilities
|
||||||
/// <exception cref="System.UnauthorizedAccessException"></exception>
|
/// <exception cref="System.UnauthorizedAccessException"></exception>
|
||||||
List<FileSystemEntry> ListEntriesInDirectory(string path);
|
List<FileSystemEntry> ListEntriesInDirectory(string path);
|
||||||
|
|
||||||
|
/// <exception cref="System.ArgumentException"></exception>
|
||||||
|
/// <exception cref="System.IO.DirectoryNotFoundException"></exception>
|
||||||
|
/// <exception cref="System.IO.FileNotFoundException"></exception>
|
||||||
|
/// <exception cref="System.IO.IOException"></exception>
|
||||||
|
/// <exception cref="System.UnauthorizedAccessException"></exception>
|
||||||
|
List<KeyValuePair<string, ulong>> ListDataStreams(string path);
|
||||||
|
|
||||||
/// <exception cref="System.ArgumentException"></exception>
|
/// <exception cref="System.ArgumentException"></exception>
|
||||||
/// <exception cref="System.IO.DirectoryNotFoundException"></exception>
|
/// <exception cref="System.IO.DirectoryNotFoundException"></exception>
|
||||||
/// <exception cref="System.IO.FileNotFoundException"></exception>
|
/// <exception cref="System.IO.FileNotFoundException"></exception>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue