示例#1
0
        public override void Flush()
        {
            if (msWriteBuffer.Length > MAX_PACKETLEN)
            {
                // send fragmented
                MemoryStream msFragmentedBuffer = new MemoryStream(packetBuffer, true);

                int fragmentStart = 4;
                int fragmentLength;

                do
                {
                    fragmentLength = fragmentStart + FRAGMENT_SIZE <= ( int )msWriteBuffer.Length ?
                                     FRAGMENT_SIZE : ( int )msWriteBuffer.Length - fragmentStart;

                    msFragmentedBuffer.Position = 0;
                    msFragmentedBuffer.Write(ExBitConverter.GetBytes(connection.OutgoingSequence | FRAGMENT_BIT, true), 0, 4);
                    msFragmentedBuffer.Write(ExBitConverter.GetBytes(fragmentStart, true), 0, 2);
                    msFragmentedBuffer.Write(ExBitConverter.GetBytes(fragmentLength, true), 0, 2);
                    msFragmentedBuffer.Write(msWriteBuffer.GetBuffer(), fragmentStart, fragmentLength);
                    fragmentStart += fragmentLength;

                    (underlying as Socket).Send(msFragmentedBuffer.GetBuffer(), ( int )msFragmentedBuffer.Position, SocketFlags.None);
                } while (fragmentLength == FRAGMENT_SIZE);
            }
            else
            {
                (underlying as Socket).Send(msWriteBuffer.GetBuffer(), ( int )msWriteBuffer.Length, SocketFlags.None);
            }

            msWriteBuffer.SetLength(0);
        }
示例#2
0
        // Token: 0x06001C2E RID: 7214 RVA: 0x0006FA44 File Offset: 0x0006DC44
        internal string EncodeCertChain(ChainContext chainContext, bool includeRootCert, X509Certificate2 signersCertificate)
        {
            uint count = (uint)chainContext.GetChains().Count;

            List <byte[]>[] array  = new List <byte[]> [count];
            uint[]          array2 = new uint[count];
            uint[]          array3 = new uint[count];
            uint            num    = 16U;
            int             num2   = 0;

            foreach (CertificateChain certificateChain in chainContext.GetChains())
            {
                array3[num2] = 16U;
                array2[num2] = 0U;
                array[num2]  = new List <byte[]>(certificateChain.Elements.Count);
                foreach (ChainElement chainElement in certificateChain.Elements)
                {
                    if (!signersCertificate.Equals(chainElement.Certificate) && (includeRootCert || (chainElement.TrustInformation & TrustInformation.IsSelfSigned) == TrustInformation.None))
                    {
                        array3[num2] += 12U;
                        byte[] rawData = chainElement.Certificate.RawData;
                        array[num2].Add(rawData);
                        array3[num2] += (uint)rawData.Length;
                        array2[num2] += 1U;
                    }
                }
                num += array3[num2];
                num2++;
            }
            byte[] array4 = new byte[num];
            int    num3   = 0;

            num3 += ExBitConverter.Write(num, array4, num3);
            num3 += ExBitConverter.Write((uint)chainContext.Status, array4, num3);
            num3 += ExBitConverter.Write((uint)chainContext.TrustInformation, array4, num3);
            num3 += ExBitConverter.Write(count, array4, num3);
            num2  = 0;
            foreach (CertificateChain certificateChain2 in chainContext.GetChains())
            {
                num3 += ExBitConverter.Write(array3[num2], array4, num3);
                num3 += ExBitConverter.Write((uint)certificateChain2.Status, array4, num3);
                num3 += ExBitConverter.Write((uint)certificateChain2.TrustInformation, array4, num3);
                num3 += ExBitConverter.Write(array2[num2], array4, num3);
                int num4 = 0;
                foreach (ChainElement chainElement2 in certificateChain2.Elements)
                {
                    if (!signersCertificate.Equals(chainElement2.Certificate) && (includeRootCert || (chainElement2.TrustInformation & TrustInformation.IsSelfSigned) == TrustInformation.None))
                    {
                        num3 += ExBitConverter.Write((uint)(array[num2][num4].Length + 12), array4, num3);
                        num3 += ExBitConverter.Write((uint)chainElement2.Status, array4, num3);
                        num3 += ExBitConverter.Write((uint)chainElement2.TrustInformation, array4, num3);
                        Array.Copy(array[num2][num4], 0, array4, num3, array[num2][num4].Length);
                        num3 += array[num2][num4].Length;
                        num4++;
                    }
                }
                num2++;
            }
            return(Convert.ToBase64String(array4));
        }
