public static void InitializeConfig()
        {
            TryMigrate();
            // init defaults
            GeneralConfig.SetDefaults();
            GeneralConfig.hwid = SystemSpecs.GetCpuID();
            // load file if it exist
            var fromFile = InternalConfigs.ReadFileSettings <GeneralConfig>(GeneralConfigPath);

            if (fromFile != null)
            {
                var asmVersion = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version;
                if (fromFile.ConfigFileVersion != null && asmVersion.CompareTo(fromFile.ConfigFileVersion) != 0)
                {
                    Logger.Info(Tag, "Config file is differs from version of NiceHashMiner... Creating backup archive");
                    CreateBackupArchive(fromFile.ConfigFileVersion);
                }
                if (fromFile.ConfigFileVersion != null)
                {
                    // set config loaded from file
                    _isGeneralConfigFileInit = true;
                    GeneralConfig            = fromFile;
                    GeneralConfig.FixSettingBounds();
                }
                else
                {
                    Logger.Info(Tag, "Loaded Config file no version detected falling back to defaults.");
                }
            }
            else
            {
                GeneralConfigFileCommit();
            }
        }
        // EnsureSystemRequirements will check if all system requirements are met if not it will show an error/warning message box and exit the application
        // TODO this one holds
        public static bool SystemRequirementsEnsured()
        {
            // check WMI
            if (!SystemSpecs.IsWmiEnabled())
            {
                MessageBox.Show(Tr("{0} cannot run needed components. It seems that your system has Windows Management Instrumentation service Disabled. In order for {0} to work properly Windows Management Instrumentation service needs to be Enabled. This service is needed to detect RAM usage and Avaliable Video controler information. Enable Windows Management Instrumentation service manually and start {0}.", NHMProductInfo.Name),
                                Tr("Windows Management Instrumentation Error"),
                                MessageBoxButtons.OK, MessageBoxIcon.Error);

                return(false);
            }

            if (!Helpers.Is45NetOrHigher())
            {
                MessageBox.Show(Tr("{0} requires .NET Framework 4.5 or higher to work properly. Please install Microsoft .NET Framework 4.5", NHMProductInfo.Name),
                                Tr("Warning!"),
                                MessageBoxButtons.OK);

                return(false);
            }

            if (!Helpers.Is64BitOperatingSystem)
            {
                MessageBox.Show(Tr("{0} supports only x64 platforms. You will not be able to use {0} with x86", NHMProductInfo.Name),
                                Tr("Warning!"),
                                MessageBoxButtons.OK);

                return(false);
            }

            return(true);
        }
Esempio n. 3
0
        public SystemSpecs AddSpecs(FileData data)
        {
            SystemSpecs ss = new SystemSpecs(data);

            systemSpecsDictionary[data.Name] = ss;
            return(ss);
        }
Esempio n. 4
0
        public void SystemSpecs_create_with_filedata_with_two_rows_assert_dataview_count_is_two()
        {
            FileData    fd = Util.createData("testData1");
            SystemSpecs ss = new SystemSpecs(fd);

            Assert.AreEqual(ss.DataView.Count, 2, "Count is: " + ss.DataView.Count);
        }
        public static bool SystemRequirementsEnsured()
        {
            if (!SystemSpecs.IsWmiEnabled())
            {
                MessageBox.Show(ViProductInfo.Name + " không thể chạy các thành phần cần thiết. Có vẻ như hệ thống của bạn đã tắt service Windows Management. Để cho " + ViProductInfo.Name + " để hoạt động bình thường, service Windows Management cần được Bật. Service này là cần thiết để phát hiện việc sử dụng RAM và thông tin về bộ điều khiển. Bật service Windows Management theo cách thủ công và bắt đầu " + ViProductInfo.Name + ".",
                                "Lỗi Windows Management",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);

                return(false);
            }

            if (!Helpers.Is45NetOrHigher())
            {
                MessageBox.Show(ViProductInfo.Name + " yêu cầu .NET Framework 4.5 trở lên để hoạt động bình thường. Vui lòng cài đặt Microsoft .NET Framework 4.5",
                                "Cảnh báo!",
                                MessageBoxButtons.OK);

                return(false);
            }

            if (!Helpers.Is64BitOperatingSystem)
            {
                MessageBox.Show(ViProductInfo.Name + " chỉ hỗ trợ thiết bị x64. Bạn không thể sử dụng " + ViProductInfo.Name + " với x86",
                                "Cảnh báo!",
                                MessageBoxButtons.OK);

                return(false);
            }

            return(true);
        }
Esempio n. 6
0
        public string SystemSpecs_return_string_from_row_col(int row, int col)
        {
            FileData    fd       = Util.createData("testData1");
            SystemSpecs ss       = new SystemSpecs(fd);
            var         testData = ss.DataView.Table.Rows[row][col];

            return(testData.ToString());
        }
Esempio n. 7
0
        public void SystemSpecsService_get_first_element_FirstLast_equal_false()
        {
            SystemSpecsService sss = new SystemSpecsService();
            FileData           fd  = Util.createData("testData");

            SystemSpecs ss = sss.AddSpecs(fd);

            Assert.AreEqual(sss.GetSpecs("testData").FirstLast, false);
        }
Esempio n. 8
0
        public void SystemSpecsService_addspecs_getSysInfo_get_employee_count_equal_2()
        {
            SystemSpecsService sss = new SystemSpecsService();
            FileData           fd  = Util.createData("testData");

            SystemSpecs ss = sss.AddSpecs(fd);

            Assert.AreEqual(sss.GetSysInfo()[0].Employees.Count, 2);
        }
Esempio n. 9
0
 public PositionConfigTabItemViewModel(SystemSpecs sysSpecs)
 {
     ColumnPOI = new ObservableCollection <string>(SystemSpecs.POIOptions);
     //ColumnPOI = new ObservableCollection<string>() { "NA", "Full Name", "ID", "First Name", "Last Name" };
     ComboBoxCommand       = new DelegateCommand <SelectionChangedEventArgs>(comboBoxCommand);
     ComboBoxLoadedCommand = new DelegateCommand <RoutedEventArgs>(comboBoxLoadedCommand);
     systemSpecs           = sysSpecs;
     SpreadSheet           = sysSpecs.DataView;
 }
Esempio n. 10
0
        public void QueryResult_ShouldMatch()
        {
            var query = new AmdQueryDummy();

            query.QueryOpenCLDevices();

            SystemSpecs.QueryVideoControllers();

            var amdDevs = query.QueryAmd(out var failedDriverCheck);

            Assert.AreEqual(5, amdDevs.Count);

            for (var i = 0; i < amdDevs.Count; i++)
            {
                Assert.AreEqual(i, amdDevs[i].ID);
            }

            Assert.AreEqual(4, amdDevs[0].IDByBus);
            Assert.AreEqual(1, amdDevs[1].IDByBus);
            Assert.AreEqual(0, amdDevs[2].IDByBus);
            Assert.AreEqual(3, amdDevs[3].IDByBus);
            Assert.AreEqual(2, amdDevs[4].IDByBus);
        }
Esempio n. 11
0
 /// <summary>
 /// Show system specifications
 /// </summary>
 private void btnShowSpecs_Click(object sender, RoutedEventArgs e)
 {
     MessageBox.Show(SystemSpecs.SystemDetails(), "System Specifications", MessageBoxButton.OK, MessageBoxImage.Information);
 }