Exemplo n.º 1
0
 /// <summary>
 /// This method writes the commit point data in the correct format
 /// for the current version to the specified byte array.
 /// </summary>
 /// <param name="commitPointData"></param>
 private void WriteCommitPointData(byte[] commitPointData)
 {
     BitConverter.GetBytes(VersionNumber).CopyTo(commitPointData, 0);
     BitConverter.GetBytes(CommitNumber).CopyTo(commitPointData, 4);
     BitConverter.GetBytes(LocationOffset).CopyTo(commitPointData, 12);
     BitConverter.GetBytes(CommitTime.Ticks).CopyTo(commitPointData, 20);
     JobId.ToByteArray().CopyTo(commitPointData, 28);
 }
Exemplo n.º 2
0
 public int Save(BinaryWriter dataStream, ulong offset = 0u)
 {
     dataStream.Write(VersionNumber);              // 4 bytes
     dataStream.Write(JobId.ToByteArray());        // 16 bytes
     dataStream.Write(TransactionStartTime.Ticks); // 8 bytes
     dataStream.Write((int)TransactionType);       // 4 bytes
     dataStream.Write((int)TransactionStatus);     // 4 bytes
     dataStream.Write(DataStartPosition);          // 8 bytes
     dataStream.Write(DataLength);                 // 8 bytes
     return(TransactionInfoRecordSize);
 }
Exemplo n.º 3
0
        public byte[] ToBytes()
        {
            using (var memoryStream = new MemoryStream())
            {
                memoryStream.WriteByte((byte)PaketNumber);   // 1 Byte
                memoryStream.WriteByte((byte)PaketMaxCount); // 1 Byte
                var groupIdBuffer = PaketGroupId.ToByteArray();
                var jobIdBuffer   = JobId.ToByteArray();
                memoryStream.Write(groupIdBuffer, 0, groupIdBuffer.Length); // 16 Bytes
                memoryStream.Write(jobIdBuffer, 0, jobIdBuffer.Length);     // 16 Bytes
                memoryStream.WriteByte((byte)PaketType);                    // 1 Byte
                memoryStream.WriteByte((byte)PaketPosition);                // 1 Byte
                if (Data != null)
                {
                    memoryStream.Write(Data, 0, Data.Length); //
                }

                return(memoryStream.ToArray());
            }
        }