Exemple #1
0
        public async Task <List <CourseFile> > GetResourseFiles(string rootId = "null")
        {
            var responseContent = await RequestTools.GetWithCookieAsync(String.Format(RequestApis.GetCourseFilesList, CourseId, ClassId, rootId));

            var json = JsonObject.Parse(responseContent);

            var actlist = json["data"].GetArray();

            List <CourseFile> list = new List <CourseFile>();

            foreach (var item in actlist)
            {
                try
                {
                    list.Add(JsonConvert.DeserializeObject <CourseFile>(item.ToString()));
                }
                catch (Exception)
                {
                    var jo = JsonObject.Parse(item.GetObject()["content"].GetString());
                    item.GetObject().Remove("content");
                    item.GetObject().Add("content", jo);
                    list.Add(JsonConvert.DeserializeObject <CourseFile>(item.ToString()));
                }
            }



            return(list);
        }
Exemple #2
0
        private async void GetContent()
        {
            var responseContent = await RequestTools.GetWithCookieAsync(String.Format(RequestApis.GetKnowledge, id, CourseId));

            var json = JsonObject.Parse(responseContent);
            var cs   = json["data"].GetArray()[0].GetObject()["card"].GetObject()["data"].GetArray();

            foreach (var item in cs)
            {
                Cards.Add(new Card(item.GetObject()));
            }
        }
Exemple #3
0
        public async Task <List <Channel> > GetChannels()
        {
            var responseContent = await RequestTools.GetWithCookieAsync(RequestApis.GetCourseAPi);

            var json = JsonObject.Parse(responseContent);

            var status = (int)json["result"].GetNumber();

            if (status == 1)
            {
                return(Channel.PasteAsList(json));
            }
            else
            {
                return(null);
            }
        }
Exemple #4
0
        public async Task <List <ActiveTask> > GetActiveTasks()
        {
            var responseContent = await RequestTools.GetWithCookieAsync(String.Format(RequestApis.GetTaskActiveList, CourseId, ClassId));

            var json = JsonObject.Parse(responseContent);

            var actlist = json["activeList"].GetArray();

            List <ActiveTask> list = new List <ActiveTask>();

            foreach (var item in actlist)
            {
                list.Add(JsonConvert.DeserializeObject <ActiveTask>(item.ToString()));
            }


            return(list);
        }
Exemple #5
0
 public async Task <string> Sign()
 {
     return(await RequestTools.GetWithCookieAsync(String.Format(RequestApis.Sign, id)));
 }