init
This commit is contained in:
26
WordGen/Model/Exceptions/EmptyConsonnantListException.cs
Normal file
26
WordGen/Model/Exceptions/EmptyConsonnantListException.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
using WordGen.Model.Exceptions;
|
||||
using WordGen.View.LocalizationString;
|
||||
|
||||
namespace WordGen.Model.Exceptions {
|
||||
/// <summary>
|
||||
/// Aucune consonne n'as été trouvée. Ajoutez des consonnes à votre syllabaire, retirez les consonnes de la syntaxe de votre mot (caractère 'c') ou paramétrez votre syllabaire pour ne pas insérer automatiquement une consonne entre une voyelle et une syllabe.
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
internal class EmptyConsonnantListException : GeneratorException {
|
||||
|
||||
public EmptyConsonnantListException() : base(Messages.GeneratorError_EmptyConsonnantListException) {
|
||||
}
|
||||
|
||||
public EmptyConsonnantListException(string wordSoFar, string currentSyllable, string currentSyntaxe, Syllabary currentSyllabary) : base(wordSoFar, currentSyllable, currentSyntaxe, currentSyllabary, Messages.GeneratorError_EmptyConsonnantListException) {
|
||||
}
|
||||
|
||||
public EmptyConsonnantListException(string wordSoFar, string currentSyllable, string currentSyntaxe, Syllabary currentSyllabary, string message) : base(wordSoFar, currentSyllable, currentSyntaxe, currentSyllabary, message) {
|
||||
}
|
||||
|
||||
public EmptyConsonnantListException(string wordSoFar, string currentSyllable, string currentSyntaxe, Syllabary currentSyllabary, string message, Exception innerException) : base(wordSoFar, currentSyllable, currentSyntaxe, currentSyllabary, message, innerException) {
|
||||
}
|
||||
|
||||
}
|
||||
}
|
24
WordGen/Model/Exceptions/EmptySyllableListException.cs
Normal file
24
WordGen/Model/Exceptions/EmptySyllableListException.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
using WordGen.Model.Exceptions;
|
||||
using WordGen.View.LocalizationString;
|
||||
|
||||
namespace WordGen.Model.Exceptions {
|
||||
/// <summary>
|
||||
/// Aucune syllabe n'as été trouvée. Ajoutez des syllabe à votre syllabaire ou retirez les syllabes de la syntaxe de votre mot (caractère 's').
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
internal class EmptySyllableListException : GeneratorException {
|
||||
public EmptySyllableListException() : base(Messages.GeneratorError_EmptySyllableListException) {
|
||||
}
|
||||
|
||||
public EmptySyllableListException(string wordSoFar, string currentSyllable, string currentSyntaxe, Syllabary currentSyllabary) : base(wordSoFar, currentSyllable, currentSyntaxe, currentSyllabary, Messages.GeneratorError_EmptySyllableListException) {
|
||||
}
|
||||
|
||||
public EmptySyllableListException(string wordSoFar, string currentSyllable, string currentSyntaxe, Syllabary currentSyllabary, string message) : base(wordSoFar, currentSyllable, currentSyntaxe, currentSyllabary, message) {
|
||||
}
|
||||
|
||||
protected EmptySyllableListException(string wordSoFar, string currentSyllable, string currentSyntaxe, Syllabary currentSyllabary, string message, Exception innerException) : base(wordSoFar, currentSyllable, currentSyntaxe, currentSyllabary, message, innerException) {
|
||||
}
|
||||
}
|
||||
}
|
24
WordGen/Model/Exceptions/EmptyVowelListException.cs
Normal file
24
WordGen/Model/Exceptions/EmptyVowelListException.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
using WordGen.Model.Exceptions;
|
||||
using WordGen.View.LocalizationString;
|
||||
|
||||
namespace WordGen.Model.Exceptions {
|
||||
/// <summary>
|
||||
/// Aucune voyelle n'as été trouvée. Ajoutez des voyelles à votre syllabaire, retirez les voyelles de la syntaxe de votre mot (caractère 'v') ou paramétrez votre syllabaire pour ne pas insérer automatiquement une voyelle entre une consonne et une syllabe.
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
internal class EmptyVowelListException : GeneratorException {
|
||||
public EmptyVowelListException() : base(Messages.GeneratorError_EmptyVowelListException) {
|
||||
}
|
||||
|
||||
public EmptyVowelListException(string wordSoFar, string currentSyllable, string currentSyntaxe, Syllabary currentSyllabary) : base(wordSoFar, currentSyllable, currentSyntaxe, currentSyllabary, Messages.GeneratorError_EmptyVowelListException) {
|
||||
}
|
||||
|
||||
public EmptyVowelListException(string wordSoFar, string currentSyllable, string currentSyntaxe, Syllabary currentSyllabary, string message) : base(wordSoFar, currentSyllable, currentSyntaxe, currentSyllabary, message) {
|
||||
}
|
||||
|
||||
protected EmptyVowelListException(string wordSoFar, string currentSyllable, string currentSyntaxe, Syllabary currentSyllabary, string message, Exception innerException) : base(wordSoFar, currentSyllable, currentSyntaxe, currentSyllabary, message, innerException) {
|
||||
}
|
||||
}
|
||||
}
|
92
WordGen/Model/Exceptions/GeneratorException.cs
Normal file
92
WordGen/Model/Exceptions/GeneratorException.cs
Normal file
@@ -0,0 +1,92 @@
|
||||
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 {
|
||||
/// <summary>
|
||||
/// Une exception n'as pas permis de générer entièrement le mot.
|
||||
/// </summary>
|
||||
class GeneratorException : Exception {
|
||||
|
||||
/// <summary>
|
||||
/// Le mot généré auparavant.
|
||||
/// </summary>
|
||||
protected string _wordSoFar;
|
||||
/// <summary>
|
||||
/// Obtient le mot généré auparavant.
|
||||
/// </summary>
|
||||
public string wordSoFar
|
||||
{
|
||||
get { return _wordSoFar; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Le caractère (consonne, voyelle, syllabe) qui allait être ajouté.
|
||||
/// </summary>
|
||||
protected string _currentSyllable;
|
||||
/// <summary>
|
||||
/// Obtient le caractère (consonne, voyelle, syllabe) qui allait être ajouté.
|
||||
/// </summary>
|
||||
public string currentSyllable
|
||||
{
|
||||
get { return _currentSyllable; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// La syntaxe utilisée pour générer le mot.
|
||||
/// </summary>
|
||||
protected string _currentSyntaxe;
|
||||
/// <summary>
|
||||
/// Obtient la syntaxe utilisée pour générer le mot.
|
||||
/// </summary>
|
||||
public string currentSyntaxe
|
||||
{
|
||||
get { return _currentSyntaxe; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Le syllabaire utilisé pour générer le mot.
|
||||
/// </summary>
|
||||
protected Syllabary _currentSyllabary;
|
||||
/// <summary>
|
||||
/// Obtient le syllabaire utilisé pour générer le mot.
|
||||
/// </summary>
|
||||
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);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Associe les éléments passé en paramètre avec les champs de manière factorisée.
|
||||
/// </summary>
|
||||
protected void init(string wordSoFar, string currentSyllable, string currentSyntaxe, Syllabary currentSyllabary) {
|
||||
this._wordSoFar = wordSoFar;
|
||||
this._currentSyllable = currentSyllable;
|
||||
this._currentSyntaxe = currentSyntaxe;
|
||||
this._currentSyllabary = currentSyllabary;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
23
WordGen/Model/Exceptions/NoBeforeSyllableMatchException.cs
Normal file
23
WordGen/Model/Exceptions/NoBeforeSyllableMatchException.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace WordGen.Model.Exceptions {
|
||||
/// <summary>
|
||||
/// Aucune syllabe adaptée n'as été trouvée. Completez le syllabaire avec d'avantages de syllabes ou changez le comportement de celui-ci lors de l'ajout d'une syllabe.
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
internal class NoBeforeSyllableMatchException : GeneratorException {
|
||||
|
||||
public NoBeforeSyllableMatchException() : base() {
|
||||
}
|
||||
|
||||
public NoBeforeSyllableMatchException(string wordSoFar, string currentSyllable, string currentSyntaxe, Syllabary currentSyllabary) : base(wordSoFar, currentSyllable, currentSyntaxe, currentSyllabary) {
|
||||
}
|
||||
|
||||
public NoBeforeSyllableMatchException(string wordSoFar, string currentSyllable, string currentSyntaxe, Syllabary currentSyllabary, string message) : base(wordSoFar, currentSyllable, currentSyntaxe, currentSyllabary, message) {
|
||||
}
|
||||
|
||||
public NoBeforeSyllableMatchException(string wordSoFar, string currentSyllable, string currentSyntaxe, Syllabary currentSyllabary, string message, Exception innerException) : base(wordSoFar, currentSyllable, currentSyntaxe, currentSyllabary, message, innerException) {
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user