using System; using System.Collections.Generic; using System.Linq; using System.Runtime.Serialization; using System.Text; using System.Threading.Tasks; using WordGen.View.LocalizationString; namespace WordGen.Model.Exceptions { /// /// Une exception n'as pas permis de générer entièrement le mot. /// class GeneratorException : Exception { /// /// Le mot généré auparavant. /// protected string _wordSoFar; /// /// Obtient le mot généré auparavant. /// public string wordSoFar { get { return _wordSoFar; } } /// /// Le caractère (consonne, voyelle, syllabe) qui allait être ajouté. /// protected string _currentSyllable; /// /// Obtient le caractère (consonne, voyelle, syllabe) qui allait être ajouté. /// public string currentSyllable { get { return _currentSyllable; } } /// /// La syntaxe utilisée pour générer le mot. /// protected string _currentSyntaxe; /// /// Obtient la syntaxe utilisée pour générer le mot. /// public string currentSyntaxe { get { return _currentSyntaxe; } } /// /// Le syllabaire utilisé pour générer le mot. /// protected Syllabary _currentSyllabary; /// /// Obtient le syllabaire utilisé pour générer le mot. /// public Syllabary currentSyllabary { get { return _currentSyllabary; } } public GeneratorException() : base(Messages.GeneratorError_GenericGeneratorException) { } public GeneratorException(string message) : base(message) { } public GeneratorException(string wordSoFar, string currentSyllable, string currentSyntaxe, Syllabary currentSyllabary) : base(Messages.GeneratorError_GenericGeneratorException) { init(wordSoFar, currentSyllable, currentSyntaxe, currentSyllabary); } public GeneratorException(string wordSoFar, string currentSyllable, string currentSyntaxe, Syllabary currentSyllabary, string message) : base(message) { init(wordSoFar, currentSyllable, currentSyntaxe, currentSyllabary); } public GeneratorException(string wordSoFar, string currentSyllable, string currentSyntaxe, Syllabary currentSyllabary, string message, Exception innerException) : base(message, innerException) { init(wordSoFar, currentSyllable, currentSyntaxe, currentSyllabary); } /// /// Associe les éléments passé en paramètre avec les champs de manière factorisée. /// protected void init(string wordSoFar, string currentSyllable, string currentSyntaxe, Syllabary currentSyllabary) { this._wordSoFar = wordSoFar; this._currentSyllable = currentSyllable; this._currentSyntaxe = currentSyntaxe; this._currentSyllabary = currentSyllabary; } } }