public LessonEventType getEventType(string action) { LessonEventType val = 0; if (action == "lesson.get") { return(LessonEventType.ClassOn); } else if (action == "lesson.off") { return(LessonEventType.ClassOff); } else if (action == "XitiResult" || action == "xitiResult.upload") { return(LessonEventType.Xiti); } else if (action == "addHandon") { return(LessonEventType.Handon); } else if (action == "addCallname") { return(LessonEventType.CallName); } else if (action == "addReward") { return(LessonEventType.Reward); } else if (action == "fileupload") { return(LessonEventType.UploadFile); } else if (action == "addRecordEvent") { return(LessonEventType.RecordAudio); } else if (action == "DrawView") { return(LessonEventType.DrawPicture); } else if (action == "fileopen" || action == "fileclose" || action == "FileEvent") { return(LessonEventType.FileOpen); } else if (action == "GroupHandon") { return(LessonEventType.GroupHandon); } else if (action == "GroupXiti") { return(LessonEventType.GroupXiti); } return(LessonEventType.Unknown); }
public static int AddEvent(string action, string request, string filepath, string tm) { if (curLessonEvents == null) { curLessonEvents = new LessonEvents(); curLessonEvents.lessonid = Global.getLessonID();//之前有网,上课过程中突然中断。。。 } LessonEvent ev = new LessonEvent(action, request, filepath, tm); string strEvent = ev.toJson(); LessonEventType type = (LessonEventType)ev.type; if (type == LessonEventType.Unknown) { Log.Info("Offline LessonEvent_Ignore: " + strEvent); return(0); } Log.Info("Offline LessonEvent: " + strEvent); if (type == LessonEventType.ClassOn) { if (curLessonEvents != null) { WriteFile(curLessonEvents); curLessonEvents = null; } curLessonEvents = new LessonEvents(); curLessonEvents.addEvent(ev); } else if (type == LessonEventType.ClassOff) { curLessonEvents.addEvent(ev); //TODO: 写文件 WriteFile(curLessonEvents); curLessonEvents = null; } else { curLessonEvents.addEvent(ev); } return(0); }