public AfpResultCode Process(IAfpSession session, DsiHeader dsiHeader, AfpStream requestStream, AfpStream responseStream) { byte flag = requestStream.ReadUInt8(); short forkId = requestStream.ReadInt16(); long offset = requestStream.ReadInt64(); long reqCount = requestStream.ReadInt64(); IAfpFork fork = session.GetFork(forkId); if (fork == null) { return AfpResultCode.FPObjectNotFound; } byte[] writeData = requestStream.ReadBytes((uint)reqCount); long position = 0; if (flag == 1) { // End of the fork position = (fork.DataProvider.Length - offset); } else { position = offset; } fork.DataProvider.Write(position, writeData, 0, writeData.Length); responseStream.WriteUInt64((ulong)(position + writeData.LongLength)); return AfpResultCode.FPNoErr; }
public AfpResultCode Process(IAfpSession session, DsiHeader dsiHeader, AfpStream requestStream, AfpStream responseStream) { byte flag = requestStream.ReadUInt8(); short forkId = requestStream.ReadInt16(); long offset = requestStream.ReadInt64(); long reqCount = requestStream.ReadInt64(); IAfpFork fork = session.GetFork(forkId); if (fork == null) { return(AfpResultCode.FPObjectNotFound); } byte[] writeData = requestStream.ReadBytes((uint)reqCount); long position = 0; if (flag == 1) { // End of the fork position = (fork.DataProvider.Length - offset); } else { position = offset; } fork.DataProvider.Write(position, writeData, 0, writeData.Length); responseStream.WriteUInt64((ulong)(position + writeData.LongLength)); return(AfpResultCode.FPNoErr); }
public AfpResultCode Process(IAfpSession session, DsiHeader dsiHeader, AfpStream requestStream, AfpStream responseStream) { requestStream.ReadUInt8(); // Pad short forkId = requestStream.ReadInt16(); long offset = requestStream.ReadInt64(); long readBytes = requestStream.ReadInt64(); //byte newLineMask = requestStream.ReadUInt8(); //byte newLineChar = requestStream.ReadUInt8(); IAfpFork fork = session.GetFork(forkId); if (fork == null) { return(AfpResultCode.FPObjectNotFound); } byte[] buffer = new byte[readBytes]; int bytesRead = fork.DataProvider.Read(offset, buffer, 0, (int)readBytes); responseStream.WriteBytes(buffer); if (bytesRead < readBytes) { return(AfpResultCode.FPEOFErr); } return(AfpResultCode.FPNoErr); }
public AfpResultCode Process(IAfpSession session, DsiHeader dsiHeader, AfpStream requestStream, AfpStream responseStream) { requestStream.ReadUInt8(); // Pad short forkId = requestStream.ReadInt16(); long offset = requestStream.ReadInt64(); long readBytes = requestStream.ReadInt64(); //byte newLineMask = requestStream.ReadUInt8(); //byte newLineChar = requestStream.ReadUInt8(); IAfpFork fork = session.GetFork(forkId); if (fork == null) { return AfpResultCode.FPObjectNotFound; } byte[] buffer = new byte[readBytes]; int bytesRead = fork.DataProvider.Read(offset, buffer, 0, (int)readBytes); responseStream.WriteBytes(buffer); if (bytesRead < readBytes) { return AfpResultCode.FPEOFErr; } return AfpResultCode.FPNoErr; }