diff --git a/AideDeJeu/AideDeJeu/Models/Cards/Converters.cs b/AideDeJeu/AideDeJeu/Models/Cards/Converters.cs index 9c2b1548..74c732bd 100644 --- a/AideDeJeu/AideDeJeu/Models/Cards/Converters.cs +++ b/AideDeJeu/AideDeJeu/Models/Cards/Converters.cs @@ -133,7 +133,7 @@ namespace AideDeJeuLib.Cards var contents = new List(); contents.AddRange(new CardContent[] { - new SubtitleCardContent(spell.LevelType), + //new SubtitleCardContent(spell.LevelType), new RuleCardContent(), new PropertyCardContent("Durée d'incantation", spell.CastingTime), new PropertyCardContent("Portée", spell.Range), diff --git a/AideDeJeu/AideDeJeu/Models/Monsters/Monster.cs b/AideDeJeu/AideDeJeu/Models/Monsters/Monster.cs index da019ae7..ce71a460 100644 --- a/AideDeJeu/AideDeJeu/Models/Monsters/Monster.cs +++ b/AideDeJeu/AideDeJeu/Models/Monsters/Monster.cs @@ -35,288 +35,5 @@ namespace AideDeJeuLib public string Senses { get; set; } public string Languages { get; set; } public string Challenge { get; set; } - public string Description { get; set; } - - public IEnumerable SpecialFeatures { get; set; } - public IEnumerable Actions { get; set; } - public IEnumerable Reactions { get; set; } - public IEnumerable LegendaryActions { get; set; } - - - public override void Parse(ref ContainerBlock.Enumerator enumerator) - { - List features = null; - //List specialFeatures = null; - //List actions = null; - //List reactions = null; - //List legendaryActions = null; - enumerator.MoveNext(); - //try - //{ - while (enumerator.Current != null) - { - var block = enumerator.Current; - //Debug.WriteLine(block.GetType()); - //DumpBlock(block); - if (block is Markdig.Syntax.HeadingBlock) - { - var headingBlock = block as Markdig.Syntax.HeadingBlock; - //DumpHeadingBlock(headingBlock); - if (headingBlock.HeaderChar == '#' && headingBlock.Level == 1) - { - if (this.Name != null) - { - return; - } - this.Name = headingBlock.Inline.ToMarkdownString(); - //Console.WriteLine(spell.Name); - } - if (headingBlock.HeaderChar == '#' && headingBlock.Level == 2) - { - switch (headingBlock.Inline.ToMarkdownString()) - { - case "Capacités": - case "Special Features": - SpecialFeatures = features = new List(); - break; - case "Actions": - Actions = features = new List(); - break; - case "Réaction": - case "Réactions": - case "Reaction": - case "Reactions": - Reactions = features = new List(); - break; - case "Actions légendaires": - case "Legendary Actions": - LegendaryActions = features = new List(); - break; - default: - App.Current.MainPage.DisplayAlert("Erreur de parsing", headingBlock.Inline.ToMarkdownString(), "OK"); - break; - } - } - } - else if (block is Markdig.Syntax.ParagraphBlock) - { - if (block.IsNewItem()) - { - return; - } - var paragraphBlock = block as Markdig.Syntax.ParagraphBlock; - features?.Add(paragraphBlock.ToMarkdownString()); - ////DumpParagraphBlock(paragraphBlock); - //Console.WriteLine(paragraphBlock.IsBreakable); - //spell.DescriptionHtml += paragraphBlock.Inline.ToContainerString(); - //if(paragraphBlock.IsBreakable) - //{ - // spell.DescriptionHtml += "\n"; - //} - } - else if (block is Markdig.Syntax.ListBlock) - { - var listBlock = block as Markdig.Syntax.ListBlock; - //DumpListBlock(listBlock); - if (listBlock.BulletType == '-') - { - this.Source = ""; - foreach (var inblock in listBlock) - { - //DumpBlock(inblock); - var regex = new Regex("(?.*?): (?.*)"); - if (inblock is Markdig.Syntax.ListItemBlock) - { - var listItemBlock = inblock as Markdig.Syntax.ListItemBlock; - foreach (var ininblock in listItemBlock) - { - //DumpBlock(ininblock); - if (ininblock is Markdig.Syntax.ParagraphBlock) - { - var paragraphBlock = ininblock as Markdig.Syntax.ParagraphBlock; - //DumpParagraphBlock(paragraphBlock); - var str = paragraphBlock.Inline.ToMarkdownString(); - - var properties = new List>>() - { - new Tuple>("**Classe d'armure** ", (m, s) => m.ArmorClass = s), - new Tuple>("**Points de vie** ", (m, s) => m.HitPoints = s), - new Tuple>("**Vitesse** ", (m, s) => m.Speed = s), - new Tuple>("**Résistance aux dégâts** ", (m, s) => m.DamageResistances = s), - new Tuple>("**Résistances aux dégâts** ", (m, s) => m.DamageResistances = s), - new Tuple>("**Résistance contre les dégâts** ", (m, s) => m.DamageResistances = s), - new Tuple>("**Résistances contre les dégâts** ", (m, s) => m.DamageResistances = s), - new Tuple>("**Immunité contre les dégâts** ", (m, s) => m.DamageImmunities = s), - new Tuple>("**Immunité contre des dégâts** ", (m, s) => m.DamageImmunities = s), - new Tuple>("**Immunité aux dégâts** ", (m, s) => m.DamageImmunities = s), - new Tuple>("**Immunité à l'état** ", (m, s) => m.ConditionImmunities = s), - new Tuple>("**Immunités à l'état** ", (m, s) => m.ConditionImmunities = s), - new Tuple>("**Immunité contre l'état** ", (m, s) => m.ConditionImmunities = s), - new Tuple>("**Immunité contre les états** ", (m, s) => m.ConditionImmunities = s), - new Tuple>("**Immunités contre les états** ", (m, s) => m.ConditionImmunities = s), - new Tuple>("**Vulnérabilité aux dégâts** ", (m, s) => m.DamageVulnerabilities = s), - new Tuple>("**Vulnérabilité contre les dégâts** ", (m, s) => m.DamageVulnerabilities = s), - new Tuple>("**Vulnérabilité** ", (m, s) => m.DamageVulnerabilities = s), - new Tuple>("**Sens** ", (m, s) => m.Senses = s), - new Tuple>("**Langue** ", (m, s) => m.Languages = s), - new Tuple>("**Langues** ", (m, s) => m.Languages = s), - new Tuple>("**Dangerosité** ", (m, s) => m.Challenge = s), - new Tuple>("**Jets de sauvegarde** ", (m, s) => m.SavingThrows = s), - new Tuple>("**Jet de sauvegarde** ", (m, s) => m.SavingThrows = s), - new Tuple>("**Compétences** ", (m, s) => m.Skills = s), - new Tuple>("**Compétence** ", (m, s) => m.Skills = s), - - new Tuple>("**Armor Class** ", (m, s) => m.ArmorClass = s), - new Tuple>("**Hit Points** ", (m, s) => m.HitPoints = s), - new Tuple>("**Speed** ", (m, s) => m.Speed = s), - new Tuple>("**Damage Resistance** ", (m, s) => m.DamageResistances = s), - new Tuple>("**Damage Resistances** ", (m, s) => m.DamageResistances = s), - new Tuple>("**Résistance contre les dégâts** ", (m, s) => m.DamageResistances = s), - new Tuple>("**Résistances contre les dégâts** ", (m, s) => m.DamageResistances = s), - new Tuple>("**Damage Immunities** ", (m, s) => m.DamageImmunities = s), - new Tuple>("**Immunité contre des dégâts** ", (m, s) => m.DamageImmunities = s), - new Tuple>("**Immunité aux dégâts** ", (m, s) => m.DamageImmunities = s), - new Tuple>("**Condition Immunities** ", (m, s) => m.ConditionImmunities = s), - new Tuple>("**Immunités à l'état** ", (m, s) => m.ConditionImmunities = s), - new Tuple>("**Immunité contre l'état** ", (m, s) => m.ConditionImmunities = s), - new Tuple>("**Immunité contre les états** ", (m, s) => m.ConditionImmunities = s), - new Tuple>("**Immunités contre les états** ", (m, s) => m.ConditionImmunities = s), - new Tuple>("**Damage Vulnerabilities** ", (m, s) => m.DamageVulnerabilities = s), - new Tuple>("**Vulnérabilité contre les dégâts** ", (m, s) => m.DamageVulnerabilities = s), - new Tuple>("**Vulnérabilité** ", (m, s) => m.DamageVulnerabilities = s), - new Tuple>("**Senses** ", (m, s) => m.Senses = s), - new Tuple>("**Languages** ", (m, s) => m.Languages = s), - new Tuple>("**Langues** ", (m, s) => m.Languages = s), - new Tuple>("**Challenge** ", (m, s) => m.Challenge = s), - new Tuple>("**Saving Throws** ", (m, s) => m.SavingThrows = s), - new Tuple>("**Jet de sauvegarde** ", (m, s) => m.SavingThrows = s), - new Tuple>("**Skills** ", (m, s) => m.Skills = s), - new Tuple>("**Compétence** ", (m, s) => m.Skills = s), - - new Tuple>("AltName: ", (m, s) => m.AltName = s), - - new Tuple>("", (m,s) => - { - if (!string.IsNullOrEmpty(m.Alignment)) - { - App.Current.MainPage.DisplayAlert("Erreur de parsing", s, "OK"); - } - else - { - //Debug.Assert(monster.Alignment == null, str); - var regexx = new Regex("(?.*) de taille (?.*), (?.*)"); - var matchh = regexx.Match(s); - m.Alignment = matchh.Groups["alignment"].Value; - m.Size = matchh.Groups["size"].Value; - m.Type = matchh.Groups["type"].Value; - if(string.IsNullOrEmpty(m.Alignment)) - { - regexx = new Regex("(?.*?) (?.*?), (?.*)"); - matchh = regexx.Match(s); - m.Alignment = matchh.Groups["alignment"].Value; - m.Size = matchh.Groups["size"].Value; - m.Type = matchh.Groups["type"].Value; - } - } - }) - }; - - foreach (var property in properties) - { - if (str.StartsWith(property.Item1)) - { - property.Item2.Invoke(this, str.Substring(property.Item1.Length)); - break; - } - } - } - } - - //DumpListItemBlock(inblock as Markdig.Syntax.ListItemBlock); - } - } - } - else - { - foreach (var inblock in listBlock) - { - if (inblock is Markdig.Syntax.ListItemBlock) - { - var listItemBlock = inblock as Markdig.Syntax.ListItemBlock; - foreach (var ininblock in listItemBlock) - { - //DumpBlock(ininblock); - if (ininblock is Markdig.Syntax.ParagraphBlock) - { - var paragraphBlock = ininblock as Markdig.Syntax.ParagraphBlock; - features?.Add(listBlock.BulletType + " " + paragraphBlock.ToMarkdownString()); - } - } - } - } - } - } - else if (block is Markdig.Extensions.Tables.Table) - { - var tableBlock = block as Markdig.Extensions.Tables.Table; - var table = tableBlock.ToTable(); - if (table.ContainsKey("FOR")) - { - this.Strength = table["FOR"].FirstOrDefault(); - this.Dexterity = table["DEX"].FirstOrDefault(); - this.Constitution = table["CON"].FirstOrDefault(); - this.Intelligence = table["INT"].FirstOrDefault(); - this.Wisdom = table["SAG"].FirstOrDefault(); - this.Charisma = table["CHA"].FirstOrDefault(); - } - else if (table.ContainsKey("STR")) - { - this.Strength = table["STR"].FirstOrDefault(); - this.Dexterity = table["DEX"].FirstOrDefault(); - this.Constitution = table["CON"].FirstOrDefault(); - this.Intelligence = table["INT"].FirstOrDefault(); - this.Wisdom = table["WIS"].FirstOrDefault(); - this.Charisma = table["CHA"].FirstOrDefault(); - } - //else - //{ - features?.Add(tableBlock.ToMarkdownString()); - //} - } - else if (block is Markdig.Syntax.LinkReferenceDefinitionGroup) - { - - var linkReferenceDefinitionGroup = block as Markdig.Syntax.LinkReferenceDefinitionGroup; - - foreach (var linkBlock in linkReferenceDefinitionGroup) - { - var linkReferenceDefinition = linkBlock as Markdig.Syntax.LinkReferenceDefinition; - //linkReferenceDefinition. - } - } - else if (block is Markdig.Syntax.LinkReferenceDefinition) - { - //Debug.WriteLine(block.GetType()); - } - else - { - //Debug.WriteLine(block.GetType()); - } - enumerator.MoveNext(); - } - //} - //finally - - ////if (monster != null) - //{ - // this.SpecialFeatures = specialFeatures; - // this.Actions = actions; - // this.Reactions = reactions; - // this.LegendaryActions = legendaryActions; - // //yield return monster; - //} - } - - } } diff --git a/AideDeJeu/AideDeJeu/Models/Monsters/MonsterHD.cs b/AideDeJeu/AideDeJeu/Models/Monsters/MonsterHD.cs deleted file mode 100644 index c843b58d..00000000 --- a/AideDeJeu/AideDeJeu/Models/Monsters/MonsterHD.cs +++ /dev/null @@ -1,41 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Markdig.Syntax; - -namespace AideDeJeuLib -{ - public class MonsterHD : Monster - { - //public override string Markdown - //{ - // get - // { - // return - // $"# {Name}\n" + - // $"{AltName}\n" + - // $"{Type} de taille {Size}, {Alignment}\n" + - // $"**Classe d'armure** {ArmorClass}\n" + - // $"**Points de vie** {HitPoints}\n" + - // $"**Vitesse** {Speed}\n\n" + - // $"|FOR|DEX|CON|INT|SAG|CHA|\n" + - // $"|---|---|---|---|---|---|\n" + - // $"|{Strength}|{Dexterity}|{Constitution}|{Intelligence}|{Wisdom}|{Charisma}|\n\n" + - // (Skills != null ? $"**Compétences** {Skills}\n" : "") + - // (SavingThrows != null ? $"**Jets de sauvegarde** {SavingThrows}\n" : "") + - // (DamageVulnerabilities != null ? $"**Vulnérabilité aux dégâts** {DamageVulnerabilities}\n" : "") + - // (DamageImmunities != null ? $"**Immunité contre les dégâts** {DamageImmunities}\n" : "") + - // (ConditionImmunities != null ? $"**Immunité contre les états** {ConditionImmunities}\n" : "") + - // (DamageResistances != null ? $"**Résistance aux dégâts** {DamageResistances}\n" : "") + - // $"**Sens** {Senses}\n" + - // $"**Langues** {Languages}\n" + - // $"**Dangerosité** {Challenge}\n\n" + - // (SpecialFeatures != null ? $"## Capacités\n\n" + SpecialFeatures.Aggregate((s1, s2) => s1 + "\n\n" + s2) : "") + - // (Actions != null ? $"## Actions\n\n" + Actions.Aggregate((s1, s2) => s1 + "\n\n" + s2) : "") + - // (Reactions != null ? $"## Réactions\n\n" + Reactions.Aggregate((s1, s2) => s1 + "\n\n" + s2) : "") + - // (LegendaryActions != null ? $"## Actions Légendaires\n\n" + LegendaryActions.Aggregate((s1, s2) => s1 + "\n\n" + s2) : ""); - // } - //} - } -} \ No newline at end of file diff --git a/AideDeJeu/AideDeJeu/Models/Monsters/MonsterVO.cs b/AideDeJeu/AideDeJeu/Models/Monsters/MonsterVO.cs deleted file mode 100644 index 149e6ed1..00000000 --- a/AideDeJeu/AideDeJeu/Models/Monsters/MonsterVO.cs +++ /dev/null @@ -1,41 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using Markdig.Syntax; - -namespace AideDeJeuLib -{ - public class MonsterVO : Monster - { - //public override string Markdown - //{ - // get - // { - // return - // $"# {Name}\n" + - // $"{AltName}\n" + - // $"{Size} {Type}, {Alignment}\n" + - // $"**Armor Class** {ArmorClass}\n" + - // $"**Hit Points** {HitPoints}\n" + - // $"**Speed** {Speed}\n\n" + - // $"|STR|DEX|CON|INT|WIS|CHA|\n" + - // $"|---|---|---|---|---|---|\n" + - // $"|{Strength}|{Dexterity}|{Constitution}|{Intelligence}|{Wisdom}|{Charisma}|\n\n" + - // (Skills != null ? $"**Skills** {Skills}\n" : "") + - // (SavingThrows != null ? $"**Saving Throws** {SavingThrows}\n" : "") + - // (DamageVulnerabilities != null ? $"**Damage Vulnerabilities** {DamageVulnerabilities}\n" : "") + - // (DamageImmunities != null ? $"**Damage Immunities** {DamageImmunities}\n" : "") + - // (ConditionImmunities != null ? $"**Condition Immunities** {ConditionImmunities}\n" : "") + - // (DamageResistances != null ? $"**Damage Resistances** {DamageResistances}\n" : "") + - // $"**Senses** {Senses}\n" + - // $"**Languages** {Languages}\n" + - // $"**Challenge** {Challenge}\n\n" + - // (SpecialFeatures != null ? $"## Special Features\n\n" + SpecialFeatures.Aggregate((s1, s2) => s1 + "\n\n" + s2) : "") + - // (Actions != null ? $"## Actions\n\n" + Actions.Aggregate((s1, s2) => s1 + "\n\n" + s2) : "") + - // (Reactions != null ? $"## Reactions\n\n" + Reactions.Aggregate((s1, s2) => s1 + "\n\n" + s2) : "") + - // (LegendaryActions != null ? $"## Legendary Actions\n\n" + LegendaryActions.Aggregate((s1, s2) => s1 + "\n\n" + s2) : ""); - // } - //} - } -} diff --git a/AideDeJeu/AideDeJeu/Models/Spells/Description.cs b/AideDeJeu/AideDeJeu/Models/Spells/Description.cs deleted file mode 100644 index 981a48ab..00000000 --- a/AideDeJeu/AideDeJeu/Models/Spells/Description.cs +++ /dev/null @@ -1,17 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using Markdig.Syntax; - -namespace AideDeJeuLib -{ - public class Description : Item - { - //public override string Markdown => string.Empty; - - public override void Parse(ref ContainerBlock.Enumerator enumerator) - { - - } - } -} diff --git a/AideDeJeu/AideDeJeu/Models/Spells/Spell.cs b/AideDeJeu/AideDeJeu/Models/Spells/Spell.cs index 1e4a7be2..d0375fe6 100644 --- a/AideDeJeu/AideDeJeu/Models/Spells/Spell.cs +++ b/AideDeJeu/AideDeJeu/Models/Spells/Spell.cs @@ -23,15 +23,5 @@ namespace AideDeJeuLib public string DescriptionHtml { get; set; } public string Source { get; set; } public string Classes { get; set; } - public Description Description { get; set; } - - public virtual string LevelType { get; set; } - - //public override string Markdown => throw new NotImplementedException(); - - public override void Parse(ref ContainerBlock.Enumerator enumerator) - { - throw new NotImplementedException(); - } } } diff --git a/AideDeJeu/AideDeJeu/Models/Spells/SpellHD.cs b/AideDeJeu/AideDeJeu/Models/Spells/SpellHD.cs deleted file mode 100644 index 40b0f5e4..00000000 --- a/AideDeJeu/AideDeJeu/Models/Spells/SpellHD.cs +++ /dev/null @@ -1,178 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Text.RegularExpressions; -using AideDeJeu.Tools; -using Markdig.Syntax; -using Markdig.Syntax.Inlines; - -namespace AideDeJeuLib -{ - public class SpellHD : Spell - { - public override string LevelType - { - get - { - if (int.Parse(Level) > 0) - { - if (string.IsNullOrEmpty(Ritual)) - { - return $"{Type} de niveau {Level}"; - } - else - { - return $"{Type} de niveau {Level} {Ritual}"; - } - } - else - { - return $"{Type}, tour de magie"; - } - } - set - { - var re = new Regex("(?.*) de niveau (?\\d).?(?\\(rituel\\))?"); - var match = re.Match(value); - this.Type = match.Groups["type"].Value; - this.Level = match.Groups["level"].Value; - this.Ritual = match.Groups["rituel"].Value; - if (string.IsNullOrEmpty(this.Type)) - { - re = new Regex("(?.*), (?tour de magie)"); - match = re.Match(value); - if (match.Groups["level"].Value == "tour de magie") - { - this.Type = match.Groups["type"].Value; - this.Level = "0"; // match.Groups["level"].Value; - this.Ritual = match.Groups["rituel"].Value; - } - } - } - } - //public override string Markdown - //{ - // get - // { - // return - // $"# {Name}\n" + - // $"{AltName}\n\n" + - // $"_{LevelType}_\n" + - // $"**Temps d'incantation :** {CastingTime}\n" + - // $"**Portée :** {Range}\n" + - // $"**Composantes :** {Components}\n" + - // $"**Durée :** {Duration}\n" + - // $"**Classes :** {Classes}\n" + - // $"**Source :** {Source}\n" + - // $"\n" + - // $"{DescriptionHtml}"; - // } - //} - - public override void Parse(ref ContainerBlock.Enumerator enumerator) - { - enumerator.MoveNext(); - while (enumerator.Current != null) - { - var block = enumerator.Current; - if (block is Markdig.Syntax.HeadingBlock) - { - var headingBlock = block as Markdig.Syntax.HeadingBlock; - if (headingBlock.HeaderChar == '#' && headingBlock.Level == 1) - { - if (this.Name != null) - { - return; - } - this.Name = headingBlock.Inline.ToMarkdownString(); - } - } - if (block is Markdig.Syntax.ParagraphBlock) - { - if (block.IsNewItem()) - { - return; - } - var paragraphBlock = block as Markdig.Syntax.ParagraphBlock; - - this.DescriptionHtml += paragraphBlock.ToMarkdownString() + "\n"; - } - if (block is Markdig.Syntax.ListBlock) - { - var listBlock = block as Markdig.Syntax.ListBlock; - if (listBlock.BulletType == '-') - { - this.Source = ""; - foreach (var inblock in listBlock) - { - var regex = new Regex("(?.*?): (?.*)"); - if (inblock is Markdig.Syntax.ListItemBlock) - { - var listItemBlock = inblock as Markdig.Syntax.ListItemBlock; - foreach (var ininblock in listItemBlock) - { - if (ininblock is Markdig.Syntax.ParagraphBlock) - { - var paragraphBlock = ininblock as Markdig.Syntax.ParagraphBlock; - var str = paragraphBlock.Inline.ToMarkdownString(); - - var properties = new List>>() - { - new Tuple>("AltName: ", (m, s) => m.AltName = s), - new Tuple>("**Temps d'incantation :** ", (m, s) => m.CastingTime = s), - new Tuple>("**Composantes :** ", (m, s) => m.Components = s), - new Tuple>("**Durée :** ", (m, s) => m.Duration = s), - new Tuple>("LevelType: ", (m, s) => m.LevelType = s), - new Tuple>("**Portée :** ", (m, s) => m.Range = s), - new Tuple>("Source: ", (m, s) => m.Source = s), - new Tuple>("Classes: ", (m, s) => m.Classes = s), - new Tuple>("", (m,s) => - { - }) - }; - - foreach (var property in properties) - { - if (str.StartsWith(property.Item1)) - { - property.Item2.Invoke(this, str.Substring(property.Item1.Length)); - break; - } - } - } - } - } - } - } - else - { - foreach (var inblock in listBlock) - { - if (inblock is Markdig.Syntax.ListItemBlock) - { - var listItemBlock = inblock as Markdig.Syntax.ListItemBlock; - foreach (var ininblock in listItemBlock) - { - if (ininblock is Markdig.Syntax.ParagraphBlock) - { - var paragraphBlock = ininblock as Markdig.Syntax.ParagraphBlock; - this.DescriptionHtml += listBlock.BulletType + " " + paragraphBlock.ToMarkdownString() + "\n"; - } - } - } - } - } - } - else if (block is Markdig.Extensions.Tables.Table) - { - var tableBlock = block as Markdig.Extensions.Tables.Table; - this.DescriptionHtml += "\n\n" + tableBlock.ToMarkdownString() + "\n\n"; - } - enumerator.MoveNext(); - } - - } - - } -} diff --git a/AideDeJeu/AideDeJeu/Models/Spells/SpellVO.cs b/AideDeJeu/AideDeJeu/Models/Spells/SpellVO.cs deleted file mode 100644 index 5889dc1d..00000000 --- a/AideDeJeu/AideDeJeu/Models/Spells/SpellVO.cs +++ /dev/null @@ -1,159 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Text; -using System.Text.RegularExpressions; -using AideDeJeu.Tools; -using Markdig.Syntax; - -namespace AideDeJeuLib -{ - public class SpellVO : Spell - { - public override string LevelType - { - get - { - if (string.IsNullOrEmpty(Ritual)) - { - return $"Level {Level} - {Type}"; - } - else - { - return $"Level {Level} - {Type} {Ritual}"; - } - } - set - { - var re = new Regex("^(?\\d) - (?.*?)\\s?(?\\(ritual\\))?$"); - var match = re.Match(value); - this.Type = match.Groups["type"].Value; - this.Level = match.Groups["level"].Value; - this.Ritual = match.Groups["rituel"].Value; - } - } - - //public override string Markdown - //{ - // get - // { - // return - // $"# {Name}\n" + - // $"{AltName}\n\n" + - // $"_{LevelType}_\n" + - // $"**Casting Time :** {CastingTime}\n" + - // $"**Range :** {Range}\n" + - // $"**Components :** {Components}\n" + - // $"**Duration :** {Duration}\n" + - // $"**Classes :** {Classes}\n" + - // $"**Source :** {Source}\n" + - // $"\n" + - // $"{DescriptionHtml}"; - // } - //} - - public override void Parse(ref ContainerBlock.Enumerator enumerator) - { - enumerator.MoveNext(); - while (enumerator.Current != null) - { - var block = enumerator.Current; - if (block is Markdig.Syntax.HeadingBlock) - { - var headingBlock = block as Markdig.Syntax.HeadingBlock; - if (headingBlock.HeaderChar == '#' && headingBlock.Level == 1) - { - if (this.Name != null) - { - return; - } - this.Name = headingBlock.Inline.ToMarkdownString(); - } - } - if (block is Markdig.Syntax.ParagraphBlock) - { - if (block.IsNewItem()) - { - return; - } - var paragraphBlock = block as Markdig.Syntax.ParagraphBlock; - - this.DescriptionHtml += paragraphBlock.ToMarkdownString() + "\n"; - } - if (block is Markdig.Syntax.ListBlock) - { - var listBlock = block as Markdig.Syntax.ListBlock; - if (listBlock.BulletType == '-') - { - this.Source = ""; - foreach (var inblock in listBlock) - { - var regex = new Regex("(?.*?): (?.*)"); - if (inblock is Markdig.Syntax.ListItemBlock) - { - var listItemBlock = inblock as Markdig.Syntax.ListItemBlock; - foreach (var ininblock in listItemBlock) - { - if (ininblock is Markdig.Syntax.ParagraphBlock) - { - var paragraphBlock = ininblock as Markdig.Syntax.ParagraphBlock; - var str = paragraphBlock.Inline.ToMarkdownString(); - - var properties = new List>>() - { - new Tuple>("AltName: ", (m, s) => m.AltName = s), - new Tuple>("**Casting Time :** ", (m, s) => m.CastingTime = s), - new Tuple>("**Components :** ", (m, s) => m.Components = s), - new Tuple>("**Duration :** ", (m, s) => m.Duration = s), - new Tuple>("LevelType: ", (m, s) => m.LevelType = s), - new Tuple>("**Range :** ", (m, s) => m.Range = s), - new Tuple>("Source: ", (m, s) => m.Source = s), - new Tuple>("Classes: ", (m, s) => m.Classes = s), - new Tuple>("", (m,s) => - { - }) - }; - - foreach (var property in properties) - { - if (str.StartsWith(property.Item1)) - { - property.Item2.Invoke(this, str.Substring(property.Item1.Length)); - break; - } - } - } - } - } - } - } - else - { - foreach (var inblock in listBlock) - { - if (inblock is Markdig.Syntax.ListItemBlock) - { - var listItemBlock = inblock as Markdig.Syntax.ListItemBlock; - foreach (var ininblock in listItemBlock) - { - if (ininblock is Markdig.Syntax.ParagraphBlock) - { - var paragraphBlock = ininblock as Markdig.Syntax.ParagraphBlock; - this.DescriptionHtml += listBlock.BulletType + " " + paragraphBlock.ToMarkdownString() + "\n"; - } - } - } - } - } - } - else if (block is Markdig.Extensions.Tables.Table) - { - var tableBlock = block as Markdig.Extensions.Tables.Table; - this.DescriptionHtml += "\n\n" + tableBlock.ToMarkdownString() + "\n\n"; - } - enumerator.MoveNext(); - } - - } - - } -} diff --git a/AideDeJeu/AideDeJeu/Views/ItemDetailPage.xaml.cs b/AideDeJeu/AideDeJeu/Views/ItemDetailPage.xaml.cs index 3f8f051c..1c77ea6c 100644 --- a/AideDeJeu/AideDeJeu/Views/ItemDetailPage.xaml.cs +++ b/AideDeJeu/AideDeJeu/Views/ItemDetailPage.xaml.cs @@ -35,7 +35,7 @@ namespace AideDeJeu.Views { InitializeComponent(); - var item = new MonsterHD + var item = new Item { Name = "", AltName = "",