Beispiel #1
0
        /// <summary>
        /// Loads local settings from configuration file
        /// </summary>
        public void LoadLocalSettings()
        {
            try
            {
                FileDataManager fdm = new FileDataManager(this);

                #region MySQL settings
                //MYSQL SETTINGS
                string server = fdm.GetValueByKey("mysql_server");
                int    port   = 3306;
                Int32.TryParse(fdm.GetValueByKey("mysql_port"), out port);
                string database      = fdm.GetValueByKey("mysql_database");
                string user          = fdm.GetValueByKey("mysql_user");
                string passEncrypted = fdm.GetValueByKey("mysql_pass");
                string passDecrypted =
                    (
                        !String.IsNullOrWhiteSpace(passEncrypted) ?
                        Crypto.DecryptStringAES(passEncrypted, GlobalData.PassKey) :
                        ""
                    );

                SetMySqlSettings
                (
                    server,
                    port,
                    database,
                    user,
                    passDecrypted
                );

                #endregion

                #region TCP connection settings
                //TCP CONN. SETTINGS
                string tcpIp   = fdm.GetValueByKey("tcp_ip");
                int    tcpPort = 2222;
                Int32.TryParse(fdm.GetValueByKey("tcp_port"), out tcpPort);

                SetTcpConnectionSettings(tcpIp, tcpPort);

                #endregion
            }
            catch (Exception exception)
            {
                UpdateLog($"An error occured during mySQL settings loading: {exception.Message}");
            }
        }