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 { ; } }
public QiniuFile(QiniuConfig qiniuconf, string savedir) { m_qiniuconf = qiniuconf; m_save_dir = savedir; if (savedir != "" && !m_save_dir.EndsWith("/")) m_save_dir += "/"; }
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."); }
public QiPicFileSystem(QiniuConfig conf, string savedir):base(conf, savedir) { }