示例#1
0
文件: Program.cs 项目: cposture/QiPIC
        static void Main(string[] args)
        {
            Options options = new Options();
            if (CommandLine.Parser.Default.ParseArguments(args, options))
            {
                QiniuConfig conf = new QiniuConfig("Wege4i-gz1IyWpCEfjhfEjZDj9U7IAhCXwq5FzxP", "l9DlUgST1KhGInpA--QMqeY3sLmaQ6nBCp_HOpH9", "7xosys.com1.z0.glb.clouddn.com", "notebook");
                QiniuFile qiniu = new QiniuFile(conf, "D:/");

                qiniu.init();

                try
                {
                    // 创建文件
                    FileStream fs = new FileStream("uploadtest", FileMode.OpenOrCreate, FileAccess.ReadWrite);
                    StreamWriter sw = new StreamWriter(fs);
                    sw.WriteLine("uploadtest");
                    sw.Close();
                    qiniu.Upload("uploadtest", true);
                    File.Delete("uploadtest");
                }
                catch (Exception e)
                {
                    if (File.Exists("uploadtest"))
                        File.Delete("uploadtest");
                    return;
                }
                Console.WriteLine(options.SaveDir);
            }
            else 
            {
                ;
            }
        }
示例#2
0
        public QiniuFile(QiniuConfig qiniuconf, string savedir)
        {
            m_qiniuconf = qiniuconf;
            m_save_dir = savedir;

            if (savedir != "" && !m_save_dir.EndsWith("/"))
                m_save_dir += "/";
        }
示例#3
0
        void Download_EmptyDirAndFilename_Error()
        {
            string empty_dir = "";
            string empty_filename = "";
            QiniuConfig conf = new QiniuConfig("Wege4i-gz1IyWpCEfjhfEjZDj9U7IAhCXwq5FzxP", "l9DlUgST1KhGInpA--QMqeY3sLmaQ6nBCp_HOpH9", "7xosys.com1.z0.glb.clouddn.com", "notebook");
            QiniuFile qiniu = new QiniuFile(conf, empty_dir);

            try
            {
                qiniu.init();
                qiniu.Download(empty_filename);
            }
            catch (ArgumentException e)
            {
                return;
            }
            Assert.Fail("No exception was thrown.");
        }
示例#4
0
 public QiPicFileSystem(QiniuConfig conf, string savedir):base(conf, savedir)
 {
     
 }