public void FromBytes(byte[] bytes) { using (var stream = new MemoryStream(bytes, false)) using (var reader = new BinaryReader(stream)) { Type = (WinBioIdentityType)reader.ReadInt32(); switch (Type) { case WinBioIdentityType.Null: Null = reader.ReadInt32(); break; case WinBioIdentityType.Wildcard: Wildcard = reader.ReadInt32(); break; case WinBioIdentityType.GUID: TemplateGuid = new Guid(reader.ReadBytes(16)); break; case WinBioIdentityType.SID: AccountSidSize = reader.ReadInt32(); AccountSid = new SecurityIdentifier(reader.ReadBytes(AccountSidSize), 0); break; default: throw new ArgumentOutOfRangeException(); } } }
public void FromBytes(byte[] bytes) { using (var stream = new MemoryStream(bytes, false)) using (var reader = new BinaryReader(stream)) { Type = (WinBioIdentityType)reader.ReadInt32(); switch (Type) { case WinBioIdentityType.Null: Null = reader.ReadInt32(); break; case WinBioIdentityType.Wildcard: Wildcard = reader.ReadInt32(); break; case WinBioIdentityType.GUID: TemplateGuid = new Guid(reader.ReadBytes(16)); break; case WinBioIdentityType.SID: AccountSidSize = reader.ReadInt32(); AccountSid = new SecurityIdentifier(reader.ReadBytes(AccountSidSize), 0); break; default: throw new ArgumentOutOfRangeException(); } } }