Example #1
0
        static HardwareIdentifier()
        {
#if NET5_0
            if (OperatingSystem.IsWindows())
#endif
            theComputerCharacteristics = new WindowsComputerCharacteristics();
        }
Example #2
0
        static HardwareIdentifier()
        {
            var interfaceType   = typeof(IComputerCharacteristics);
            var currentAssembly = typeof(HardwareIdentifier).Assembly;
            var type            = currentAssembly.GetTypes().Where(p => interfaceType.IsAssignableFrom(p) && p.IsClass).FirstOrDefault();

            if (type != null)
            {
                theComputerCharacteristics = (IComputerCharacteristics)Activator.CreateInstance(type);
            }
        }
Example #3
0
 /// <summary>
 /// Sets the <see cref="IComputerCharacteristics"/> implementation to use.
 /// </summary>
 /// <remarks>
 /// Not that the implementation depends on the actual OS. If no implementation is set, some methods like
 /// <see cref="ForCurrentComputer"/> and <see cref="IsValidForCurrentComputer(string)"/> throw an exception.
 /// </remarks>
 /// <param name="computerCharacteristics">
 /// An implementation of <see cref="IComputerCharacteristics"/>.
 /// </param>
 public static void SetComputerCharacteristics(IComputerCharacteristics computerCharacteristics)
 {
     theComputerCharacteristics = computerCharacteristics;
 }