Esempio n. 1
0
 internal static byte[] ToFlatEntryList(ICollection <ParticipantEntryId> entryIds)
 {
     return(ParticipantEntryId.TranslateExceptions <byte[]>(delegate
     {
         byte[] bytes;
         using (ParticipantEntryId.Writer writer = new ParticipantEntryId.Writer())
         {
             writer.Write(entryIds.Count);
             ParticipantEntryId.Bookmark bookmark = writer.PlaceBookmark <int>(new ParticipantEntryId.WriterMethod <int>(writer.Write), 0);
             ParticipantEntryId.Bookmark currentBookmark = writer.CurrentBookmark;
             foreach (ParticipantEntryId participantEntryId in entryIds)
             {
                 if (participantEntryId == null)
                 {
                     throw new ArgumentNullException("entryIds");
                 }
                 ParticipantEntryId.Bookmark bookmark2 = writer.PlaceBookmark <int>(new ParticipantEntryId.WriterMethod <int>(writer.Write), 0);
                 ParticipantEntryId.Bookmark currentBookmark2 = writer.CurrentBookmark;
                 participantEntryId.Serialize(writer);
                 int num = (int)(writer.CurrentBookmark - currentBookmark2);
                 writer.WriteBookmark <int>(bookmark2, num);
                 writer.WritePadding(num, 4);
             }
             writer.WriteBookmark <int>(bookmark, (int)(writer.CurrentBookmark - currentBookmark));
             bytes = writer.GetBytes();
         }
         return bytes;
     }));
 }
Esempio n. 2
0
 internal static ParticipantEntryId FromEntryId(byte[] bytes)
 {
     return(ParticipantEntryId.TranslateExceptions <ParticipantEntryId>(delegate
     {
         ParticipantEntryId result;
         using (ParticipantEntryId.Reader reader = new ParticipantEntryId.Reader(bytes))
         {
             result = ParticipantEntryId.FromEntryId(null, reader);
         }
         return result;
     }));
 }
Esempio n. 3
0
 internal static IList <ParticipantEntryId> FromFlatEntryList(byte[] bytes)
 {
     return(ParticipantEntryId.TranslateExceptions <IList <ParticipantEntryId> >(delegate
     {
         IList <ParticipantEntryId> result;
         using (ParticipantEntryId.Reader reader = new ParticipantEntryId.Reader(bytes))
         {
             result = ParticipantEntryId.FromFlatEntryList(reader);
         }
         return result;
     }));
 }
Esempio n. 4
0
 private static ParticipantEntryId TryFromEntryId(ParticipantEntryId.Reader reader)
 {
     try
     {
         return(ParticipantEntryId.TranslateExceptions <ParticipantEntryId>(() => ParticipantEntryId.FromEntryId(null, reader)));
     }
     catch (NotSupportedException)
     {
     }
     catch (CorruptDataException)
     {
     }
     reader.BaseStream.Position = 0L;
     return(new UnrecognizedParticipantEntryId(reader.ReadBytes(reader.BytesRemaining)));
 }