using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace DTS.Common.Utilities { /// /// produces a long value given a firmware version in string representation /// public class FirmwareVersionToLong { /// /// Produces a long value given a firmware version represented as a string /// /// firmware version /// firmware version as a long public static long Query(string version) { var result = 0L; var chars = version.Length > 4 ? 4 : version.Length; var shift = 48; for (var i = 0; i < chars; i++) { result += version[i] << shift; shift -= 16; } return result; } } }