private void Parse()
        {
            int num = 0;

            if (this.entryBlob != null && this.entryBlob.Length > 1)
            {
                for (;;)
                {
                    ushort num2 = Ex12ExRenEntryParser.ParseUInt16(this.entryBlob, num);
                    if (num2 == 0)
                    {
                        break;
                    }
                    Ex12ExRenEntryParser.ExFolderEntry exFolderEntry = this.GetExFolderEntry(num2);
                    num += 2;
                    ushort num3 = Ex12ExRenEntryParser.ParseUInt16(this.entryBlob, num);
                    num += 2;
                    int num4 = num;
                    while (num - num4 < (int)num3)
                    {
                        Ex12ExRenEntryParser.ParseEntryBlock(this.entryBlob, ref num, num3, ref exFolderEntry);
                    }
                    if (num + 2 >= this.entryBlob.Length)
                    {
                        return;
                    }
                }
                return;
            }
        }
 internal void Insert(Ex12RenEntryIdStrategy.PersistenceId persistenceId, byte[] entryId)
 {
     Ex12ExRenEntryParser.ExFolderEntry exFolderEntry = new Ex12ExRenEntryParser.ExFolderEntry(1, entryId, 0, 0);
     if (!this.ReplaceEntryBlock(persistenceId, exFolderEntry))
     {
         this.InsertEntryBlock(persistenceId, exFolderEntry);
     }
 }
 internal bool Remove(Ex12RenEntryIdStrategy.PersistenceId persistenceId)
 {
     Ex12ExRenEntryParser.ExFolderEntry exFolderEntry = null;
     if (this.defaultFolderRenEx.TryGetValue((ushort)persistenceId, out exFolderEntry))
     {
         int start = exFolderEntry.Start - 4;
         this.entryBlob = Ex12ExRenEntryParser.ReplaceBlob(this.entryBlob, start, exFolderEntry.End, Array <byte> .Empty);
         this.defaultFolderRenEx.Clear();
         this.Parse();
         return(true);
     }
     return(false);
 }
 private bool ReplaceEntryBlock(Ex12RenEntryIdStrategy.PersistenceId persistenceId, Ex12ExRenEntryParser.ExFolderEntry exFolderEntry)
 {
     Ex12ExRenEntryParser.ExFolderEntry exFolderEntry2 = null;
     if (this.defaultFolderRenEx.TryGetValue((ushort)persistenceId, out exFolderEntry2))
     {
         byte[] array = exFolderEntry.ToBytes();
         if (array.Length == exFolderEntry2.End - exFolderEntry2.Start)
         {
             exFolderEntry.Start = exFolderEntry2.Start;
             exFolderEntry.End   = array.Length + exFolderEntry.Start;
             this.defaultFolderRenEx[(ushort)persistenceId] = exFolderEntry;
             this.entryBlob = Ex12ExRenEntryParser.ReplaceBlob(this.entryBlob, exFolderEntry2.Start, exFolderEntry2.End, array);
             return(true);
         }
     }
     return(false);
 }
 private static void ParseEntryBlock(byte[] additionalRenEntryIdsEx, ref int index, ushort blockSize, ref Ex12ExRenEntryParser.ExFolderEntry entry)
 {
     for (;;)
     {
         int  start = index;
         uint num   = (uint)Ex12ExRenEntryParser.ParseUInt16(additionalRenEntryIdsEx, index);
         index += 2;
         ushort num2 = Ex12ExRenEntryParser.ParseUInt16(additionalRenEntryIdsEx, index);
         index     += 2;
         blockSize -= 4;
         if (num2 > blockSize)
         {
             break;
         }
         try
         {
             if (num == 1U)
             {
                 entry.EntryId = new byte[(int)num2];
                 Array.Copy(additionalRenEntryIdsEx, index, entry.EntryId, 0, (int)num2);
             }
             else if (num == 2U)
             {
                 entry.ElementId = Ex12ExRenEntryParser.ParseUInt16(additionalRenEntryIdsEx, index);
             }
             else
             {
                 entry.Unknown = new byte[(int)num2];
                 Array.Copy(additionalRenEntryIdsEx, index, entry.Unknown, 0, (int)num2);
             }
         }
         catch (ArgumentException innerException)
         {
             throw new FormatException("ParseEntryBlock", innerException);
         }
         index      += (int)num2;
         blockSize  -= num2;
         entry.Start = start;
         entry.End   = index;
         if (blockSize <= 0)
         {
             return;
         }
     }
 }
        private void InsertEntryBlock(Ex12RenEntryIdStrategy.PersistenceId persistenceId, Ex12ExRenEntryParser.ExFolderEntry exFolderEntry)
        {
            this.defaultFolderRenEx[(ushort)persistenceId] = exFolderEntry;
            int num = (this.entryBlob == null) ? 0 : this.entryBlob.Length;
            int num2;
            int num3;

            byte[] array = exFolderEntry.ToBlock(persistenceId, out num2, out num3);
            this.entryBlob      = Ex12ExRenEntryParser.ReplaceBlob(this.entryBlob, 0, 0, array);
            exFolderEntry.Start = num + num2;
            exFolderEntry.End   = num + array.Length;
        }