示例#1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="domain">img.andni.cn/img.bwezhan.cn</param>
        /// <returns></returns>
        public static OssConfig GetConfig(int idx)
        {
            OssConfig config;

            config = OssConfigMgr.GetAllConfigs().Skip(idx - 1).First();
            return(config);
        }
示例#2
0
        public static OssConfig GetOneConfig()
        {
            OssConfig config;

            config = OssConfigMgr.GetAllConfigs().FirstOrDefault();
            return(config);
        }
示例#3
0
        static void Main(string[] args)
        {
            //配置文件

            DateTime updateDate = Convert.ToDateTime(getCurrentDay());                       //Convert.ToDateTime(System.Configuration.ConfigurationSettings.AppSettings[0]);
            string   FolderPath = System.Configuration.ConfigurationSettings.AppSettings[0];
            string   Pre_key    = System.Configuration.ConfigurationSettings.AppSettings[1]; //云盘上的key根目录

            OssConfig                config    = OssConfigMgr.GetOneConfig();
            BosOpenStorageService    bos       = new BosOpenStorageService(config);
            OssConfig                aliConfig = OssConfigMgr.GetConfig(2);
            AliyunOpenStorageService aos       = new AliyunOpenStorageService(aliConfig);

            OssConfig ali_hk_Config         = OssConfigMgr.GetConfig(3);
            AliyunOpenStorageService hk_aos = new AliyunOpenStorageService(ali_hk_Config);

            OssConfig ali_us_Config         = OssConfigMgr.GetConfig(4);
            AliyunOpenStorageService us_aos = new AliyunOpenStorageService(ali_us_Config);

            try
            {
                var flag1 = true; var which = "";
                while (flag1)
                {
                    Console.WriteLine("\n\n\n欢迎使用云梦云端帮助工具");
                    Console.WriteLine("请输入数字选择程序: \n1上传(支持百度) \n2删除(支持百度) \n3模版文件迁移(从阿里云到百度云) \n4整站文件多平台迁移(待完成) \n5模板文件迁移(从阿里香港云到百度) \n6 阿里云文件迁移(香港云到美国云)");
                    which = Console.ReadLine();
                    if (which != "1" && which != "2" && which != "3" && which != "5" && which != "6" && which != "temp")
                    {
                        continue;
                    }

                    Console.WriteLine(""); Console.WriteLine("");
                    switch (which)
                    {
                    case "1":
                        updateDate = RunUpload(updateDate, FolderPath, Pre_key, bos);
                        break;

                    case "2":
                        delete(bos);
                        break;

                    case "3":
                        TemplateTransfer(bos, aos);
                        break;

                    case "5":
                        TemplateTransfer(bos, hk_aos);
                        break;

                    case "6":
                        TemplateTransfer_forAliyun(hk_aos, us_aos);
                        break;

                    case "temp":
                        //TempFunction(us_aos);
                        VisitUSA();
                        break;
                    }
                }
            }
            catch (Exception ex) {
                LogHelper.CreateErrorLogTxt(ex.Message);
            }

            Console.Read();
        }