public BeginRequestBody(Record record) { if (record.Type != RecordType.BeginRequest) throw new ArgumentException ( Strings.BeginRequestBody_WrongType, "record"); if (record.BodyLength != 8) throw new ArgumentException ( Strings.BeginRequestBody_WrongSize, "record"); byte[] body = record.GetBody (); role = (Role) Record.ReadUInt16 (body, 0); flags = (BeginRequestFlags) body [2]; }
public BeginRequestBody(Record record) { if (record.Type != RecordType.BeginRequest) throw new ArgumentException ( Strings.BeginRequestBody_WrongType, "record"); if (record.BodyLength != 8) throw new ArgumentException ( String.Format(Strings.BeginRequestBody_WrongSize, record.BodyLength), "record"); IReadOnlyList<byte> body; record.GetBody (out body); role = (Role) Record.ReadUInt16 (body, 0); flags = (BeginRequestFlags) body [2]; }
void HandleParams(Request request, Record record) { if (request == null) { StopRun (Strings.Connection_RequestDoesNotExist, record.RequestID); return; } request.AddParameterData (record.GetBody ()); }
void HandleGetValues(Record record) { byte[] response_data; // Look up the data from the server. try { IDictionary<string, string> pairs_in = NameValuePair.FromData (record.GetBody ()); IDictionary<string, string> pairs_out = server.GetValues (pairs_in.Keys); response_data = NameValuePair.GetData (pairs_out); } catch { response_data = new byte[0]; } SendRecord (RecordType.GetValuesResult, record.RequestID, response_data); }
void HandleParams(Request request, Record record) { if (request == null) { StopRun (Strings.Connection_RequestDoesNotExist, record.RequestID); return; } IReadOnlyList<byte> body; record.GetBody (out body); request.AddParameterData (body); }