示例#3
0
 internal byte[] GetBytes(Encoding encoding)
 {
     byte[] array;
     if (this.orgUnit == null)
     {
         array    = new byte[6];
         array[0] = 1;
         array[1] = 0;
         ExBitConverter.Write(0, array, 2);
     }
     else
     {
         if (this.configUnit.ObjectGuid == Guid.Empty || this.orgUnit.ObjectGuid == Guid.Empty)
         {
             throw new InvalidOperationException("OrganizationId is not fully populated and cannot be serialized");
         }
         int byteCount  = this.orgUnit.GetByteCount(encoding);
         int byteCount2 = this.configUnit.GetByteCount(encoding);
         array = new byte[byteCount + byteCount2 + 8 + 3];
         int num = 0;
         array[num++] = 2;
         array[num++] = 1;
         num         += ExBitConverter.Write(byteCount, array, num);
         array[num++] = 2;
         num         += ExBitConverter.Write(byteCount2, array, num);
         this.orgUnit.GetBytes(encoding, array, num);
         num += byteCount;
         this.configUnit.GetBytes(encoding, array, num);
     }
     return(array);
 }
 public static void Serialize(StreamPropertyType propId, object value, byte[] buffer, ref int offset)
 {
     if (buffer == null || offset > buffer.Length)
     {
         throw new ArgumentException("buffer");
     }
     offset += ExBitConverter.Write((short)propId, buffer, offset);
     PropertyStreamWriter.WriteValue(propId, value, buffer, ref offset);
 }
示例#5
0
        private void WriteHeader(EntryId.EntryIdFlags flags, byte[] buffer)
        {
            int num = 0;

            num += ExBitConverter.Write((int)flags, buffer, num);
            num += ExBitConverter.Write(this.providerGuid, buffer, num);
            num += ExBitConverter.Write(1, buffer, num);
            num += ExBitConverter.Write((int)this.displayType, buffer, num);
        }
示例#6
0
			internal static void SetDword(byte[] buff, ref int pos, uint dw)
			{
				if (buff != null)
				{
					AddressBookEntryId.BinaryHelper.CheckBounds(pos, buff.Length, AddressBookEntryId.BinaryHelper.DWordSize);
					ExBitConverter.Write(dw, buff, pos);
				}
				pos += AddressBookEntryId.BinaryHelper.DWordSize;
			}
