mirror of
https://github.com/Nioux/AideDeJeu.git
synced 2025-10-29 22:45:44 +00:00
Améliorations sorts
This commit is contained in:
parent
b6a48565c2
commit
3e8dad4e49
6 changed files with 5047 additions and 3561 deletions
|
|
@ -25,6 +25,55 @@ namespace AideDeJeuLib
|
|||
}
|
||||
}
|
||||
|
||||
public void ParseBlock(Block block)
|
||||
{
|
||||
if (block is HeadingBlock)
|
||||
{
|
||||
var headingBlock = block as HeadingBlock;
|
||||
if (this.Name == null)
|
||||
{
|
||||
this.Name = headingBlock.Inline.ToMarkdownString();
|
||||
}
|
||||
this.Text += block.ToMarkdownString();
|
||||
}
|
||||
else if (block is ListBlock)
|
||||
{
|
||||
var listBlock = block as ListBlock;
|
||||
if (listBlock.BulletType == '-')
|
||||
{
|
||||
var regex = new Regex("(?<key>.*?): (?<value>.*)");
|
||||
var str = block.ToMarkdownString();
|
||||
var properties = new List<Tuple<string, Action<Generic, string>>>()
|
||||
{
|
||||
new Tuple<string, Action<Generic, string>>("- AltName: ", (m, s) =>
|
||||
{
|
||||
this.Text += "- " + s; m.AltName = s;
|
||||
}),
|
||||
new Tuple<string, Action<Generic, string>>("", (m, s) =>
|
||||
{
|
||||
this.Text += str;
|
||||
}),
|
||||
};
|
||||
|
||||
foreach (var property in properties)
|
||||
{
|
||||
if (str.StartsWith(property.Item1))
|
||||
{
|
||||
property.Item2.Invoke(this, str.Substring(property.Item1.Length));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.Text += block.ToMarkdownString();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.Text += block.ToMarkdownString();
|
||||
}
|
||||
}
|
||||
public override void Parse(ref ContainerBlock.Enumerator enumerator)
|
||||
{
|
||||
enumerator.MoveNext();
|
||||
|
|
@ -35,53 +84,7 @@ namespace AideDeJeuLib
|
|||
{
|
||||
return;
|
||||
}
|
||||
if (block is HeadingBlock)
|
||||
{
|
||||
var headingBlock = block as HeadingBlock;
|
||||
if (this.Name == null)
|
||||
{
|
||||
this.Name = headingBlock.Inline.ToMarkdownString();
|
||||
}
|
||||
this.Text += block.ToMarkdownString();
|
||||
}
|
||||
else if (block is ListBlock)
|
||||
{
|
||||
var listBlock = block as ListBlock;
|
||||
if (listBlock.BulletType == '-')
|
||||
{
|
||||
var regex = new Regex("(?<key>.*?): (?<value>.*)");
|
||||
var str = block.ToMarkdownString();
|
||||
var properties = new List<Tuple<string, Action<Generic, string>>>()
|
||||
{
|
||||
new Tuple<string, Action<Generic, string>>("- AltName: ", (m, s) =>
|
||||
{
|
||||
this.Text += "- " + s; m.AltName = s;
|
||||
}),
|
||||
new Tuple<string, Action<Generic, string>>("", (m, s) =>
|
||||
{
|
||||
this.Text += str;
|
||||
}),
|
||||
};
|
||||
|
||||
foreach (var property in properties)
|
||||
{
|
||||
if (str.StartsWith(property.Item1))
|
||||
{
|
||||
property.Item2.Invoke(this, str.Substring(property.Item1.Length));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.Text += block.ToMarkdownString();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.Text += block.ToMarkdownString();
|
||||
}
|
||||
|
||||
ParseBlock(block);
|
||||
enumerator.MoveNext();
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,111 +22,8 @@ namespace AideDeJeuLib
|
|||
public string Duration { get; set; }
|
||||
public string DescriptionHtml { get; set; }
|
||||
public string Source { get; set; }
|
||||
public string Classes { get; set; }
|
||||
|
||||
public abstract string LevelType { get; set; }
|
||||
|
||||
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("(?<key>.*?): (?<value>.*)");
|
||||
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<Tuple<string, Action<Spell, string>>>()
|
||||
{
|
||||
new Tuple<string, Action<Spell, string>>("AltName: ", (m, s) => m.AltName = s),
|
||||
new Tuple<string, Action<Spell, string>>("CastingTime: ", (m, s) => m.CastingTime = s),
|
||||
new Tuple<string, Action<Spell, string>>("Components: ", (m, s) => m.Components = s),
|
||||
new Tuple<string, Action<Spell, string>>("Duration: ", (m, s) => m.Duration = s),
|
||||
new Tuple<string, Action<Spell, string>>("LevelType: ", (m, s) => m.LevelType = s),
|
||||
new Tuple<string, Action<Spell, string>>("Range: ", (m, s) => m.Range = s),
|
||||
new Tuple<string, Action<Spell, string>>("Source: ", (m, s) => m.Source = s),
|
||||
new Tuple<string, Action<Spell, string>>("Classes: ", (m, s) => m.Source += s),
|
||||
new Tuple<string, Action<Spell, string>>("", (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();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -57,18 +57,122 @@ namespace AideDeJeuLib
|
|||
{
|
||||
return
|
||||
$"# {Name}\n" +
|
||||
$"{AltName}\n" +
|
||||
$"{AltName}\n\n" +
|
||||
$"_{LevelType}_\n" +
|
||||
$"**Temps d'incantation :** {CastingTime}\n" +
|
||||
$"**Portée :** {Range}\n" +
|
||||
$"**Composantes :** {Components}\n" +
|
||||
$"**Durée :** {Duration}\n\n" +
|
||||
$"{DescriptionHtml}\n\n" +
|
||||
$"**Source :** {Source}";
|
||||
|
||||
$"**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("(?<key>.*?): (?<value>.*)");
|
||||
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<Tuple<string, Action<Spell, string>>>()
|
||||
{
|
||||
new Tuple<string, Action<Spell, string>>("AltName: ", (m, s) => m.AltName = s),
|
||||
new Tuple<string, Action<Spell, string>>("**Temps d'incantation :** ", (m, s) => m.CastingTime = s),
|
||||
new Tuple<string, Action<Spell, string>>("**Composantes :** ", (m, s) => m.Components = s),
|
||||
new Tuple<string, Action<Spell, string>>("**Durée :** ", (m, s) => m.Duration = s),
|
||||
new Tuple<string, Action<Spell, string>>("LevelType: ", (m, s) => m.LevelType = s),
|
||||
new Tuple<string, Action<Spell, string>>("**Portée :** ", (m, s) => m.Range = s),
|
||||
new Tuple<string, Action<Spell, string>>("Source: ", (m, s) => m.Source = s),
|
||||
new Tuple<string, Action<Spell, string>>("Classes: ", (m, s) => m.Classes = s),
|
||||
new Tuple<string, Action<Spell, string>>("", (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();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using AideDeJeu.Tools;
|
||||
using Markdig.Syntax;
|
||||
|
||||
namespace AideDeJeuLib
|
||||
|
|
@ -37,17 +38,122 @@ namespace AideDeJeuLib
|
|||
{
|
||||
return
|
||||
$"# {Name}\n" +
|
||||
$"{AltName}\n" +
|
||||
$"{AltName}\n\n" +
|
||||
$"_{LevelType}_\n" +
|
||||
$"**Casting Time :** {CastingTime}\n" +
|
||||
$"**Range :** {Range}\n" +
|
||||
$"**Components :** {Components}\n" +
|
||||
$"**Duration :** {Duration}\n\n" +
|
||||
$"{DescriptionHtml}\n\n" +
|
||||
$"**Source :** {Source}";
|
||||
|
||||
$"**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("(?<key>.*?): (?<value>.*)");
|
||||
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<Tuple<string, Action<Spell, string>>>()
|
||||
{
|
||||
new Tuple<string, Action<Spell, string>>("AltName: ", (m, s) => m.AltName = s),
|
||||
new Tuple<string, Action<Spell, string>>("**Casting Time :** ", (m, s) => m.CastingTime = s),
|
||||
new Tuple<string, Action<Spell, string>>("**Components :** ", (m, s) => m.Components = s),
|
||||
new Tuple<string, Action<Spell, string>>("**Duration :** ", (m, s) => m.Duration = s),
|
||||
new Tuple<string, Action<Spell, string>>("LevelType: ", (m, s) => m.LevelType = s),
|
||||
new Tuple<string, Action<Spell, string>>("**Range :** ", (m, s) => m.Range = s),
|
||||
new Tuple<string, Action<Spell, string>>("Source: ", (m, s) => m.Source = s),
|
||||
new Tuple<string, Action<Spell, string>>("Classes: ", (m, s) => m.Classes = s),
|
||||
new Tuple<string, Action<Spell, string>>("", (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();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
4347
Data/spells_hd.md
4347
Data/spells_hd.md
File diff suppressed because it is too large
Load diff
3829
Data/spells_vo.md
3829
Data/spells_vo.md
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue