public static long Read(ServiceCtx Context) { AmIStorageAccessor Accessor = Context.GetObject <AmIStorageAccessor>(); AmIStorage Storage = Accessor.Storage; long ReadPosition = Context.RequestData.ReadInt64(); if (Context.Request.RecvListBuff.Count > 0) { long Position = Context.Request.RecvListBuff[0].Position; short Size = Context.Request.RecvListBuff[0].Size; byte[] Data; if (Storage.Data.Length > Size) { Data = new byte[Size]; Buffer.BlockCopy(Storage.Data, 0, Data, 0, Size); } else { Data = Storage.Data; } AMemoryHelper.WriteBytes(Context.Memory, Position, Data); } return(0); }
public static long Open(ServiceCtx Context) { AmIStorage Storage = Context.GetObject <AmIStorage>(); MakeObject(Context, new AmIStorageAccessor(Storage)); return(0); }
public AmIStorageAccessor(AmIStorage Storage) { this.Storage = Storage; }