Exemplo n.º 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
        }
Exemplo n.º 2
0
        private void btngetfiles_Click(object sender, EventArgs e)
        {
            #region
            ResponseResult r = CHFSApi.GetFiles();

            Console.WriteLine(r.code);
            Console.WriteLine(r.data);
            #endregion
        }
Exemplo n.º 3
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
        }
Exemplo n.º 4
0
        private void btnExist_Click(object sender, EventArgs e)
        {
            #region
            OpenFileDialog open_file = new OpenFileDialog();

            DialogResult open_result = open_file.ShowDialog(this);

            if (open_result == DialogResult.OK)
            {
                ResponseResult r = CHFSApi.Exist(open_file.FileName);
                Console.WriteLine(r.code);
                Console.WriteLine(r.data);
            }
            #endregion
        }