コード例 #1
0
 /// <summary>
 /// Exports the current header to a 1024 byte array
 /// </summary>
 /// <remarks>
 /// This will not validate the disk or update the header.
 /// Use <see cref="Validate"/> and <see cref="ComputeChecksum"/> before exporting
 /// </remarks>
 /// <returns>Raw header data</returns>
 public byte[] Export()
 {
     using (var MS = new MemoryStream())
     {
         using (var BW = new BinaryWriter(MS))
         {
             BW.Write(Encoding.Default.GetBytes(Cookie));
             BW.Write(Tools.ToNetwork(DataOffset));
             BW.Write(Tools.ToNetwork(TableOffset));
             BW.Write(Tools.ToNetwork((ushort)HeaderVersion.Major));
             BW.Write(Tools.ToNetwork((ushort)HeaderVersion.Minor));
             BW.Write(Tools.ToNetwork(MaxTableEntries));
             BW.Write(Tools.ToNetwork(BlockSize));
             BW.Write(Tools.ToNetwork(Checksum));
             BW.Write(ParentUniqueId.ToByteArray());
             BW.Write(Tools.ToNetwork((uint)VHD.ToDiskTimestamp(ParentTimeStamp)));
             BW.Write(Reserved1);
             BW.Write(Encoding.Unicode.GetBytes(ParentUnicodeName));
             foreach (var E in ParentLocatorEntries)
             {
                 BW.Write(E.Export());
             }
             BW.Write(Reserved2);
             BW.Flush();
             return(MS.ToArray());
         }
     }
 }
コード例 #2
0
 public string ToStringForFinestLogging()
 {
     return($"Id={UniqueId},ParentId={ParentUniqueId?.ToString() ?? "Root"},Name={Data.GetTransactionTraceName()},IsLeaf={IsLeaf},Combinable={Combinable},MethodCallData={MethodCallData}");
 }