public override DokanError WriteFile(string fileName, byte[] buffer, out int bytesWritten, long offset, DokanFileInfo info) { log.Info(String.Format("WriteFile call - {0}, Offset: {1}, Length: {2}", fileName, offset, buffer.Length)); bytesWritten = 0; if (info.IsDirectory) { log.Info("Is directory, skipped"); return(DokanError.ErrorError); } if (!CacheExists(fileName)) { log.Error("No existing cache"); return(DokanError.ErrorError); } if (info.Context is RFIDContext) { RFIDContext ctx = info.Context as RFIDContext; ctx.WriteCacheOnClose = true; } WriteToCache(fileName, buffer, (int)offset); bytesWritten = buffer.Length; return(DokanError.ErrorSuccess); }
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); }