本文整理汇总了C#中Dokan.DokanFileInfo类的典型用法代码示例。如果您正苦于以下问题:C# DokanFileInfo类的具体用法?C# DokanFileInfo怎么用?C# DokanFileInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DokanFileInfo类属于Dokan命名空间,在下文中一共展示了DokanFileInfo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateFile
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;
}
}
示例2: OpenDirectory
public int OpenDirectory(string filename, DokanFileInfo info)
{
Console.WriteLine("openDir: " + filename);
info.Context = count++;
info.IsDirectory = true;
return 0;
}
示例3: CreateDirectory
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;
}
示例4: FindFiles
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;
}
}
示例5: CreateFile
//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;
}
示例6: CreateFile
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;
}
}
示例7: OpenDirectory
public int OpenDirectory(String filename, DokanFileInfo info)
{
info.Context = count_++;
if (Directory.Exists(GetPath(filename)))
return 0;
else
return -DokanNet.ERROR_PATH_NOT_FOUND;
}
示例8: GetDiskFreeSpace
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;
}
示例9: CreateDirectory
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;
}
示例10: DeleteFile
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;
}
示例11: CreateFile
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: Cleanup
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;
}
示例13: CreateFile
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;
}
示例14: ConvertFileInfo
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: CreateFile
public virtual int CreateFile(string filename,
FileAccess access,
FileShare share,
FileMode mode,
FileOptions options,
DokanFileInfo info)
{
try { return -1; }
catch { return -1; }
}