示例#7
0
        // Token: 0x06000B93 RID: 2963 RVA: 0x00033628 File Offset: 0x00031828
        private void SendPageNumbersToSource(object dummy)
        {
            Exception ex       = null;
            IOBuffer  iobuffer = null;
            int       num      = this.m_pageList.Length;

            try
            {
                this.GetChannel();
                SeedPageReaderMultiplePageRequest seedPageReaderMultiplePageRequest = new SeedPageReaderMultiplePageRequest(this.m_channel, this.m_databaseGuid, this.m_databaseName, this.m_databasePath, (long)this.m_pageList.Length);
                seedPageReaderMultiplePageRequest.Send();
                iobuffer = IOBufferPool.Allocate();
                iobuffer.AppendOffset = 0;
                foreach (long num2 in this.m_pageList)
                {
                    if (iobuffer.RemainingSpace >= 4)
                    {
                        DiagCore.RetailAssert(num2 <= 2147483647L, "ese uses 31bit page numbers but {0} was passed", new object[]
                        {
                            num2
                        });
                        ExBitConverter.Write((uint)num2, iobuffer.Buffer, iobuffer.AppendOffset);
                        iobuffer.AppendOffset += 4;
                    }
                    else
                    {
                        this.m_channel.Write(iobuffer.Buffer, 0, iobuffer.AppendOffset);
                        iobuffer.AppendOffset = 0;
                    }
                }
                if (iobuffer.AppendOffset > 0)
                {
                    this.m_channel.Write(iobuffer.Buffer, 0, iobuffer.AppendOffset);
                }
            }
            catch (NetworkRemoteException ex2)
            {
                ex = ex2;
            }
            catch (NetworkTransportException ex3)
            {
                ex = ex3;
            }
            finally
            {
                this.m_pageList = null;
                if (iobuffer != null)
                {
                    IOBufferPool.Free(iobuffer);
                }
            }
            if (ex != null)
            {
                ReplayCrimsonEvents.SendPageNumbersToSourceFailed.Log <Guid, string, int, Exception>(this.m_databaseGuid, this.DatabaseName, num, ex);
            }
        }
        private static void WriteMultiValuedProperty <T>(StreamPropertyType propId, MultiValuedProperty <T> list, byte[] buffer, ref int offset)
        {
            int num = (list != null) ? list.Count : 0;

            offset += ExBitConverter.Write(num, buffer, offset);
            for (int i = 0; i < num; i++)
            {
                PropertyStreamWriter.WriteValue(propId & ~StreamPropertyType.MultiValuedProperty, list[i], buffer, ref offset);
            }
        }
        private static void WriteArray <T>(StreamPropertyType propId, T[] array, byte[] buffer, ref int offset)
        {
            int num = (array != null) ? array.Length : 0;

            offset += ExBitConverter.Write(num, buffer, offset);
            for (int i = 0; i < num; i++)
            {
                PropertyStreamWriter.WriteValue(propId & ~StreamPropertyType.Array, array[i], buffer, ref offset);
            }
        }
示例#10
0
        public byte[] GetBytes()
        {
            byte[] array = new byte[16];
            long   value = IPAddress.HostToNetworkOrder((long)this.highBytes);

            ExBitConverter.Write(value, array, 0);
            value = IPAddress.HostToNetworkOrder((long)this.lowBytes);
            ExBitConverter.Write(value, array, 8);
            return(array);
        }
        public void FromBytes(byte[] data)
        {
            int num = 0;

            this.sentTime  = BitConverter.ToInt64(data, num);
            num           += 8;
            this.messageId = ExBitConverter.ReadAsciiString(data, num);
            num           += this.messageId.Length + 1;
            this.mailbox   = ExBitConverter.ReadAsciiString(data, num);
        }
        public byte[] ToBytes()
        {
            byte[] array = new byte[this.mailbox.Length + this.messageId.Length + 10];
            int    num   = 0;

            num += ExBitConverter.Write(this.sentTime, array, num);
            num += ExBitConverter.Write(this.messageId, false, array, num);
            num += ExBitConverter.Write(this.mailbox, false, array, num);
            return(array);
        }
