Example #1
0
        static void Main(string[] args)
        {
            #region

            string newfileid = Guid.NewGuid().ToString();

            try
            {
                //初始化测试参数
                initTestParams();
                //调用chfs的封装接口
                CHFSApi.init(chfsserverip, chfsserverport);
                //如果需要上传则需要先进行登陆获取token,接口中已经进行了隐式传输token
                CHFSApi.Login();
                //开始上传文件
                CHFSApi.Upload(copyToTMP(newfileid));
            }
            catch (Exception ex)
            {
                string logfilename = String.Format("{0}.txt", newfileid);
                string logfilepath = Path.Combine(System.Environment.CurrentDirectory, logfilename);
                File.AppendAllText(logfilepath, ex.ToString());//添加至文件
            }
            #endregion
        }
Example #2
0
        private void btnlogin_Click(object sender, EventArgs e)
        {
            #region
            ResponseResult r = CHFSApi.Login();

            Console.WriteLine(r.code);
            Console.WriteLine(r.data);
            foreach (var s in r.cookie)
            {
                Console.WriteLine(s);
            }
            #endregion
        }