Пример #1
0
        public static string Get_ConnectionString()
        {
            RegistryControl RegControl = new RegistryControl();

            communication = RegControl.get_setting();
            return(communication.dbString);
        }
Пример #2
0
 //Save Settings for Server
 public bool Save_Setting(CommunicationModel communicationmodel)
 {
     try
     {
         var json = JsonConvert.SerializeObject(communicationmodel);
         Regkey = Registry.CurrentUser.OpenSubKey("Software", true);
         Regkey.SetValue("Communication", Encrypt_Fun(json));
         Regkey.Close();
         return(true);
     }
     catch
     {
         return(false);
     }
 }
Пример #3
0
        //Get Setting from registry
        //Key:  CenterLab-2021
        //serverName: localhost
        //DatabaseName: Centersys
        //userName: user
        //Password: 192837465

        public CommunicationModel get_setting()
        {
            try
            {
                Regkey = Registry.CurrentUser.OpenSubKey("Software", true);
                CommunicationModel Json = JsonConvert.DeserializeObject <CommunicationModel>(Decryption_Fun(Regkey.GetValue("Communication").ToString()));
                Regkey.Close();
                return(Json);
            }

            catch
            {
                //  ConfigClass.log.Error($"E {ex.Message}");
                return(new CommunicationModel());
            }
        }