3using ewu.adam.openkm.rest;
4using ewu.adam.openkm.rest.Bean;
50 this(OkmWebserviceFactory.NewInstance(url, user, password)) { }
52#region IFileSystem Members
83 public IEnumerable<string>
GetFiles(
string path,
string extension,
bool recursive)
120 throw new Exception(
"Directory does not exist.");
125 throw new Exception(
"Directory is not empty.");
139 throw new Exception(
"File does not exist.");
181 public void Copy(
string src,
string dst,
bool overwrite =
true)
188 throw new Exception(
"Source does not exist");
194 NotSupportedException(
"At the moment, copying directories is not supported. (need to implement recursive move files)"
200 throw new Exception(
"Target directory does not exist");
203 string dstFile =
MakeFullPath(Path.Combine(dst, Path.GetFileName(src)));
209 throw new Exception(
"Target file is a directory");
214 throw new Exception(
"Target already exists");
226 public void Move(
string src,
string dst,
bool overwrite =
true)
233 throw new Exception(
"Source does not exist");
239 NotSupportedException(
"At the moment, moving directories is not supported. (need to implement recursive move files)"
245 throw new Exception(
"Target directory does not exist");
248 string dstFile =
MakeFullPath(Path.Combine(dst, Path.GetFileName(src)));
254 throw new Exception(
"Target file is a directory");
259 throw new Exception(
"Target already exists");
292 .Result.folder.Count >
295 .Result.document.Count >
306 FolderList? current =
m_Webservice.GetFolderChildren(path)
309 return current ==
null ? Enumerable.Empty<
string>() : current.folder.Select(x => x.path);
320 DocumentList? current =
m_Webservice.GetDocumentChildren(path)
328 foreach (Document document
in current.document)
330 string ext = Path.GetExtension(document.path);
332 if (
string.IsNullOrEmpty(extension) || ext == extension)
334 yield
return document.path;
352 yield
return innerDir;
391 string? parent = Path.GetDirectoryName(path);
Implements a FileSystem for OpenKM.
string GetStartupDirectory()
The Startup Directory of the Application.The Startup Directory of the Application
void Move(string src, string dst, bool overwrite=true)
Moves a file or directory to a new location.
IEnumerable< string > InnerGetFiles(string path, string extension)
Returns all files in the given directory that match the specified extension.
IEnumerable< string > InnerGetDirectories(string path)
Returns all directories in the given directory.
BadOpenKmFileSystem(string url, string user, string password)
Constructs a new BadOpenKmFileSystem instance.
void InnerCreateDirectory(string path)
Creates a directory.
bool IsDirectory(string path)
Returns true if the given path is a directory.true if the given path is a directory
bool HasChildren(string path)
Returns true if the given path has children.
bool IsFile(string path)
Returns true if the given path is a file.true if the given path is a file
IEnumerable< string > GetDirectories(string path, bool recursive)
Returns all directories in the given directory.Enumeration of all directories in the given directory ...
IEnumerable< string > InnerGetFilesRecursive(string path, string extension)
Recursively returns all files in the given directory that match the specified extension.
readonly IOkmWebservice m_Webservice
The OpenKM Webservice.
void InnerCreateDirectoryRecursive(string path)
Creates a directory recursively.
void CreateDirectory(string path, bool recursive=false)
Creates a new directory.
string GetFullPath(string path)
Returns the full path of the given path.Full Path
string? m_StartupDirectory
The Startup Directory.
Stream OpenWrite(string path, BadWriteMode mode)
Opens a file for writing.File Stream
void DeleteDirectory(string path, bool recursive)
Deletes a directory.
bool Exists(string path)
Returns true if the given path is a file or directory.true if the given path is a file or directory
IEnumerable< string > GetFiles(string path, string extension, bool recursive)
Returns all files in the given directory that match the specified extension.Enumeration of all files ...
string GetCurrentDirectory()
Returns the Current Directory.The Current Directory
Stream OpenRead(string path)
Opens a file for reading.File Stream
void Copy(string src, string dst, bool overwrite=true)
Copies a file or directory to a new location.
void SetCurrentDirectory(string path)
Sets the current Directory.
void DeleteFile(string path)
Deletes a file.
BadOpenKmFileSystem(IOkmWebservice webService)
Constructs a new BadOpenKmFileSystem instance.
IEnumerable< string > InnerGetDirectoriesRecursive(string path)
Recursively returns all directories in the given directory.
Folder m_Current
The Current Directory.
string MakeFullPath(string path)
Makes the given path a full path.
Implements a Stream for writing to OpenKM.
Implements Operations to read and manipulate File System Paths.
static string ResolvePath(string path, string currentDir)
Defines the interface for a file system.
File System Implementation for OpenKM.
Contains the Implementation of the BadScript Virtual File System.
BadWriteMode
The Write Modes of the File System Abstraction.