private static bool LicenceIsValid() { return(RegistryOperator.IsKeyExist("ActivationKey") && RegistryOperator.IsKeyExist("SerialNumber") && Aes.Decrypt(RegistryOperator.GetKey("ActivationKey"), HardwareInfo.GetHddSerialNo(), 256) .Equals(RegistryOperator.GetKey("SerialNumber"))); }
private bool RegistryConnectionStringChecker() { if (RegistryOperator.IsKeyExist("ConnectionString")) { DataBaseConnection.MainConnectionString = Aes.Decrypt(RegistryOperator.GetKey("ConnectionString"), HardwareInfo.GetProcessorId(), 256); return(true); } MessageBox.Show("رشته اتصالی وجود ندارد"); ShowConnectionWindow(); return(false); }
private void BtnOk_Click(object sender, RoutedEventArgs e) { var activationKey = Aes.Encrypt(TxtSerial.Text.Trim(), TxtHardwareSerial.Text, 256); TxtActivation.Text = activationKey; if (TxtActivation.Text.Equals(activationKey)) { RegistryOperator.CreateKey("SerialNumber", TxtSerial.Text.Trim()); RegistryOperator.CreateKey("ActivationKey", activationKey); DialogResult = true; } Window_Reset(); }
private void ShowConnectionWindow() { using SetConnectionWindow connectionWindow = new SetConnectionWindow() { Owner = this }; if (connectionWindow.ShowDialog().Equals(true)) { DataBaseConnection.MainConnectionString = Aes.Decrypt(RegistryOperator.GetKey("ConnectionString"), HardwareInfo.GetProcessorId(), 256); } connectionWindow.Dispose(); connectionWindow.Close(); }
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(); } }
/// <summary> /// 获得已安装的UMP安装包及其信息 /// </summary> private void GetAppsInstalled() { App.dicAppInstalled.Clear(); Dictionary <string, string> dicAppGUIDs = new Dictionary <string, string>(); dicAppGUIDs.Add(ConstDefines.UMPAlarmServer, ConstDefines.UMPAlarmServerGUID); dicAppGUIDs.Add(ConstDefines.UMPAlarmClient, ConstDefines.UMPAlarmClientGUID); dicAppGUIDs.Add(ConstDefines.UMPLicenseManager, ConstDefines.UMPLicenseManagerGUID); dicAppGUIDs.Add(ConstDefines.UMPAgentClient, ConstDefines.UMPAgentClientGUID); dicAppGUIDs.Add(ConstDefines.UMPCMServer, ConstDefines.UMPCMServerGUID); dicAppGUIDs.Add(ConstDefines.UMPCQC, ConstDefines.UMPCQCGUID); dicAppGUIDs.Add(ConstDefines.UMPCTIHub, ConstDefines.UMPCTIHubGUID); dicAppGUIDs.Add(ConstDefines.UMPDEC, ConstDefines.UMPDECGUID); dicAppGUIDs.Add(ConstDefines.UMPLicenseServer, ConstDefines.UMPLicenseServerGUID); dicAppGUIDs.Add(ConstDefines.UMPScreenServer, ConstDefines.UMPScreenServerGUID); dicAppGUIDs.Add(ConstDefines.UMPSoftRecord, ConstDefines.UMPSoftRecordGUID); dicAppGUIDs.Add(ConstDefines.UMPSpeechAnalysis, ConstDefines.UMPSpeechAnalysisGUID); dicAppGUIDs.Add(ConstDefines.IxPatch, ConstDefines.IxPatchGUID); //dicAppGUIDs.Add(Defines.VCLogWebSDK, Defines.VCLogWebSDKGUID); dicAppGUIDs.Add(ConstDefines.UMPVoice, ConstDefines.UMPVoiceGUID); dicAppGUIDs.Add(ConstDefines.ASM, ConstDefines.ASMGUID); dicAppGUIDs.Add(ConstDefines.UMP, ConstDefines.UMPGUID); dicAppGUIDs.Add(ConstDefines.UMPSFTP, ConstDefines.UMPSFTPGUID); OperationReturn optReturn = null; UMPAppInfo info = null; foreach (KeyValuePair <string, string> item in dicAppGUIDs) { optReturn = RegistryOperator.GetAppInfoByGUID(item.Value); if (!optReturn.Result) { App.WriteLog("App " + item.Key + " not installed"); continue; } info = optReturn.Data as UMPAppInfo; App.dicAppInstalled.Add(info.AppName, info); } }