示例#13
0
        private void AppendProperty(OofHistory.PropId propId, byte[] propertyValue)
        {
            this.data[this.dataPosition++] = (byte)propId;
            ushort num = (ushort)propertyValue.Length;

            ExBitConverter.Write(num, this.data, this.dataPosition);
            this.dataPosition += 2;
            Buffer.BlockCopy(propertyValue, 0, this.data, this.dataPosition, (int)num);
            this.dataPosition += (int)num;
        }
        protected void WriteCoconetBlock(byte[] buf, int offset, int length)
        {
            byte[] compressBuf = this.CompressBuf;
            int    num;

            this.m_coconetCompressor.Compress(buf, offset, length, compressBuf, 9, 1048577, out num);
            compressBuf[0] = 4;
            ExBitConverter.Write(num, compressBuf, 1);
            ExBitConverter.Write(length, compressBuf, 5);
            this.m_tcpChannel.Write(compressBuf, 0, 9 + num);
        }
        // Token: 0x06000C85 RID: 3205 RVA: 0x00027650 File Offset: 0x00025850
        public override byte[] GetBytes()
        {
            byte[] bytes = base.MailboxOwnerId.GetBytes();
            byte[] array = new byte[16 + bytes.Length + 2];
            ExBitConverter.Write((short)bytes.Length, array, 0);
            int num = 2;

            Array.Copy(bytes, 0, array, num, bytes.Length);
            num += bytes.Length;
            ExBitConverter.Write(this.RuleIdGuid, array, num);
            return(array);
        }
示例#16
0
        public InboxRuleIdParameter(string inboxRuleId)
        {
            if (string.IsNullOrEmpty(inboxRuleId))
            {
                throw new ArgumentNullException("inboxRuleId");
            }
            this.rawInput = inboxRuleId;
            int num = inboxRuleId.Length;
            int num2;

            do
            {
                num2 = num;
                num  = inboxRuleId.LastIndexOf("\\\\", num2 - 1, num2);
            }while (num != -1);
            int num3 = inboxRuleId.LastIndexOf('\\', num2 - 1, num2);

            if (num3 == 0 || num3 == inboxRuleId.Length - 1)
            {
                throw new ArgumentException(Strings.ErrorInvalidParameterFormat("inboxRuleId"), "inboxRuleId");
            }
            string text;
            string text2;

            if (num3 > 0)
            {
                text  = inboxRuleId.Substring(0, num3);
                text2 = inboxRuleId.Substring(1 + num3);
            }
            else
            {
                text2 = inboxRuleId;
                text  = null;
            }
            if (num2 != inboxRuleId.Length)
            {
                text2 = text2.Replace("\\\\", '\\'.ToString());
            }
            if (!string.IsNullOrEmpty(text))
            {
                this.rawMailbox = new MailboxIdParameter(text);
            }
            ulong value;

            if (ulong.TryParse(text2, out value))
            {
                byte[] array = new byte[8];
                ExBitConverter.Write((long)value, array, 0);
                this.rawRuleId = RuleId.Deserialize(array, 0);
                return;
            }
            this.rawRuleName = text2;
        }
示例#17
0
 public static byte[] ToBytesFromRegistryFormat(REG_TIMEZONE_INFO timeZoneInfo)
 {
     byte[] array = new byte[O11TimeZoneFormatter.OUTLOOK_TIMEZONE_INFO.Size];
     ExBitConverter.Write(timeZoneInfo.Bias, array, O11TimeZoneFormatter.OUTLOOK_TIMEZONE_INFO.BiasOffset);
     ExBitConverter.Write(timeZoneInfo.StandardBias, array, O11TimeZoneFormatter.OUTLOOK_TIMEZONE_INFO.StandardBiasOffset);
     ExBitConverter.Write(timeZoneInfo.DaylightBias, array, O11TimeZoneFormatter.OUTLOOK_TIMEZONE_INFO.DaylightBiasOffset);
     ExBitConverter.Write(0, array, O11TimeZoneFormatter.OUTLOOK_TIMEZONE_INFO.StandardYearOffset);
     timeZoneInfo.StandardDate.Write(new ArraySegment <byte>(array, O11TimeZoneFormatter.OUTLOOK_TIMEZONE_INFO.StandardDateOffset, NativeMethods.SystemTime.Size));
     ExBitConverter.Write(0, array, O11TimeZoneFormatter.OUTLOOK_TIMEZONE_INFO.DaylightYearOffset);
     timeZoneInfo.DaylightDate.Write(new ArraySegment <byte>(array, O11TimeZoneFormatter.OUTLOOK_TIMEZONE_INFO.DaylightDateOffset, NativeMethods.SystemTime.Size));
     return(array);
 }
