Пример #1
0
        public static string ConnectionString()
        {
            //return License.ConnectingSring();
            //string strfile = Application.StartupPath + "\\EpointConfig.epoint";
            string strConnection = string.Empty;
            string strfile       = Application.StartupPath + "\\" + Element.sysConfigFile;

            if (!File.Exists(strfile))
            {
                MessageBox.Show("File config doesn't exist!");
            }
            using (StreamReader sr = new StreamReader(strfile))
            {
                string strConnect = sr.ReadToEnd();
                try
                {
                    strConnection = License.DecryptString(strConnect, Collection.DecryptConnectionString);
                    DataTool.sysConnectionString           = strConnection;
                    DataElement.sysConnectionString        = strConnection;
                    DataElement.sysConnectionStringEncrypt = strConnect;
                    return(strConnection);
                }
                catch
                {
                    MessageBox.Show("Config database error!");
                    Application.Exit();
                    return(string.Empty);
                }
            }
        }
Пример #2
0
        public static string ConnectionString(string strConnectionString)
        {
            string strConnection = string.Empty;

            try
            {
                strConnection = License.DecryptString(strConnectionString, Collection.DecryptConnectionString);
                DataTool.sysConnectionString           = strConnection;
                DataElement.sysConnectionString        = strConnection;
                DataElement.sysConnectionStringEncrypt = strConnectionString;
                return(strConnection);
            }
            catch
            {
                MessageBox.Show("Config database error!");
                return(string.Empty);
            }
        }
Пример #3
0
        public static string ConnectionStringUpdate()
        {
            string strfile = Application.StartupPath + "\\" + Element.sysConfigFileUpdate;

            if (!File.Exists(strfile))
            {
                return(Core.ConnectionString());
            }
            using (StreamReader sr = new StreamReader(strfile))
            {
                string strConnect = sr.ReadToEnd();
                try
                {
                    return(License.DecryptString(strConnect, Collection.DecryptConnectionString));
                }
                catch
                {
                    return(Core.ConnectionString());
                }
            }
        }
Пример #4
0
        public static string ConnectionStringSync2()
        {
            string strfile = Application.StartupPath + "\\" + Element.sysConfigFile;

            if (!File.Exists(strfile))
            {
                MessageBox.Show("Config database error!");
            }
            using (StreamReader sr = new StreamReader(strfile))
            {
                string strConnect = sr.ReadToEnd();
                //return strConnect;
                try
                {
                    return(License.DecryptString(strConnect, Collection.DecryptConnectionString));
                }
                catch
                {
                    MessageBox.Show("Config database error!");
                    return(string.Empty);
                }
            }
        }
Пример #5
0
 public static string Decrypt(string strText)
 {
     return(License.DecryptString(strText, Collection.DecryptEpointString));
 }