コード例 #1
0
        public void ToGuidTest()
        {
            BITS.GUID bitsGuid   = MakeGuid(0xF0000001, 0xF002, 0xF003);
            Guid      dotNetGuid = bitsGuid.ToGuid();
            string    text       = dotNetGuid.ToString();

            Assert.AreEqual("f0000001-f002-f003-0001-020304050607", text);
        }
コード例 #2
0
        public static Guid ToGuid(this BITS.GUID guid)
        {
            // BITS.GUID defines all the fields to be unsigned
            // The .NET Guid constructor uses signed values
            Guid newGuid = new Guid((int)guid.Data1, (short)guid.Data2, (short)guid.Data3, guid.Data4);

            return(newGuid);
        }
コード例 #3
0
 private BITS.GUID MakeGuid(uint data1, ushort data2, ushort data3, byte b0 = 0, byte b1 = 1, byte b2 = 2, byte b3 = 3, byte b4 = 4, byte b5 = 5, byte b6 = 6, byte b7 = 7)
 {
     BITS.GUID bitsGuid = new BITS.GUID();
     bitsGuid.Data1 = data1;
     bitsGuid.Data2 = data2;
     bitsGuid.Data3 = data3;
     bitsGuid.Data4 = new byte[8] {
         b0, b1, b2, b3, b4, b5, b6, b7
     };
     return(bitsGuid);
 }
コード例 #4
0
        public static bool GuidEquals(this BITS.GUID a, BITS.GUID b)
        {
            var areEquals = a.ToGuid().Equals(b.ToGuid());

            return(areEquals);
        }