Many thanks to @thedutchman for writing down the code for converting and replacing adjacent characters. I combined your code and the code in this link and created a new function, as shown below:
public static string ConvertAndSwapHex(string hexString) { var charString = new StringBuilder(); for (var i = 0; i < hexString.Length; i += 4) { charString.Append(Convert.ToChar(Convert.ToUInt32(hexString.Substring(i + 2, 2), 16))); charString.Append(Convert.ToChar(Convert.ToUInt32(hexString.Substring(i, 2), 16))); } return charString.ToString(); }
Another important thing, as mentioned in this forum for Microsoft , using Win32_DiskDrive instead of Win32_PhysicalMedia sequentially returns the zinxed serial number in Win 7 for admin and non-admin users. Despite the fact that it returns completely different things to WinXP (which we no longer support for our software), sequentially returning the smoothing serial number is good enough for me. You know that I donโt need to check the length of the serial number to determine if I need to use the above ConvertAndSwap method or not.
source share