Example #1
0
        public FlashCard[] GetFlashCards(int documentId)
        {
            var flashCardsContent = requestsSender.GetFlashCards(documentId).Content;
            var flashCards        = ResponsesParser.ParseFlashCards(flashCardsContent);

            return(flashCards);
        }
Example #2
0
        public TestSession GetTestSession(int sessionId)
        {
            var sessionJson = requestsSender.GetSession(sessionId).Content;
            var session     = ResponsesParser.ParseTestSession(sessionJson);

            return(session);
        }
Example #3
0
        public int GetTestSessionId(string sessionUuId)
        {
            var testingPageContent = requestsSender.GetTestingPage(sessionUuId).Content;
            int sessionId          = ResponsesParser.GetSessionId(testingPageContent);

            return(sessionId);
        }
Example #4
0
        private void Authorization(string login, string password)
        {
            var loginPageContent = requestsSender.GetLoginPage().Content;
            var csrf             = ResponsesParser.ParseCsrf(loginPageContent);

            requestsSender.Autorization(login, password, csrf);
        }
Example #5
0
        public TestDocument[] GetTestsDocumentsWithSameQuestions(string questionText)
        {
            if (questionText is null)
            {
                throw new ArgumentNullException();
            }

            var documentsJson = requestsSender.FindTestsDocumentsWithSameQuestions(questionText).Content;

            return(ResponsesParser.ParseTestsDocuments(documentsJson));
        }
Example #6
0
        private int[] GetProfilePublicTestsDocumentsId(int profileId, int page, out string pageContent)
        {
            pageContent = requestsSender.GetProfileTestsDocuments(profileId, page).Content;
            var testsUrls = ResponsesParser.GetProfileTestsDocumentsUrls(pageContent);
            var testsId   = new List <int>();

            foreach (var testUrl in testsUrls)
            {
                var testId = int.Parse(
                    string.Join("",
                                testUrl.Split(new char[] { '-' }, StringSplitOptions.RemoveEmptyEntries)
                                .Last()
                                .TakeWhile(symbol => char.IsNumber(symbol))
                                )
                    );

                testsId.Add(testId);
            }

            return(testsId.ToArray());
        }
Example #7
0
        public int[] GetProfilePublicTestsDocumentsId(int profileId)
        {
            var testsId     = new List <int>();
            int currentPage = 1;

            while (true)
            {
                var currentPageTestsId = GetProfilePublicTestsDocumentsId(profileId, currentPage, out string pageContent);
                testsId.AddRange(currentPageTestsId);

                if (ResponsesParser.IsLastProfilePage(pageContent))
                {
                    break;
                }
                else
                {
                    currentPage++;
                }
            }

            return(testsId.ToArray());
        }