public int FindFiles(String filename, ArrayList files, DokanFileInfo info) { string path = GetPath(filename); if (Directory.Exists(path)) { DirectoryInfo d = new DirectoryInfo(path); FileSystemInfo[] entries = d.GetFileSystemInfos(); foreach (FileSystemInfo f in entries) { FileInformation fi = new FileInformation(); fi.Attributes = f.Attributes; fi.CreationTime = f.CreationTime; fi.LastAccessTime = f.LastAccessTime; fi.LastWriteTime = f.LastWriteTime; fi.Length = (f is DirectoryInfo) ? 0 : ((FileInfo)f).Length; fi.FileName = f.Name; files.Add(fi); } return 0; } else { return -1; } }
public int CreateFile(string filename, System.IO.FileAccess access, System.IO.FileShare share, System.IO.FileMode mode, System.IO.FileOptions options, DokanFileInfo info) { try { Console.WriteLine("Create File "+filename+" access "+access+" share "+share+" mode "+mode+ " options "+options+" info "+info); Root root = mergedDirs.getRootWithBestSpace(0); if ((mode == FileMode.Create || mode == FileMode.CreateNew || mode == FileMode.OpenOrCreate )&& !root.ContainsDirectory(Path.GetDirectoryName(filename))) { root.mkDirs(Path.GetDirectoryName(filename)); } if (Directory.Exists(root.getRealPath(filename))) { info.IsDirectory = true; } else if(access != FileAccess.Read) { mergedDirs.createFile(filename,mode); } return 0; } catch (Exception e) { Console.WriteLine("Caught an exception: " + e + ": " + e.Message); return -1; } }
public int CreateFile(string filename, FileAccess access, FileShare share, FileMode mode, FileOptions options, DokanFileInfo info) { Trace.WriteLine(string.Format("CreateFile FILENAME({0}) ACCESS({1}) SHARE({2}) MODE({3})", filename, access, share, mode)); if (mode == FileMode.Create || mode == FileMode.OpenOrCreate || mode == FileMode.CreateNew) { // we want to write a file var fileRef = Extensions.GetFileReference(root, filename.ToFileString()); fileRef.Create(0); return 0; } if (share == FileShare.Delete) { return DeleteFile(filename, info); } if (GetFileInformation(filename, new FileInformation(), new DokanFileInfo(0)) == 0) { return 0; } else { return -DokanNet.ERROR_FILE_NOT_FOUND; } }
public int CreateDirectory(string filename, DokanFileInfo info) { Trace.WriteLine(string.Format("CreateDirectory {0}", filename)); var dirRef = Extensions.GetDirectoryReference(root, filename.ToFileString()); dirRef.CreateIfNotExists(); return 0; }
public int OpenDirectory(string filename, DokanFileInfo info) { Console.WriteLine("openDir: " + filename); info.Context = count++; info.IsDirectory = true; return 0; }
//Windows System Error Codes @ http://www.hiteksoftware.com/knowledge/articles/049.htm public int CreateFile(string filename, System.IO.FileAccess access, System.IO.FileShare share, System.IO.FileMode mode, System.IO.FileOptions options, DokanFileInfo info) { Console.WriteLine("crFile: " + filename); info.Context = count++; if (filename.Trim() == "\\") { info.IsDirectory = true; return 0; } else { RAFInMemoryFileSystemObject fso = rafManager.ResolveRAFPathTOFSO(filename); Console.WriteLine("-> FSO NULL? " + (fso == null)); if (fso == null) return -DokanNet.ERROR_ACCESS_DENIED; else { if (fso.GetFSOType() == RAFFSOType.DIRECTORY) info.IsDirectory = true; return 0; } } //return -82; }
public int FindFiles(string filename, LinkedList <FileInformation> files, Dokan.DokanFileInfo info) { Console.WriteLine("FindFiles: " + filename + ":" + info); //foreach (var Item in FileSystem.FindFiles(filename.Replace(@"\", "/"))) foreach (var Item in FileSystem.FindFiles(filename)) { var FileInformation = new FileInformation(); FillFileInformationFromFileSystemEntry(FileInformation, Item); //FileInformation.CreationTime. /* * Console.WriteLine("------------------------------------------------"); * Console.WriteLine("CreationTime : " + FileInformation.CreationTime); * Console.WriteLine("LastWriteTime : " + FileInformation.LastWriteTime); * Console.WriteLine("LastAccessTime: " + FileInformation.LastAccessTime); * Console.WriteLine("------------------------------------------------"); */ //var AvailableDate = Item.Time.CreationTime ?? Item.Time.LastWriteTime ?? Item.Time.LastAccessTime; /* * FileInformation.CreationTime = DateTime.Now; * FileInformation.LastAccessTime = DateTime.Now; * FileInformation.LastWriteTime = DateTime.Now; */ //FileInformation.Length = 10001; //Console.WriteLine(Item); files.AddLast(FileInformation); } //Thread.Sleep(400); return(0); //NotImplemented(); }
public int OpenDirectory(String filename, DokanFileInfo info) { info.Context = count_++; if (Directory.Exists(GetPath(filename))) return 0; else return -DokanNet.ERROR_PATH_NOT_FOUND; }
public int GetDiskFreeSpace(ref ulong freeBytesAvailable, ref ulong totalBytes, ref ulong totalFreeBytes, DokanFileInfo info) { freeBytesAvailable = 512*1024*1024; totalBytes = 1024*1024*1024; totalFreeBytes = 512*1024*1024; return 0; }
public int CreateFile( string filename, System.IO.FileAccess access, System.IO.FileShare share, System.IO.FileMode mode, System.IO.FileOptions options, DokanFileInfo info) { return 0; }
public int CreateFile(string filename, FileAccess access, FileShare share, FileMode mode, FileOptions options, DokanFileInfo info) { int result = _fileSystem.CreateFile(filename, access, share, mode, options, info); if (this._logging) { Console.WriteLine("CreateFile: " + filename); Console.WriteLine("Result: " + result); } return result; }
public int CreateDirectory(string filename, DokanFileInfo info) { int result = _fileSystem.CreateDirectory(filename, info); if (this._logging) { Console.WriteLine("CreateDirectory: " + filename); Console.WriteLine("Result: " + result); } return result; }
public int Cleanup(string filename, DokanFileInfo info) { int result = _fileSystem.Cleanup(filename, info); if (this._logging) { Console.WriteLine("Cleanup: " + filename); Console.WriteLine("Result: " + result); } return result; }
private void ConvertFileInfo(ref DOKAN_FILE_INFO rawInfo, DokanFileInfo info) { info.IsDirectory = rawInfo.IsDirectory == 1; info.ProcessId = rawInfo.ProcessId; info.PagingIo = rawInfo.PagingIo == 1; info.DeleteOnClose = rawInfo.DeleteOnClose == 1; info.SynchronousIo = rawInfo.SynchronousIo == 1; info.Nocache = rawInfo.Nocache == 1; info.WriteToEndOfFile = rawInfo.WriteToEndOfFile == 1; }
public virtual int CreateFile(string filename, FileAccess access, FileShare share, FileMode mode, FileOptions options, DokanFileInfo info) { try { return -1; } catch { return -1; } }
public int DeleteFile(string filename, DokanFileInfo info) { int result = _fileSystem.DeleteFile(filename, info); if (this._logging) { Console.WriteLine("DeleteFile: " + filename); Console.WriteLine("Result: " + result); } return result; }
public int CreateFile(string filename, FileAccess access, FileShare share, FileMode mode, FileOptions options, DokanFileInfo info) { Console.WriteLine("Create File : " + filename); var response = MakeComplexRequest(Path + CREATE_FILE_REQUEST_STRING, SecurityElement.Escape(filename), (int)access, (int)share, (int)mode, (int)options, info.ProcessId); if (response.ContainsKey("message")) Console.WriteLine("Create File Message : " + response["message"]); return int.Parse(response["response_code"]); }
public int CloseFile(string filename, DokanFileInfo info) { Console.WriteLine("Close File : " + filename); var response = MakeComplexRequest(Path + CLOSE_FILE_REQUEST_STRING, filename, info.ProcessId); if (response.ContainsKey("message")) Console.WriteLine("Create File Message : " + response["message"]); return int.Parse(response["response_code"]); }
int DokanOperations.GetFileInformation(string filename, FileInformation fileinfo, DokanFileInfo info) { VFileInfo vinfo; int status = data.GetFileInformation (filename, out vinfo); fileinfo.Attributes = vinfo.Attributes; fileinfo.CreationTime = vinfo.CreationTime; fileinfo.LastAccessTime = vinfo.LastAccessTime; fileinfo.LastWriteTime = vinfo.LastWriteTime; fileinfo.Length = vinfo.Length; return status; }
public int CreateDirectory(string filename, DokanFileInfo info) { Console.WriteLine("Create Directory : " + filename); var response = MakeComplexRequest(Path + CREATE_DIRECTORY_REQUEST_STRING, filename, info.ProcessId); if (response.ContainsKey("message")) Console.WriteLine("Create Directory Message : " + response["message"]); return int.Parse(response["response_code"]); }
public int Cleanup(string filename, DokanFileInfo info) { //Clean DirCache = new Dictionary<string, Dictionary<string, int>>(); DirCache["Categories"] = new Dictionary<string, int>(); DirCache["Main namespace"] = new Dictionary<string, int>(); DirCache["Templates"] = new Dictionary<string, int>(); DirCache["Forms"] = new Dictionary<string, int>(); DirCache["Properties"] = new Dictionary<string, int>(); return 0; }
public int CloseFile(string filename, DokanFileInfo info) { BlobStream stream = null; if (blobsWriting.TryRemove(filename, out stream)) { Trace.WriteLine(string.Format("CloseFile {0}", filename)); stream.Commit(); stream.Dispose(); this.blobCache.Remove(filename); stream.Blob.Container.InvalidateCache(); } return 0; }
public virtual int FindFiles(string filename, ArrayList files, DokanFileInfo info) { foreach (var tag in _storage.ListTags(filename)) files.Add(new FileInformation { Attributes = FileAttributes.Compressed | FileAttributes.Directory | FileAttributes.NotContentIndexed, CreationTime = DateTime.Now, FileName = tag.TagName, LastAccessTime = DateTime.Now, LastWriteTime = DateTime.Now }); return DokanNet.DOKAN_SUCCESS; }
private DokanFileInfo GetNewFileInfo(ref DOKAN_FILE_INFO rawFileInfo) { DokanFileInfo fileInfo = new DokanFileInfo(rawFileInfo.DokanContext); lock (infoTableLock_) { fileInfo.InfoId = ++infoId_; rawFileInfo.Context = fileInfo.InfoId; ConvertFileInfo(ref rawFileInfo, fileInfo); // to avoid GC infoTable_[fileInfo.InfoId] = fileInfo; } return fileInfo; }
public int ReadFile(String filename, Byte[] buffer, ref uint readBytes, long offset, DokanFileInfo info) { try { FileStream fs = File.OpenRead(GetPath(filename)); fs.Seek(offset, SeekOrigin.Begin); readBytes = (uint)fs.Read(buffer, 0, buffer.Length); return 0; } catch (Exception) { return -1; } }
public int CreateDirectory(string filename, DokanFileInfo info) { Console.WriteLine("Create Directory " + filename); try { // logger.addLog("CreateDirectory '" + filename + "'"); mergedDirs.mkDirs(filename); return 0; } catch (Exception e) { //Console.WriteLine("Caught an exception: " + e + ": " + e.Message); return -1; } }
int DokanOperations.FindFiles(string filename, System.Collections.ArrayList files, DokanFileInfo info) { IList<VFileInfo> vfiles; int status = data.List (filename, out vfiles); foreach (VFileInfo i in vfiles) { files.Add (new FileInformation { Attributes = i.Attributes, CreationTime = i.CreationTime, FileName = i.Name, LastAccessTime = i.LastAccessTime, LastWriteTime = i.LastWriteTime, Length = i.IsDirectory() ? 0 : i.Length }); } return status; }
// find apis public int FindFiles(string filename, System.Collections.ArrayList files, DokanFileInfo info) { FlacFsObjectInfo[] entries = flacFs_.ListDirectoryContents(filename); if (entries == null) { return -1; } foreach(FlacFsObjectInfo fsoi in entries) { FileInformation fi = new FileInformation(); TranslateFileSystemInfo(fsoi, fi); files.Add(fi); } return 0; }
// file apis public int CreateFile(string filename, FileAccess access, FileShare share, FileMode mode, FileOptions options, DokanFileInfo info) { info.IsDirectory = flacFs_.IsDirectory(filename); if (info.IsDirectory) { return 0; } long handle = flacFs_.OpenFile(filename); if (handle != FlacFs.INVALID_HANDLE) { info.Context = handle; return 0; } return -DokanNet.ERROR_FILE_NOT_FOUND; }
public int CreateDirectory(String filename, DokanFileInfo info) { if (!Directory.Exists(GetPath(filename))) { try { Directory.CreateDirectory(GetPath(filename)); } catch (Exception) { return -DokanNet.DOKAN_ERROR; } return DokanNet.DOKAN_SUCCESS; } return -DokanNet.ERROR_ALREADY_EXISTS; }
public int CreateFile(String filename, FileAccess access, FileShare share, FileMode mode, FileOptions options, DokanFileInfo info) { string path = GetPath(filename); info.Context = count_++; if (File.Exists(path)) { return 0; } else if(Directory.Exists(path)) { info.IsDirectory = true; return 0; } else { return -DokanNet.ERROR_FILE_NOT_FOUND; } }
public int CloseFile(string filename, Dokan.DokanFileInfo info) { try { ((FileSystemFileStream)info.Context).Close(); return(0); } catch (Exception e) { Console.WriteLine(" -- CloseFile Error: " + e.Message); return(0); } finally { NotImplemented(filename, info.Context); } //((FileSystemFileStream)info.Context).Close(); //return 0; //NotImplemented(); }
public int WriteFile(string filename, byte[] buffer, ref uint writtenBytes, long offset, Dokan.DokanFileInfo info) { NotImplemented(filename, info); return(-1); }
public int SetFileTime(string filename, DateTime ctime, DateTime atime, DateTime mtime, Dokan.DokanFileInfo info) { NotImplemented(); return(-1); }
public int FlushFileBuffers(string filename, Dokan.DokanFileInfo info) { NotImplemented(); return(-1); }
public int OpenDirectory(string filename, Dokan.DokanFileInfo info) { NotImplemented(filename); return(0); }
public int GetFileInformation(string filename, Dokan.FileInformation fileinfo, Dokan.DokanFileInfo info) { NotImplemented(filename, info.Context); try { var FileSystemEntry = FileSystem.GetFileInfo(filename); FillFileInformationFromFileSystemEntry(fileinfo, FileSystemEntry); return(0); } catch (Exception) { return(-1); //return 0; } }
public int CreateDirectory(string filename, Dokan.DokanFileInfo info) { NotImplemented(filename, info.Context); return(-1); }
public int SetFileAttributes(string filename, System.IO.FileAttributes attr, Dokan.DokanFileInfo info) { NotImplemented(); return(-1); }
public int UnlockFile(string filename, long offset, long length, Dokan.DokanFileInfo info) { NotImplemented(); return(0); }
public int DeleteDirectory(string filename, Dokan.DokanFileInfo info) { NotImplemented(); return(-1); }
public int ReadFile(string filename, byte[] buffer, ref uint readBytes, long offset, Dokan.DokanFileInfo info) { try { var FileSystemFileStream = (FileSystemFileStream)info.Context; FileSystemFileStream.Position = offset; readBytes = (uint)FileSystemFileStream.Read(buffer, 0, (int)readBytes); return(0); } catch (Exception e) { Console.WriteLine(" -- ReadFile Error: " + e.Message); return(-1); } finally { NotImplemented(filename, info); } }
public int CreateFile(string filename, System.IO.FileAccess access, System.IO.FileShare share, System.IO.FileMode mode, System.IO.FileOptions options, Dokan.DokanFileInfo info) { try { info.Context = FileSystem.OpenFile(filename, mode); return(0); } catch (Exception e) { Console.WriteLine(" -- CreateFile Error: " + e.Message); info.Context = null; //return -1; return(0); } finally { NotImplemented(filename, info.Context); } //info.Context = FileSystem.OpenFile(filename, mode); }
public int Cleanup(string filename, Dokan.DokanFileInfo info) { info.Context = null; //NotImplemented(); return(0); }
public int MoveFile(string filename, string newname, bool replace, Dokan.DokanFileInfo info) { NotImplemented(); return(-1); }
public int SetEndOfFile(string filename, long length, Dokan.DokanFileInfo info) { NotImplemented(); return(-1); }
public int SetAllocationSize(string filename, long length, Dokan.DokanFileInfo info) { NotImplemented(); return(-1); }
public int Unmount(Dokan.DokanFileInfo info) { NotImplemented(); return(0); }
public int GetDiskFreeSpace(ref ulong freeBytesAvailable, ref ulong totalBytes, ref ulong totalFreeBytes, Dokan.DokanFileInfo info) { freeBytesAvailable = 512 * 1024 * 1024; totalBytes = 1024 * 1024 * 1024; totalFreeBytes = 512 * 1024 * 1024; return(0); }