Exemple #1
0
        /// <summary>
        /// 获取账号信息
        /// </summary>
        /// <returns>返回解密后的json格式内容</returns>
        public string GetDb()
        {
            Config con = new Config();

            con.ReaderConfig();
            string db = "";

            if (IsNet())
            {
                WebClient MyWebClient = new WebClient();
                MyWebClient.Credentials = CredentialCache.DefaultCredentials;
                Byte[] pageData = MyWebClient.DownloadData(con.config.ApiUrl);
                db = Encoding.UTF8.GetString(pageData);
                StreamWriter sw = new StreamWriter(db_path, false);
                sw.WriteLine(db);
                sw.Close();
            }
            else
            {
                if (!ExistsDb())
                {
                    throw new Exception("请先连接网络 获取账号数据文件");
                }
                string[] str = File.ReadAllLines(db_path, System.Text.Encoding.Default);
                db = string.Join("", str);
            }

            return(Encrypt.decode(db, con.config.EncryptKey));
        }
Exemple #2
0
        /// <summary>
        /// 获取账号信息
        /// </summary>
        /// <returns>返回解密后的json格式内容</returns>
        public string GetDb()
        {
            Config con = new Config();
            con.ReaderConfig();
            string db = "";
            if(IsNet())
            {
                WebClient MyWebClient = new WebClient();
                MyWebClient.Credentials = CredentialCache.DefaultCredentials;
                Byte[] pageData = MyWebClient.DownloadData(con.config.ApiUrl);
                db = Encoding.UTF8.GetString(pageData);
                StreamWriter sw = new StreamWriter(db_path, false);
                sw.WriteLine(db);
                sw.Close();
            }
            else
            {
                if (!ExistsDb())
                {
                    throw new Exception("请先连接网络 获取账号数据文件");
                }
                string[] str = File.ReadAllLines(db_path, System.Text.Encoding.Default);
                db = string.Join("",str);
            }

            return Encrypt.decode(db, con.config.EncryptKey);
        }
Exemple #3
0
        private static DataConfig GetPath()
        {
            Config con = new Config();

            con.ReaderConfig();
            return(con.config);
        }
Exemple #4
0
        private void SetConfig()
        {
            Config con = new Config();

            con.ReaderConfig();
            textapiurl.Text     = con.config.ApiUrl;
            textBoxftppath.Text = con.config.FtpPath;
            textBoxsshpath.Text = con.config.SshPath;
            textBoxftpcmd.Text  = con.config.FtpCmd;
            textBoxsshcmd.Text  = con.config.SshCmd;
        }
Exemple #5
0
 private void SetConfig()
 {
     Config con = new Config();
     con.ReaderConfig();
     textapiurl.Text = con.config.ApiUrl;
     textBoxftppath.Text = con.config.FtpPath;
     textBoxsshpath.Text = con.config.SshPath;
     textBoxftpcmd.Text = con.config.FtpCmd;
     textBoxsshcmd.Text = con.config.SshCmd;
 }
Exemple #6
0
 private static DataConfig GetPath()
 {
     Config con = new Config();
     con.ReaderConfig();
     return con.config;
 }