public static CompleteDevice GetCompleteInfo()
        {
            CompleteDevice cpd = new CompleteDevice();

            if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
            {
                cpd.Device            = WinDeviceInfo.GetDeviceInfo();
                cpd.OperativeSystem   = WinOperativeSystemInfo.GetOperativeSystemInfo();
                cpd.Hardware          = WinHardwareInfo.GetHardwareInfo();
                cpd.InstalledSoftware = WinInstalledSoftwareInfo.GetInstalledSoftwareInfo();
            }
            else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
            {
            }
            else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
            {
            }


            return(cpd);
        }
Example #2
0
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");
            ServiceCollection serviceCollection = new ServiceCollection();

            Conf.ConfigureServices(serviceCollection);
            IServiceProvider serviceProvider = serviceCollection.BuildServiceProvider();

            /*var builder = new ConfigurationBuilder()
             * .AddJsonFile($"settings.json", true, true)
             * //.AddJsonFile($"appsettings.{environmentName}.json", true, true)
             * .AddEnvironmentVariables();
             * var configuration = builder.Build();*/
            //var myConnString = Conf.Configuration.GetSection("AzureFunction").Value;


            CompleteDevice dev = null;

            if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
            {
                dev = CompleteDeviceInfo.GetCompleteInfo();
            }
            else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
            {
            }
            else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
            {
            }

            WaitToHaveInternet();


            string jsonString = JsonConvert.SerializeObject(dev);

            File.WriteAllTextAsync("result.json", jsonString, Encoding.UTF8);
            //Console.WriteLine(jsonString);
        }