public static RoomSpec FromGuid(Guid g) { if (g == Guid.Empty) return null; try { RoomSpec r = new RoomSpec(); byte[] bytes = g.ToByteArray(); r.Version = (int)bytes[0]; if (r.Version == 1) { r.RoomType = (RoomType)(int)bytes[1]; r.ObjectType = (Model.Entities.ObjectType)(int)bytes[2]; r.ObjectK = BitConverter.ToInt32(new byte[] { bytes[3], bytes[4], bytes[5], bytes[6] }, 0); r.SecondObjectType = (Model.Entities.ObjectType)(int)bytes[7]; r.SecondObjectK = BitConverter.ToInt32(new byte[] { bytes[8], bytes[9], bytes[10], bytes[11] }, 0); byte[] hash = r.getHash().ToByteArray(); if (bytes[12] != hash[0] || bytes[13] != hash[1] || bytes[14] != hash[2] || bytes[15] != hash[3]) return null; return r; } else return null; } catch { return null; } }