コード例 #1
0
ファイル: Program.cs プロジェクト: jvd001/DokanNet
 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;
     }
 }
コード例 #2
0
ファイル: MergedFileSystem.cs プロジェクト: harryrose/MergeFS
        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;
            }
        }
コード例 #3
0
        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;
            }
        }
コード例 #4
0
 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;
 }
コード例 #5
0
ファイル: Program.cs プロジェクト: anirnet/raf-manager
 public int OpenDirectory(string filename, DokanFileInfo info)
 {
     Console.WriteLine("openDir: " + filename);
     info.Context = count++;
     info.IsDirectory = true;
     return 0;
 }
コード例 #6
0
ファイル: Program.cs プロジェクト: anirnet/raf-manager
        //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;
        }
コード例 #7
0
        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();
        }
コード例 #8
0
ファイル: Program.cs プロジェクト: stux2000/dokan
 public int OpenDirectory(String filename, DokanFileInfo info)
 {
     info.Context = count_++;
     if (Directory.Exists(GetPath(filename)))
         return 0;
     else
         return -DokanNet.ERROR_PATH_NOT_FOUND;
 }
コード例 #9
0
ファイル: Program.cs プロジェクト: iBat/WotStatMiniServer
 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;
 }
コード例 #10
0
ファイル: Program.cs プロジェクト: stux2000/dokan
 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;
 }
コード例 #11
0
ファイル: LoggingFS.cs プロジェクト: daveroberts/FUSEManager
 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;
 }
コード例 #12
0
ファイル: LoggingFS.cs プロジェクト: daveroberts/FUSEManager
 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;
 }
コード例 #13
0
ファイル: LoggingFS.cs プロジェクト: daveroberts/FUSEManager
 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;
 }
コード例 #14
0
ファイル: Proxy.cs プロジェクト: cristhiand3/mssqlfs
 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;
 }
コード例 #15
0
ファイル: TaggedFileSystem.cs プロジェクト: meowthsli/tagfs
 public virtual int CreateFile(string filename, 
     FileAccess access, 
     FileShare share, 
     FileMode mode, 
     FileOptions options, 
     DokanFileInfo info)
 {
     try { return -1; }
     catch { return -1; }
 }
コード例 #16
0
ファイル: LoggingFS.cs プロジェクト: daveroberts/FUSEManager
 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;
 }
コード例 #17
0
        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"]);
        }
コード例 #18
0
        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"]);
        }
コード例 #19
0
ファイル: DokanConsumer.cs プロジェクト: TimePath/major
 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;
 }
コード例 #20
0
        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"]);
        }
コード例 #21
0
ファイル: MWFS.cs プロジェクト: vedmaka/mediawikifs
        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;
        }
コード例 #22
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;
        }
コード例 #23
0
ファイル: TaggedFileSystem.cs プロジェクト: meowthsli/tagfs
        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;
        }
コード例 #24
0
ファイル: Proxy.cs プロジェクト: cristhiand3/mssqlfs
        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;
        }
コード例 #25
0
ファイル: Program.cs プロジェクト: stux2000/dokan
 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;
     }
 }
コード例 #26
0
ファイル: MergedFileSystem.cs プロジェクト: harryrose/MergeFS
 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;
     }
 }
コード例 #27
0
ファイル: DokanConsumer.cs プロジェクト: TimePath/major
 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;
 }
コード例 #28
0
ファイル: flacDokan.cs プロジェクト: LastContrarian/flacfs
        // 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;
        }
コード例 #29
0
ファイル: flacDokan.cs プロジェクト: LastContrarian/flacfs
        // 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;
        }
コード例 #30
0
        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;
        }
コード例 #31
0
ファイル: Program.cs プロジェクト: stux2000/dokan
 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;
     }
 }
コード例 #32
0
 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();
 }
コード例 #33
0
 public int WriteFile(string filename, byte[] buffer, ref uint writtenBytes, long offset, Dokan.DokanFileInfo info)
 {
     NotImplemented(filename, info);
     return(-1);
 }
コード例 #34
0
 public int SetFileTime(string filename, DateTime ctime, DateTime atime, DateTime mtime, Dokan.DokanFileInfo info)
 {
     NotImplemented();
     return(-1);
 }
コード例 #35
0
 public int FlushFileBuffers(string filename, Dokan.DokanFileInfo info)
 {
     NotImplemented();
     return(-1);
 }
コード例 #36
0
 public int OpenDirectory(string filename, Dokan.DokanFileInfo info)
 {
     NotImplemented(filename);
     return(0);
 }
コード例 #37
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;
     }
 }
コード例 #38
0
 public int CreateDirectory(string filename, Dokan.DokanFileInfo info)
 {
     NotImplemented(filename, info.Context);
     return(-1);
 }
コード例 #39
0
 public int SetFileAttributes(string filename, System.IO.FileAttributes attr, Dokan.DokanFileInfo info)
 {
     NotImplemented();
     return(-1);
 }
コード例 #40
0
 public int UnlockFile(string filename, long offset, long length, Dokan.DokanFileInfo info)
 {
     NotImplemented();
     return(0);
 }
コード例 #41
0
 public int DeleteDirectory(string filename, Dokan.DokanFileInfo info)
 {
     NotImplemented();
     return(-1);
 }
コード例 #42
0
 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);
     }
 }
コード例 #43
0
 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);
 }
コード例 #44
0
 public int Cleanup(string filename, Dokan.DokanFileInfo info)
 {
     info.Context = null;
     //NotImplemented();
     return(0);
 }
コード例 #45
0
 public int MoveFile(string filename, string newname, bool replace, Dokan.DokanFileInfo info)
 {
     NotImplemented();
     return(-1);
 }
コード例 #46
0
 public int SetEndOfFile(string filename, long length, Dokan.DokanFileInfo info)
 {
     NotImplemented();
     return(-1);
 }
コード例 #47
0
 public int SetAllocationSize(string filename, long length, Dokan.DokanFileInfo info)
 {
     NotImplemented();
     return(-1);
 }
コード例 #48
0
 public int Unmount(Dokan.DokanFileInfo info)
 {
     NotImplemented();
     return(0);
 }
コード例 #49
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);
 }