コード例 #1
0
        public void UnityGuidToGUID()
        {
            UnityGuid guidUnity = new UnityGuid("394ada038ba04f26b0011a6cdeb05a62");
            Guid      guidCs    = new Guid("394ada038ba04f26b0011a6cdeb05a62");

            Assert.AreEqual(guidCs, guidUnity.ToGuid());
        }
コード例 #2
0
        public void UnityGuidFromString()
        {
            UnityGuid guidlc = new UnityGuid("394ada038ba04f26b0011a6cdeb05a62");
            UnityGuid guiduc = new UnityGuid("394ADA038BA04F26B0011A6CDEB05A62");

            byte[] expected = new byte[] { 0x93, 0xa4, 0xad, 0x30, 0xb8, 0x0a, 0xf4,
                                           0x62, 0x0b, 0x10, 0xa1, 0xc6, 0xed, 0x0b, 0xa5, 0x26 };

            unsafe
            {
                Assert.AreEqual(16, sizeof(UnityGuid));

                byte *plc = (byte *)&guidlc;
                byte *puc = (byte *)&guiduc;
                for (int i = 0; i < 16; i++)
                {
                    Assert.AreEqual(plc[i], expected[i]);
                    Assert.AreEqual(puc[i], expected[i]);
                }
            }
        }