Example #1
0
        public bool ValidateLicence()
        {
            try
            {
                string sFolderPath = Assembly.GetExecutingAssembly().Location;

                if (sFolderPath != string.Empty)
                {
                    sFolderPath = Path.GetDirectoryName(sFolderPath);

                    sFolderPath = Path.Combine(sFolderPath, m_csLicenceFileName);

                    if (File.Exists(sFolderPath) == false)
                    {
                        throw new Exception("Cannot find acclicence.dat file in Trimble Enterprise Estimating folder. 883e5b41-3c6f-4e96-8afb-6ca797b0aa9c");
                    }
                }
                else
                {
                    throw new Exception("Cannot find acclicence.dat file in Trimble Enterprise Estimating folder. 19f633d8-17e6-4810-a00b-2c1f2c62973b");
                }

                byte[] ba = File.ReadAllBytes(sFolderPath);

                if ((ba == null) || (ba.Length == 0))
                {
                    throw new Exception("Could not read the acclicence.dat file. 2c0c6c5f-c6cb-406e-beac-725566502b53");
                }

                string sPlainText = AESEncription.DecryptStringFromBytes(ba, m_btKey, m_btIV);

                sPlainText = sPlainText.Replace(m_sOne, "");
                sPlainText = sPlainText.Replace(m_sTwo, "");

                string sComputerMetrics = ComputerMetrics.GetComputerUniqueID();

                return(sComputerMetrics == sPlainText);
            }
            catch (Exception exp)
            {
                Logger.WriteError(exp, "2f6ff5ea-0809-4d14-a6ff-57b112ca4601");
            }

            return(false);
        }
Example #2
0
        public string GetComputerUniqueID()
        {
            try
            {
                progressBar.Maximum = 6;
                progressBar.Visible = true;

                StringBuilder sb = new StringBuilder();

                sb.AppendLine("MachineName_" + Environment.MachineName);

                progressBar.CustomText = "CPU ID";
                progressBar.PerformStep();
                sb.Append(ComputerMetrics.CPUID());

                progressBar.CustomText = "BIOS ID";
                progressBar.PerformStep();
                sb.Append(ComputerMetrics.BIOSID());

                progressBar.CustomText = "Disk ID";
                progressBar.PerformStep();
                sb.Append(ComputerMetrics.DiskID());

                progressBar.CustomText = "BaseBoard ID";
                progressBar.PerformStep();
                sb.Append(ComputerMetrics.BaseID());

                progressBar.CustomText = "VideoController ID";
                progressBar.PerformStep();
                sb.Append(ComputerMetrics.VideoID());

                progressBar.CustomText = "NetworkAdapterConfiguration ID";
                progressBar.PerformStep();
                sb.Append(ComputerMetrics.MACID());

                return(sb.ToString());
            }
            catch (Exception exp)
            {
                Logger.WriteErrorLogOnly(exp, "c3f3dc42-36e6-4892-8834-4bdc6bdb1d1d");
            }

            return(string.Empty);
        }
Example #3
0
        private void CollectAllInfo(string _sFilePath)
        {
            try
            {
                string sInfo = string.Empty;
                progressBar.Visible = true;

                foreach (ComputerInfoKeysFull eVal in Enum.GetValues(typeof(ComputerInfoKeysFull)))
                {
                    progressBar.CustomText = eVal.ToString().Replace("Win32_", "");
                    progressBar.PerformStep();

                    if (ComputerMetrics.GetOneKeyInfo(eVal.ToString(), out sInfo) == true)
                    {
                        File.AppendAllText(_sFilePath, sInfo);
                    }
                }
            }
            catch (Exception exp)
            {
                Logger.WriteErrorLogOnly(exp, "99aabef5-82d9-4034-ab3e-07d4bf44c839");
            }
        }
Example #4
0
        private void CollectSubSetInfo(string _sFilePath)
        {
            try
            {
                string sInfo = string.Empty;
                progressBar.Visible = true;

                foreach (ComputerInfoKeys eVal in Enum.GetValues(typeof(ComputerInfoKeys)))
                {
                    progressBar.CustomText = eVal.ToString().Replace("Win32_", "");
                    progressBar.PerformStep();

                    if (ComputerMetrics.GetOneKeyInfo(eVal.ToString(), out sInfo) == true)
                    {
                        File.AppendAllText(_sFilePath, sInfo);
                    }
                }
            }
            catch (Exception exp)
            {
                Logger.WriteErrorLogOnly(exp, "6be88bde-ab49-44b9-b8da-3e5650bbb95f");
            }
        }
Example #5
0
        private void buttonStart_Click(object sender, EventArgs e)
        {
            try
            {
                progressBar.PerformStep();
                progressBar.Minimum = 1;
                progressBar.Step    = 1;

                EnableControls(false);

                progressBar.Maximum = 6;
                progressBar.Visible = true;

                textEdit.Text = ComputerMetrics.GetComputerUniqueID(PerformProgressBarStep);
            }
            catch (Exception exp)
            {
                Logger.WriteErrorLogOnly(exp, "2b8f6ffe-3229-4692-a3a7-e8b128f38c27");
            }
            finally
            {
                EnableControls(true);
            }
        }