3using ewu.adam.openkm.rest;
4using ewu.adam.openkm.rest.Bean;
48 OkmWebserviceFactory.NewInstance(url, user, password)
77 public IEnumerable<string>
GetFiles(
string path,
string extension,
bool recursive)
114 throw new Exception(
"Directory does not exist.");
119 throw new Exception(
"Directory is not empty.");
132 throw new Exception(
"File does not exist.");
171 public void Copy(
string src,
string dst,
bool overwrite =
true)
178 throw new Exception(
"Source does not exist");
183 throw new NotSupportedException(
184 "At the moment, copying directories is not supported. (need to implement recursive move files)"
190 throw new Exception(
"Target directory does not exist");
193 string dstFile =
MakeFullPath(Path.Combine(dst, Path.GetFileName(src)));
199 throw new Exception(
"Target file is a directory");
204 throw new Exception(
"Target already exists");
214 public void Move(
string src,
string dst,
bool overwrite =
true)
221 throw new Exception(
"Source does not exist");
226 throw new NotSupportedException(
227 "At the moment, moving directories is not supported. (need to implement recursive move files)"
233 throw new Exception(
"Target directory does not exist");
236 string dstFile =
MakeFullPath(Path.Combine(dst, Path.GetFileName(src)));
242 throw new Exception(
"Target file is a directory");
247 throw new Exception(
"Target already exists");
275 return m_Webservice.GetFolderChildren(path).Result.folder.Count > 0 ||
276 m_Webservice.GetDocumentChildren(path).Result.document.Count > 0;
286 FolderList? current =
m_Webservice.GetFolderChildren(path).Result;
288 return current ==
null ? Enumerable.Empty<
string>() : current.folder.Select(x => x.path);
299 DocumentList? current =
m_Webservice.GetDocumentChildren(path).Result;
306 foreach (Document document
in current.document)
308 string ext = Path.GetExtension(document.path);
310 if (
string.IsNullOrEmpty(extension) || ext == extension)
312 yield
return document.path;
330 yield
return innerDir;
369 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.