示例#18
0
        public string ToBase64String()
        {
            int num = 29;

            byte[] array = new byte[num];
            int    num2  = 0;

            num2         += ExBitConverter.Write(1, array, num2);
            num2         += ExBitConverter.Write(this.mdbGuid, array, num2);
            num2         += ExBitConverter.Write(this.mapiWatermark, array, num2);
            array[num2++] = (this.wasEventProcessed ? 1 : 0);
            return(Convert.ToBase64String(array));
        }
示例#19
0
        // Token: 0x0600043B RID: 1083 RVA: 0x000180C8 File Offset: 0x000162C8
        internal byte[] GetBytes()
        {
            int byteCount = this.GetByteCount();

            byte[] array = new byte[byteCount];
            int    num   = 0;
            int    bytes = Encoding.Unicode.GetBytes(this.stringValue, 0, this.stringValue.Length, array, 4);

            num += ExBitConverter.Write(bytes, array, num);
            num += bytes;
            this.objectIdValue.GetBytes(Encoding.Unicode, array, num);
            return(array);
        }
 public int ToBytes(ArraySegment <byte> target)
 {
     if (target.Count < O12TimeZoneFormatter.ExchangeTimeZoneRule.Size)
     {
         throw new ArgumentOutOfRangeException();
     }
     ExBitConverter.Write((short)this.MajorVersion, target.Array, target.Offset + O12TimeZoneFormatter.ExchangeTimeZoneRule.MajorVersionOffset);
     ExBitConverter.Write((short)this.MinVersion, target.Array, target.Offset + O12TimeZoneFormatter.ExchangeTimeZoneRule.MinVersionOffset);
     ExBitConverter.Write(this.ruleSize, target.Array, target.Offset + O12TimeZoneFormatter.ExchangeTimeZoneRule.RuleSizeOffset);
     ExBitConverter.Write(this.Flags, target.Array, target.Offset + O12TimeZoneFormatter.ExchangeTimeZoneRule.FlagsOffset);
     this.Start.Write(new ArraySegment <byte>(target.Array, target.Offset + O12TimeZoneFormatter.ExchangeTimeZoneRule.StartOffset, NativeMethods.SystemTime.Size));
     this.RegTimeZoneInfo.Write(new ArraySegment <byte>(target.Array, target.Offset + O12TimeZoneFormatter.ExchangeTimeZoneRule.RegTimeZoneInfoOffset, REG_TIMEZONE_INFO.Size));
     return(O12TimeZoneFormatter.ExchangeTimeZoneRule.Size);
 }
示例#21
0
        public override byte[] GetBytes()
        {
            byte[] array = new byte[16];
            ExBitConverter.Write(this.extensionGuid, array, 0);
            byte[] bytes  = base.MailboxOwnerId.GetBytes();
            byte[] array2 = new byte[array.Length + bytes.Length + 2];
            ExBitConverter.Write((short)bytes.Length, array2, 0);
            int num = 2;

            Array.Copy(bytes, 0, array2, num, bytes.Length);
            num += bytes.Length;
            Array.Copy(array, 0, array2, num, array.Length);
            return(array2);
        }
示例#22
0
 private static void SetCadataTtlCookie(AesCryptoServiceProvider aes, int flags, HttpRequest httpRequest, HttpResponse httpResponse)
 {
     using (ICryptoTransform cryptoTransform = aes.CreateEncryptor())
     {
         FbaModule.DetermineKeyIntervalsIfNecessary();
         bool       flag       = (flags & 4) == 4;
         bool       flag2      = FbaModule.IsMowa(httpRequest, flag);
         ExDateTime exDateTime = ExDateTime.UtcNow.AddTicks(flag2 ? FbaModule.fbaMowaKeyTTL.Ticks : (flag ? FbaModule.fbaPrivateKeyTTL.Ticks : FbaModule.fbaPublicKeyTTL.Ticks));
         byte[]     array      = new byte[9];
         ExBitConverter.Write(exDateTime.UtcTicks, array, 0);
         array[8] = (byte)flags;
         byte[] inArray = cryptoTransform.TransformFinalBlock(array, 0, array.Length);
         FbaModule.CreateAndAddCookieToResponse(httpRequest, httpResponse, "cadataTTL", Convert.ToBase64String(inArray));
     }
 }
