public cResponseDataFetch(uint pMSN, fMessageCacheAttributes pAttributes, cFetchableFlags pFlags, cEnvelope pEnvelope, DateTime?pReceived, IList <byte> pRFC822, IList <byte> pRFC822Header, IList <byte> pRFC822Text, uint?pSize, cBodyPart pBody, cBodyPart pBodyStructure, IList <cBody> pBodies, uint?pUID, cHeaderFields pHeaderFields, IDictionary <string, uint> pBinarySizes, ulong?pModSeq) { MSN = pMSN; Attributes = pAttributes; Flags = pFlags; Envelope = pEnvelope; Received = pReceived; RFC822 = pRFC822 == null ? null : new cBytes(pRFC822); RFC822Header = pRFC822Header == null ? null : new cBytes(pRFC822Header); RFC822Text = pRFC822Text == null ? null : new cBytes(pRFC822Text); Size = pSize; Body = pBody; BodyStructure = pBodyStructure; Bodies = new ReadOnlyCollection <cBody>(pBodies); UID = pUID; HeaderFields = pHeaderFields; BinarySizes = new cBinarySizes(pBinarySizes); ModSeq = pModSeq; }
internal static bool TryConstruct(cHeaderFieldNames pNames, bool pNot, IList <byte> pBytes, out cHeaderFields rFields) => ZTryConstruct(pNames, pNot, pBytes, out rFields);
private static bool ZTryConstruct(cHeaderFieldNames pNames, bool pNot, IList <byte> pBytes, out cHeaderFields rFields) { if (pBytes == null) { rFields = null; return(false); } cBytesCursor lCursor = new cBytesCursor(pBytes); List <cHeaderField> lFields = new List <cHeaderField>(); while (true) { if (!lCursor.GetRFC822FieldName(out var lName)) { break; } lCursor.SkipRFC822WSP(); if (!lCursor.SkipByte(cASCII.COLON)) { rFields = null; return(false); } if (!lCursor.GetRFC822FieldValue(out var lValue)) { rFields = null; return(false); } if (lName.Equals(kHeaderFieldName.References, StringComparison.InvariantCultureIgnoreCase)) { if (cHeaderFieldMsgIds.TryConstruct(lName, lValue, out var lReferences)) { lFields.Add(lReferences); } else { lFields.Add(new cHeaderField(lName, new cBytes(lValue))); } } else if (lName.Equals(kHeaderFieldName.Importance, StringComparison.InvariantCultureIgnoreCase)) { if (cHeaderFieldImportance.TryConstruct(lValue, out var lImportance)) { lFields.Add(lImportance); } else { lFields.Add(new cHeaderField(lName, new cBytes(lValue))); } } else { lFields.Add(new cHeaderField(lName, new cBytes(lValue))); } } if (!lCursor.Position.AtEnd && !lCursor.SkipBytes(cBytesCursor.CRLF)) { rFields = null; return(false); } rFields = new cHeaderFields(pNames, pNot, lFields); return(true); }
internal static bool TryConstruct(IList <byte> pBytes, out cHeaderFields rFields) => ZTryConstruct(cHeaderFieldNames.Empty, true, pBytes, out rFields);