MatthewKing / DeviceId

A simple library providing functionality to generate a 'device ID' that can be used to uniquely identify a computer.
MIT License
722 stars 118 forks source link

Migration to v6 #45

Closed bastianonm closed 2 years ago

bastianonm commented 2 years ago

Hello, I recently migrated your library to version 6. With big disappointing I can't get the same result as version 5. This is my code:

// old code
         string deviceIdV5 = new DeviceIdBuilder()
               .AddSystemUUID()
               .AddProcessorId()
               .AddMotherboardSerialNumber()
               .AddSystemDriveSerialNumber()
               .ToString();
// new code
            string deviceIdV6 = new DeviceIdBuilder()
                .OnWindows(w => w
                    .AddSystemUuid()
                    .AddProcessorId()
                    .AddMotherboardSerialNumber()
                    .AddSystemDriveSerialNumber()
                    )
                .OnLinux(l => l
                    .AddCpuInfo()
                    .AddMachineId()
                    .AddProductUuid()
                    .AddMotherboardSerialNumber()
                    .AddSystemDriveSerialNumber()
                    )
                .ToString();

Is there a way to get the new code generate the same value as the old one?

MatthewKing commented 2 years ago

Hello,

The default formatter changed between v5 and v6.

Try adding: .UseFormatter(DeviceIdFormatters.DefaultV5)

See screenshot for more info:

image

bastianonm commented 2 years ago

Thanks for the support, it works perfectly!