示例#23
0
 public static void ExpandIdSet(IdSet idset, Action <byte[]> action)
 {
     foreach (GuidGlobCountSet guidGlobCountSet in idset)
     {
         foreach (GlobCountRange globCountRange in guidGlobCountSet.GlobCountSet)
         {
             for (ulong num = globCountRange.LowBound; num <= globCountRange.HighBound; num += 1UL)
             {
                 byte[] array     = new byte[22];
                 int    dstOffset = ExBitConverter.Write(guidGlobCountSet.Guid, array, 0);
                 Buffer.BlockCopy(IdConverter.GlobcntIntoByteArray(num), 0, array, dstOffset, 6);
                 action(array);
             }
         }
     }
 }
示例#24
0
        public static string GetDiagnosticContextFromThread()
        {
            if (!DiagnosticContext.HasData)
            {
                return(string.Empty);
            }
            byte[] array  = DiagnosticContext.PackInfo();
            byte[] array2 = new byte[array.Length + 6];
            int    num    = 0;

            ExBitConverter.Write(0, array2, num);
            num += 2;
            ExBitConverter.Write((uint)array.Length, array2, num);
            num += 4;
            Array.Copy(array, 0, array2, num, array.Length);
            return(string.Format("[diag::{0}]", Convert.ToBase64String(array2)));
        }
            public int ToBytes(ArraySegment <byte> target)
            {
                int size = this.GetSize();

                if (target.Count < size)
                {
                    throw new ArgumentOutOfRangeException();
                }
                ExBitConverter.Write((short)this.MajorVersion, target.Array, target.Offset + O12TimeZoneFormatter.ExchangeTimeZoneHeader.MajorVersionOffset);
                ExBitConverter.Write((short)this.MinVersion, target.Array, target.Offset + O12TimeZoneFormatter.ExchangeTimeZoneHeader.MinVersionOffset);
                ExBitConverter.Write(this.headerSize, target.Array, target.Offset + O12TimeZoneFormatter.ExchangeTimeZoneHeader.HeaderSizeOffset);
                ExBitConverter.Write(this.flags, target.Array, target.Offset + O12TimeZoneFormatter.ExchangeTimeZoneHeader.FlagsOffset);
                ExBitConverter.Write(this.KeyNameLength, target.Array, target.Offset + O12TimeZoneFormatter.ExchangeTimeZoneHeader.KeyNameLengthOffset);
                ExBitConverter.Write(this.KeyName, true, target.Array, target.Offset + O12TimeZoneFormatter.ExchangeTimeZoneHeader.KeyNameOffset);
                ExBitConverter.Write(this.RuleCount, target.Array, target.Offset + O12TimeZoneFormatter.ExchangeTimeZoneHeader.KeyNameOffset + (int)(this.KeyNameLength * 2));
                return(size);
            }
 public static void WriteAttachmentIds(IList <AttachmentId> attachmentIds, byte[] idBytes, int index)
 {
     if (attachmentIds != null)
     {
         if (attachmentIds.Count > 255)
         {
             throw new InvalidIdTooManyAttachmentLevelsException();
         }
         idBytes[index++] = (byte)attachmentIds.Count;
         for (int i = 0; i < attachmentIds.Count; i++)
         {
             byte[] array = attachmentIds[i].ToByteArray();
             index += ExBitConverter.Write((short)array.Length, idBytes, index);
             Array.Copy(array, 0, idBytes, index, array.Length);
             index += array.Length;
         }
     }
 }
