本文整理汇总了C#中DokanNet.DokanFileInfo类的典型用法代码示例。如果您正苦于以下问题:C# DokanFileInfo类的具体用法?C# DokanFileInfo怎么用?C# DokanFileInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DokanFileInfo类属于DokanNet命名空间,在下文中一共展示了DokanFileInfo类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: CreateDirectory
public DokanError CreateDirectory(string fileName, DokanFileInfo info)
{
//Console.WriteLine("CreateDirectory: {0}", fileName);
if (fileName == "\\")
{
return DokanError.ErrorSuccess;
}
if (fileName.EndsWith("\\"))
{
fileName = fileName.Substring(0, fileName.Length - 1);
}
Directory dir = new Directory(Util.GetPathDirectory(fileName));
if (!dir.Exists())
{
return DokanError.ErrorPathNotFound;
}
String name = Util.GetPathFileName(fileName);
if (dir.Contains(name))
{
return DokanError.ErrorAlreadyExists;
}
dir.CreateDirectory(name);
return DokanError.ErrorSuccess;
}
开发者ID:WishSummer,项目名称:FS,代码行数:31,代码来源:FSDrive.cs
示例2: Cleanup
public void Cleanup(string fileName, DokanFileInfo info)
{
#if TRACE
if (info.Context != null)
Console.WriteLine(string.Format(CultureInfo.CurrentCulture, "{0}('{1}', {2} - entering",
"Cleanup", fileName, ToTrace(info)));
#endif
if (info.Context != null && info.Context is FileStream)
{
(info.Context as FileStream).Dispose();
}
info.Context = null;
if (info.DeleteOnClose)
{
if (info.IsDirectory)
{
Directory.Delete(GetPath(fileName));
}
else
{
File.Delete(GetPath(fileName));
}
}
Trace("Cleanup", fileName, info, DokanResult.Success);
}
开发者ID:shlatchz,项目名称:dokan-dotnet,代码行数:27,代码来源:Mirror.cs
示例3: CloseFile
public DokanError CloseFile(string fileName, DokanFileInfo info)
{
//Console.WriteLine("CloseFile: {0}", fileName);
// 可能打开文件时有 deleteOnClose 标记(Windows 8+)
if (info.Context != null)
{
File f = (File)info.Context;
if (f.flagDeleteOnClose)
{
Directory dir = new Directory(Util.GetPathDirectory(f.path));
if (!dir.Exists())
{
return DokanError.ErrorSuccess;
}
String name = Util.GetPathFileName(f.path);
if (!dir.Contains(name))
{
return DokanError.ErrorSuccess;
}
dir.Delete(name);
}
}
return DokanError.ErrorSuccess;
}
开发者ID:WishSummer,项目名称:FS,代码行数:29,代码来源:FSDrive.cs
示例4: ToTrace
private string ToTrace(DokanFileInfo info)
{
var context = info.Context != null ? "<" + info.Context.GetType().Name + ">" : "<null>";
return string.Format(CultureInfo.InvariantCulture, "{{{0}, {1}, {2}, {3}, {4}, #{5}, {6}, {7}}}",
context, info.DeleteOnClose, info.IsDirectory, info.NoCache, info.PagingIo, info.ProcessId, info.SynchronousIo, info.WriteToEndOfFile);
}
开发者ID:JangWonWoong,项目名称:dokan-dotnet,代码行数:7,代码来源:Mirror.cs
示例5: CreateFile
public DokanError CreateFile(string fileName, DokanNet.FileAccess access, FileShare share, FileMode mode, FileOptions options, FileAttributes attributes, DokanFileInfo info)
{
info.DeleteOnClose = (options & FileOptions.DeleteOnClose) != 0;
//Console.WriteLine("CreateFile: {0}, mode = {1}", fileName, mode);
if (fileName == "\\")
{
return DokanError.ErrorSuccess;
}
Directory dir = new Directory(Util.GetPathDirectory(fileName));
if (!dir.Exists())
{
return DokanError.ErrorPathNotFound;
}
String name = Util.GetPathFileName(fileName);
if (name.Length == 0)
{
return DokanError.ErrorInvalidName;
}
if (name.IndexOfAny(Path.GetInvalidFileNameChars()) > -1)
{
return DokanError.ErrorInvalidName;
}
// dokan API 要求在目标文件是目录时候,设置 info.IsDirectory = true
if (dir.Contains(name) && (dir.GetItemInfo(name).attribute & FileAttributes.Directory) != 0)
{
info.IsDirectory = true;
return DokanError.ErrorSuccess;
}
try
{
File f = new File(fileName, mode);
f.flagDeleteOnClose = info.DeleteOnClose;
info.Context = f;
}
catch (FileNotFoundException)
{
return DokanError.ErrorFileNotFound;
}
catch (IOException)
{
return DokanError.ErrorAlreadyExists;
}
catch (NotImplementedException)
{
return DokanError.ErrorAccessDenied;
}
catch (Exception)
{
return DokanError.ErrorError;
}
return DokanError.ErrorSuccess;
}
开发者ID:WishSummer,项目名称:FS,代码行数:59,代码来源:FSDrive.cs
示例6: FindFiles
public NtStatus FindFiles(string fileName, out IList<FileInformation> files, DokanFileInfo info)
{
//Console.Error.WriteLine("Attempted to findfiles for {0}", fileName);
//files = filesIndex.Select(fi => fi.FileInformation).ToList();
//files.Add(new FileInformation() { Attributes = FileAttributes.Directory, FileName = "\\" });
files = new List<FileInformation>();
return NtStatus.Success;
}
开发者ID:voltagex,项目名称:junkcode,代码行数:8,代码来源:Operations.cs
示例7: GetSubSystemOperations
DokanError IDokanOperations.CreateDirectory(string fileName, DokanFileInfo info)
{
SftpDrive drive = this.GetDriveByMountPoint(fileName, out fileName);
if (drive != null)
return GetSubSystemOperations(drive).CreateDirectory(fileName, info);
return DokanError.ErrorAccessDenied;
}
开发者ID:peterurk,项目名称:win-sshfs,代码行数:8,代码来源:VirtualFilesystem.cs
示例8: CloseFile
public void CloseFile(string fileName, DokanFileInfo info)
{
if (info.Context != null && info.Context is Stream)
{
(info.Context as Stream).Dispose();
}
info.Context = null;
}
开发者ID:pknam,项目名称:GangsDrive,代码行数:8,代码来源:GangsISODriver.cs
示例9: CloseFile
public DokanError CloseFile(string fileName, DokanFileInfo info)
{
if (info.Context != null && info.Context is FileStream)
{
(info.Context as FileStream).Dispose();
}
info.Context = null;
return DokanError.ErrorSuccess; // could recreate cleanup code hear but this is not called sometimes
}
开发者ID:apaka,项目名称:dokan-net,代码行数:9,代码来源:Mirror.cs
示例10: CreateFile
public DokanError CreateFile(
string filename,
FileAccess access,
System.IO.FileShare share,
System.IO.FileMode mode,
System.IO.FileOptions options,
System.IO.FileAttributes attributes,
DokanFileInfo info)
{
return DokanError.ErrorSuccess;
}
开发者ID:twd2,项目名称:dokan-dotnet,代码行数:11,代码来源:Program.cs
示例11: Trace
private NtStatus Trace(string method, string fileName, DokanFileInfo info,
FileAccess access, FileShare share, FileMode mode, FileOptions options, FileAttributes attributes,
NtStatus result)
{
#if TRACE
Console.WriteLine(string.Format(CultureInfo.InvariantCulture, "{0}('{1}', {2}, [{3}], [{4}], [{5}], [{6}], [{7}]) -> {8}",
method, fileName, ToTrace(info), access, share, mode, options, attributes, result));
#endif
return result;
}
开发者ID:JangWonWoong,项目名称:dokan-dotnet,代码行数:11,代码来源:Mirror.cs
示例12: CreateFile
public NtStatus CreateFile(
string filename,
FileAccess access,
System.IO.FileShare share,
System.IO.FileMode mode,
System.IO.FileOptions options,
System.IO.FileAttributes attributes,
DokanFileInfo info)
{
return DokanResult.Success;
}
开发者ID:Niko-O,项目名称:dokan-dotnet,代码行数:11,代码来源:Program.cs
示例13: Trace
private NtStatus Trace(string method, string fileName, DokanFileInfo info,
FileAccess access, FileShare share, FileMode mode, FileOptions options, FileAttributes attributes,
NtStatus result)
{
#if TRACE
logger.Debug(
DokanFormat(
$"{method}('{fileName}', {info}, [{access}], [{share}], [{mode}], [{options}], [{attributes}]) -> {result}"));
#endif
return result;
}
开发者ID:viciousviper,项目名称:dokan-dotnet,代码行数:12,代码来源:Mirror.cs
示例14: Cleanup
public void Cleanup(string fileName, DokanFileInfo info)
{
if (info.Context != null && info.Context is Stream)
{
(info.Context as Stream).Dispose();
}
info.Context = null;
if (info.DeleteOnClose)
{
// do nothig
}
}
开发者ID:pknam,项目名称:GangsDrive,代码行数:13,代码来源:GangsISODriver.cs
示例15: CreateFile
public NtStatus CreateFile(
string filename,
FileAccess access,
System.IO.FileShare share,
System.IO.FileMode mode,
System.IO.FileOptions options,
System.IO.FileAttributes attributes,
DokanFileInfo info)
{
if (info.IsDirectory && mode == System.IO.FileMode.CreateNew)
return DokanResult.AccessDenied;
return DokanResult.Success;
}
开发者ID:marinkobabic,项目名称:dokan-dotnet,代码行数:13,代码来源:Program.cs
示例16: CreateDirectory
public DokanError CreateDirectory(string fileName, DokanFileInfo info)
{
if (Directory.Exists(GetPath(fileName)))
return DokanError.ErrorAlreadyExists;
try
{
Directory.CreateDirectory(GetPath(fileName));
return DokanError.ErrorSuccess;
}
catch (UnauthorizedAccessException)
{
return DokanError.ErrorAccessDenied;
}
}
开发者ID:apaka,项目名称:dokan-net,代码行数:15,代码来源:Mirror.cs
示例17: CloseFile
public DokanError CloseFile(string fileName, DokanFileInfo info)
{
log.Info(String.Format("CloseFile call - {0}", fileName));
if (info.Context is RFIDContext)
{
RFIDContext ctx = info.Context as RFIDContext;
if (ctx.WriteCacheOnClose)
{
return WriteCacheToCard(fileName);
}
}
return DokanError.ErrorSuccess;
}
开发者ID:sainaen,项目名称:dokan-nfc,代码行数:15,代码来源:DokanRFIDDriver.cs
示例18: CreateDirectory
public NtStatus CreateDirectory(string fileName, DokanFileInfo info)
{
if (Directory.Exists(GetPath(fileName)))
return Trace("CreateDirectory", fileName, info, DokanResult.FileExists);
try
{
Directory.CreateDirectory(GetPath(fileName));
return Trace("CreateDirectory", fileName, info, DokanResult.Success);
}
catch (UnauthorizedAccessException)
{
return Trace("CreateDirectory", fileName, info, DokanResult.AccessDenied);
}
}
开发者ID:pknam,项目名称:GangsDrive,代码行数:15,代码来源:Mirror.cs
示例19: CloseFile
public void CloseFile(string fileName, DokanFileInfo info)
{
#if TRACE
if (info.Context != null)
Console.WriteLine(string.Format(CultureInfo.CurrentCulture, "{0}('{1}', {2} - entering",
"CloseFile", fileName, ToTrace(info)));
#endif
if (info.Context != null && info.Context is FileStream)
{
(info.Context as FileStream).Dispose();
}
info.Context = null;
Trace("CloseFile", fileName, info, DokanResult.Success); // could recreate cleanup code here but this is not called sometimes
}
开发者ID:shlatchz,项目名称:dokan-dotnet,代码行数:15,代码来源:Mirror.cs
示例20: Cleanup
public DokanError Cleanup(string fileName, DokanFileInfo info)
{
log.Info(String.Format("Cleanup call - {0}", fileName));
if (info.DeleteOnClose)
{
if (info.IsDirectory)
{
DeleteDirectory(fileName, info);
}
else
{
DeleteFile(fileName, info);
}
}
return DokanError.ErrorSuccess;
}
开发者ID:sainaen,项目名称:dokan-nfc,代码行数:18,代码来源:DokanRFIDDriver.cs
注:本文中的DokanNet.DokanFileInfo类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论