-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2d82488
commit 3b3b67f
Showing
17 changed files
with
339 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,11 @@ | ||
namespace quiz_console_app.Enums; | ||
|
||
[Flags] | ||
public enum DifficultyLevel | ||
{ | ||
Easy, | ||
Medium, | ||
Hard | ||
Easy = 1, | ||
Medium = 2, | ||
Hard = 4 | ||
} | ||
|
||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
namespace quiz_console_app.Enums; | ||
[Flags] | ||
public enum QuizMode | ||
{ | ||
Quiz = 1, | ||
DisplayBooklets = 2, | ||
ExportData = 3 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,4 @@ | ||
using quiz_console_app.Helpers; | ||
using quiz_console_app.Models; | ||
using quiz_console_app.Services; | ||
using quiz_console_app.Services; | ||
|
||
QuizService quizService = new QuizService(); | ||
|
||
|
||
List<Question> questions = new QuestionLoader().LoadQuestionsFromJson("software_questions.json"); // default path : {root-project}/bin/Debug/net8.0/software_questions.json | ||
|
||
quizService.GenerateBooklets(questions, 1); | ||
|
||
QuizDisplay.DisplayBooklets(quizService.Booklets); | ||
QuizDisplay.DisplayAnswerKeys(quizService.AnswerKeys); | ||
|
||
Console.ReadLine(); | ||
QuizModeHandlerService quizModeHandlerService = new QuizModeHandlerService(); | ||
quizModeHandlerService.ShowMainMenu(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
using quiz_console_app.Helpers; | ||
using quiz_console_app.Models; | ||
using quiz_console_app.Services; | ||
using quiz_console_app.ViewModels; | ||
|
||
namespace quiz_console_app.Screens; | ||
|
||
public class DisplayBookletScreen | ||
{ | ||
private readonly QuizService _quizService; | ||
private readonly QuestionLoader _questionLoader; | ||
private readonly List<Question> _questions; | ||
private readonly List<UserAnswerKeyViewModel> _userAnswers; | ||
private readonly List<AnswerKeyViewModel> _answerKeys; | ||
public DisplayBookletScreen() | ||
{ | ||
_questionLoader = new QuestionLoader(); | ||
_questions = _questionLoader.LoadQuestionsFromJson("software_questions.json"); | ||
_quizService = new QuizService(); | ||
_quizService.GenerateBooklets(_questions, 1); | ||
_userAnswers = new List<UserAnswerKeyViewModel>(); | ||
_answerKeys = QuizService.AnswerKeys; | ||
} | ||
|
||
public void Start() | ||
{ | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
namespace quiz_console_app.Screens; | ||
|
||
public class ExportDataScreen | ||
{ | ||
public void Start() | ||
{ | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
using quiz_console_app.Helpers; | ||
using quiz_console_app.Models; | ||
using quiz_console_app.Services; | ||
using quiz_console_app.ViewModels; | ||
|
||
namespace quiz_console_app.Screens; | ||
|
||
public class QuizModeScreen | ||
{ | ||
private readonly QuizService _quizService; | ||
private readonly QuestionLoader _questionLoader; | ||
private readonly List<Question> _questions; | ||
private readonly List<UserAnswerKeyViewModel> _userAnswers; | ||
private readonly List<AnswerKeyViewModel> _answerKeys; | ||
|
||
public QuizModeScreen() | ||
{ | ||
_questionLoader = new QuestionLoader(); | ||
_questions = _questionLoader.LoadQuestionsFromJson("software_questions.json"); | ||
_quizService = new QuizService(); | ||
_quizService.GenerateBooklets(_questions, 1); | ||
_userAnswers = new List<UserAnswerKeyViewModel>(); | ||
_answerKeys = QuizService.AnswerKeys; | ||
} | ||
|
||
public void Start() | ||
{ | ||
var Booklet = QuizService.Booklets.FirstOrDefault(); | ||
int questionNumber = 1; | ||
foreach (var question in Booklet.Questions) | ||
{ | ||
ConsoleHelper.WriteColoredLine($"{questionNumber}. Soru: ", ConsoleColors.Info); | ||
ConsoleHelper.WriteColoredLine(question.AskText, ConsoleColors.Default); | ||
|
||
for (int i = 0; i < question.QuestionOptions.Count; i++) | ||
{ | ||
char optionLetter = (char)(65 + i); | ||
|
||
ConsoleHelper.WriteColored($"{optionLetter})", ConsoleColors.Info); | ||
ConsoleHelper.WriteColored( | ||
$"{question.QuestionOptions[i].Text} ", | ||
ConsoleColors.Default | ||
); | ||
} | ||
Console.WriteLine(); | ||
Console.Write("Cevabınızı girin (Boş bırakmak için Enter tuşuna basın) : "); | ||
string userAnswerFromReadLine = Console.ReadLine().ToUpper(); | ||
Console.WriteLine(); | ||
if ( | ||
userAnswerFromReadLine.Length == 1 | ||
&& userAnswerFromReadLine[0] >= (char)65 | ||
&& userAnswerFromReadLine[0] <= (char)(65 + question.QuestionOptions.Count - 1) | ||
) | ||
{ | ||
_userAnswers.Add( | ||
new UserAnswerKeyViewModel | ||
{ | ||
BookletId = Booklet.Id, | ||
QuestionId = question.Id, | ||
UserAnswerOption = userAnswerFromReadLine | ||
} | ||
); | ||
questionNumber++; | ||
} | ||
else if (userAnswerFromReadLine.Length == 0) // cevap null ise | ||
{ | ||
_userAnswers.Add( | ||
new UserAnswerKeyViewModel | ||
{ | ||
BookletId = Booklet.Id, | ||
QuestionId = question.Id, | ||
UserAnswerOption = null | ||
} | ||
); | ||
questionNumber++; | ||
} | ||
else | ||
{ | ||
char optionLetter = (char)64; | ||
string optionsText = ""; | ||
for (int i = 0; i < question.QuestionOptions.Count; i++) | ||
{ | ||
optionLetter++; | ||
optionsText += | ||
(i != 0) | ||
? (i != question.QuestionOptions.Count - 1) | ||
? $", {optionLetter}" | ||
: $" veya {optionLetter}" | ||
: $"{optionLetter}"; | ||
} | ||
|
||
string errorMessage = | ||
$"Geçersiz cevap. Lütfen {optionsText} harflerinden birini girin. veya boş bırakmak için sadece Enter tuşuna basın."; | ||
|
||
ConsoleHelper.WriteColoredLine(errorMessage, ConsoleColors.Error); | ||
} | ||
} | ||
_quizService.EvaluateQuizResults(_userAnswers); | ||
} | ||
} |
Oops, something went wrong.