/// <summary> /// Bmob初始化 /// </summary> public BmobWindows BmobBuilder() { if (_bmobWindows == null) { _bmobWindows = new BmobWindows(); _bmobWindows.initialize(PresetInfo.BmobApplicationId, PresetInfo.BmobRestApiKey); BmobDebug.Register(msg => { Debug.WriteLine("BmobDebug:" + msg); }); } return(_bmobWindows); }
protected void Application_Start() { AreaRegistration.RegisterAllAreas(); RouteConfig.RegisterRoutes(RouteTable.Routes); BmobWindows Bmob = new BmobWindows(); Bmob.initialize("69e01e36e091bee65ebeb8f93604f474", "8b0d500c09ff5c86cfcd3358b5104b05"); BmobDebug.Register(msg => { Debug.WriteLine(msg); }); //注册调试工具 }
static BmobTestBase() { Bmob.initialize("4414150cb439afdf684d37dc184e0f9f", "e1deb317442129c125b228ddf78e5f22"); BmobDebug.Register(msg => { Debug.WriteLine(msg); }); BmobDebug.level = BmobDebug.Level.TRACE; }
/// <summary> /// 初始化事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnInit_Click(object sender, EventArgs e) { BmobWindows Bmob = new BmobWindows(); Bmob.initialize("38cd909fe640756176303b980453db55", "9e8a836ccfd013f87619b284a97de02c"); // 初始化Bmob客户端 BmobDebug.Register(msg => { Debug.WriteLine(msg); }); // 用于调试输出请求参数 BmobQuery query = new BmobQuery(); //新建查询 查询Activityrecord表中所有的数据 按时间正向排序 Bmob.Find <ReadFile>("Activityrecord", query, (resp, exception) => { // 处理查询网络异常 if (exception != null) { return; } //对返回结果进行处理 List <ReadFile> list = resp.results; foreach (var game in list) { BmobFile record = game.record; if (record != null) { if (File.Exists(record.filename)) { Console.WriteLine("跳过:" + record.filename); } else { Console.WriteLine("下载:" + record.filename); //调用HttpDownload进行非重复文件的下载,此处下载为同步下载 即一个下载完才会执行之后代码 HttpDownload(record.url, "./" + record.filename); } } } Console.WriteLine("开始写入"); String[] files = Directory.GetFiles("./", "*.txt", SearchOption.AllDirectories); foreach (string f in files) { if (File.Exists("db.txt")) { Console.WriteLine("it is existed"); } else { FileStream fs = new FileStream("db.txt", FileMode.CreateNew); fs.Close(); } Console.WriteLine("查看" + f); if (f.Contains("db.txt")) { continue; } string a = System.IO.File.ReadAllText(f); string b = System.IO.File.ReadAllText("db.txt"); System.IO.File.WriteAllText("db.txt", a + "\r\n" + b); File.Delete(f); } byte[] byData = new byte[100]; char[] charData = new char[1000]; // 这里是Bmob的回调函数 也就是查询完之后执行下载了所有文件再执行此处的合并和InitChart // 所以需要将这个设置为False 否则会提示操作跨线程错误 Control.CheckForIllegalCrossThreadCalls = false; InitChart(); Read("db.txt"); }); }
public static void InitBmob(string appkey, string reskey) { bmob.initialize(appkey, reskey); BmobDebug.Register(msg => { Debug.WriteLine(msg); }); }