示例#27
0
        private bool DoConnectionlessHandshake()
        {
            string command;

            byte [] data;

            this.connState = ConnectionState.Connecting;
            WriteConnectionlessPacket("getchallenge", null, 0, 0);

            if (ReadConnectionlessPacket(out command, out data))
            {
                if (command == "challengeResponse")
                {
                    this.challenge = Convert.ToInt32(Encoding.Default.GetString(data));

                    MemoryStream ms = new MemoryStream();
                    ms.Position = 2;
                    Q3HuffmanStream huff = new Q3HuffmanStream(ms, System.IO.Compression.CompressionMode.Compress);

                    string connStr = string.Format(@"\challenge\{0}\qport\{1}\protocol\{2}{3}",
                                                   this.challenge, this.qport, PROTOCOL_VERSION, userInfo);
                    huff.WriteString(connStr);
                    huff.Flush();
                    ms.Position = 0;
                    ms.Write(ExBitConverter.GetBytes(( short )connStr.Length, false), 0, 2);

                    this.connState = ConnectionState.Challenging;
                    WriteConnectionlessPacket("connect ", ms.GetBuffer(), 0, ( int )ms.Length);

                    if (ReadConnectionlessPacket(out command, out data))
                    {
                        if (command == "connectResponse")
                        {
                            this.connState = ConnectionState.Connected;
                            return(true);
                        }
                    }
                }
            }

            return(false);
        }
示例#28
0
        private static int RemoveEntriesWithProperty(int historyLength, byte[] buffer, OofHistory.PropId propId, byte[] propValue, long hashCode)
        {
            int  num = 6;
            int  currentEntryStart = 6;
            int  result            = 6;
            uint num2 = BitConverter.ToUInt32(buffer, 2);

            if (10000U < num2)
            {
                num2 = 10000U;
            }
            uint num3 = num2;

            for (uint num4 = 0U; num4 < num2; num4 += 1U)
            {
                if (num >= historyLength)
                {
                    OofHistory.HandleInsufficientDataCorruption(hashCode, "Unable to get property count of entry " + num4);
                    return(result);
                }
                byte propertyCount = buffer[num++];
                bool flag;
                if (OofHistory.MatchAnyPropertiesInEntry(buffer, propId, propValue, propertyCount, historyLength, num4, hashCode, ref num, out flag))
                {
                    num3 -= 1U;
                }
                else
                {
                    if (flag)
                    {
                        return(result);
                    }
                    OofHistory.HandleNonMatchingProperty(buffer, num, currentEntryStart, ref result);
                }
                currentEntryStart = num;
            }
            if (num3 < num2)
            {
                ExBitConverter.Write(num3, buffer, 2);
            }
            return(result);
        }
示例#29
0
        public override void Write(byte [] buffer, int offset, int count)
        {
            if (msWriteBuffer.Position == 0)
            {
                if (writePacketKind == PacketKind.Connectionless)
                {
                    msWriteBuffer.Write(new byte [4] {
                        0xff, 0xff, 0xff, 0xff
                    }, 0, 4);
                }
                else if (writePacketKind == PacketKind.ConnectionOriented)
                {
                    msWriteBuffer.Write(ExBitConverter.GetBytes(connection.OutgoingSequence, true), 0, 4);
                    msWriteBuffer.Write(ExBitConverter.GetBytes(connection.QPort, true), 0, 2);
                    connection.OutgoingSequence++;
                }
            }

            msWriteBuffer.Write(buffer, offset, count);
        }
示例#30
0
        public byte[] ToByteArray()
        {
            short num = 0;

            if (this.attachKey != null)
            {
                num = (short)this.attachKey.Length;
            }
            int num2 = (int)(2 + num);

            byte[] array = new byte[num2];
            int    num3  = 0;

            num3 += ExBitConverter.Write(num, array, num3);
            if (this.attachKey != null)
            {
                this.attachKey.CopyTo(array, num3);
            }
            return(array);
        }