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); }
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); } }