Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using cn.bmob.api;
- using cn.bmob.io;
- using cn.bmob.json;
- using cn.bmob.tools;
- using System;
- using System.Collections.Generic;
- using System.Diagnostics;
- using System.IO;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace BmobTest.answers
- {
- class Answers : BmobTable
- {
- public BmobInt index { get; set; }
- public string answer { get; set; }
- public override void readFields(BmobInput input)
- {
- base.readFields(input);
- this.index = input.getInt("index");
- this.answer = input.getString("answer");
- }
- public override void write(BmobOutput output, Boolean all)
- {
- base.write(output, all);
- output.Put("index", this.index);
- output.Put("answer", this.answer);
- }
- public static BmobWindows server()
- {
- var Bmob = new BmobWindows();
- Bmob.initialize("5c4db3dcd0d2c259a82e3cd90b9a1921", "1bc16364ee4620d8b25c701dd16a3958");
- BmobDebug.Register(msg => { Debug.WriteLine(msg); });
- BmobDebug.level = BmobDebug.Level.TRACE;
- return Bmob;
- }
- public static void load(String path)
- {
- var Bmob = server();
- StreamReader reader = null;
- try
- {
- reader = new StreamReader(path);
- int count = 0;
- string line = null;
- while ((line = reader.ReadLine()) != null)
- {
- line = line.Trim();
- if (line.Length == 0) {
- continue;
- }
- count++;
- var data = new Answers();
- data.index = count;
- data.answer = line;
- var future = Bmob.CreateTaskAsync("answers", data);
- var resp = future.Result;
- Console.WriteLine();
- Console.WriteLine("\n返回结果: " + JsonAdapter.JSON.ToDebugJsonString(resp));
- }
- }
- finally
- {
- if (reader != null)
- {
- reader.Close();
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement