public void SetUp()
 {
     _volumeSerial = 1;
     _environment  = Substitute.For <IEnvironment>();
     _kernel32     = Substitute.For <IKernel32>();
     _kernel32.GetSystemVolumeSerial().Returns(x => _volumeSerial);
 }
Exemplo n.º 2
0
        public string GetMachineId()
        {
            var systemVolumeSerial = _kernel32.GetSystemVolumeSerial();
            var windowsProductId   = GetWindowsProductId();
            var id = new MachinId(systemVolumeSerial, windowsProductId);

            return(id.CalculateMachineHash());
        }
Exemplo n.º 3
0
        public string GetMachineId()
        {
            var machineName  = GetSanitizedMachineName();
            var volumeSerial = _kernel32.GetSystemVolumeSerial().ToString("X8");
            var machineHash  = MachineId.GetSha1Hash(machineName + volumeSerial);

            return($"{machineHash}");
        }