From 9e296c370082db2cf674b9aabfb259080991ef99 Mon Sep 17 00:00:00 2001 From: Yan Maniez Date: Thu, 16 Jan 2020 17:19:03 +0100 Subject: [PATCH] Test --- AideDeJeu/AideDeJeuCmd/Program.cs | 33 +++ Docs/alariantest.html | 397 +++++++++++++++--------------- 2 files changed, 232 insertions(+), 198 deletions(-) diff --git a/AideDeJeu/AideDeJeuCmd/Program.cs b/AideDeJeu/AideDeJeuCmd/Program.cs index a00f97f5..f7d66cc2 100644 --- a/AideDeJeu/AideDeJeuCmd/Program.cs +++ b/AideDeJeu/AideDeJeuCmd/Program.cs @@ -15,6 +15,7 @@ using System.Runtime.Serialization.Json; using System.Text; using System.Text.RegularExpressions; using System.Threading.Tasks; +using System.Xml; using Xamarin.Forms; using YamlDotNet.Serialization; using YamlDotNet.Serialization.NamingConventions; @@ -358,6 +359,7 @@ namespace AideDeJeuCmd Console.WriteLine("p : test pdf"); Console.WriteLine("h : extract html"); Console.WriteLine("y : extract yaml"); + Console.WriteLine("m : convert maps"); Console.WriteLine("q : quitter"); var key = Console.ReadKey(true); switch (key.KeyChar) @@ -387,12 +389,43 @@ namespace AideDeJeuCmd await ExtractYamlAsync(); Console.WriteLine("/ extract yaml"); break; + case 'm': + Console.WriteLine("> convert maps"); + await ConvertMapsAsync(); + Console.WriteLine("/ convert maps"); + break; case 'q': return; } } } + static async Task ConvertMapsAsync() + { + HtmlAgilityPack.HtmlDocument document = new HtmlAgilityPack.HtmlDocument(); + document.Load(@"..\..\..\..\..\Docs\Osgild\ferrance.map.html"); + var svg = new XmlDocument(); + var svgElt = svg.CreateElement("svg", "http://www.w3.org/2000/svg"); + svg.AppendChild(svgElt); + var areas = document.DocumentNode.SelectNodes("//area"); + foreach(var area in areas) + { + var coords = area.GetAttributeValue("coords", ""); + var coordsSplit = coords.Split(","); + + var a = svg.CreateElement("a"); + a.SetAttribute("href", area.GetAttributeValue("href", "")); + a.SetAttribute("target", area.GetAttributeValue("target", "")); + var rect = svg.CreateElement("rect"); + rect.SetAttribute("x", coordsSplit[0]); + var title = svg.CreateElement("title"); + title.InnerText = area.GetAttributeValue("alt", ""); + rect.AppendChild(title); + a.AppendChild(rect); + svgElt.AppendChild(a); + } + } + static async Task ExtractYamlAsync() { var tomeOfBeasts = await LoadStringAsync(@"..\..\..\..\..\Data\tome_of_beasts.md"); diff --git a/Docs/alariantest.html b/Docs/alariantest.html index 11bd9ff2..ebcda9a1 100644 --- a/Docs/alariantest.html +++ b/Docs/alariantest.html @@ -19,10 +19,10 @@ var slider = document.getElementById("myRange"); var output = document.getElementById("myImage"); var mySvg = document.getElementById("mySvg"); - output.style.width = "" + slider.value + "%"; + //output.style.width = "" + slider.value + "%"; mySvg.style.width = "" + slider.value + "%"; slider.oninput = function() { - output.style.width = "" + this.value + "%"; + //output.style.width = "" + this.value + "%"; mySvg.style.width = "" + slider.value + "%"; } } @@ -42,12 +42,13 @@ - Alarian + - + + - + Kraod @@ -58,981 +59,981 @@ Kraod - + Shaïa Daod - + ??1 - + Heim-Hav - + Törnod - + Ragkaod - + Detad - + Vulfnar - + Ragd-Hav - + Aelod - + Tzagid - + Roldur - + Jerndal - + Arn - + Berg - + Agtod-hav - + Abod - + Sejer - + Jotun - + Akh - + Afen - + Rzomyad - + Gojd - + Frija 1 ? - + Tjarom - + Otgeir - + Friel - + Erk - + Frija 2 ? - + Rikke - + Azamp-hav - + Shreven-hav - + Duin-hav - + Mihn-hav 1 ? - + Mihn-hav 2 ? - + Yfondh - + Weilgen - + Kalank-hav - + Bizeim - + Minheim - + Fos-hav - + Ru-hav - + Sossel-hav - + Boidenelm ou Lechan ? - + Burdel - + Mistudh - + Ar-hav - + Arna - + Fil-hav - + Trizan-hav - + Pel-hav - + Misgen - + ??2 - + Yniz - + Hillenrell - + Gleaor - + Fingein - + Chateau-Milon - + Baran - + Luzon - + ?? 107 - + - + ?? 109 - + Frima - + Mielhm - + ?? 112 - + Got - + Ylous - + Ponto - + Hügin - + Fort-lun - + Troisile - + Rama - + Mas-rouge - + Alnaad - + Tallien - + Eswir - + Essa - + Eloz - + Boidel - + Chateau-lahute - + ?? 128 - + Haute-bannière - + Talbeth-Hav - + Yriell - + Kerzok - + Lynn - + Karn - + Bryon - + Noirok - + Pryel - + Barall - + Thahad-Kohök - + Mörn - + Linceul - + Roc-Hav - + Ynha - + Lehün - + Yehav - + Orha - + Tarah - + Yomhalin - + Gipelli - + Bradnstoni - + Menillo - + Castel Rü - + Rüyaden - + Pool - + Rundale - + Kalid-da - + Nola - + Gwym - + Shelin - + Sleblin - + Marloed - + Llenry - + Shtaff - + Lamphey-Alta - + Kalgharne - + Karst-Balamer - + Castel Crin - + Castel Roc 1 ? - + Castel Roc 2 ? - + Castel Andelin - + Andelin - + Emlin - + Fordin - + Tenbin - + Naylin - + Castel d'Or - + Tenwyr - + Nimue - + Laudin - + Ysawe - + Tour-les-hauts - + Elemon - + Kern-endel - + Braill - + Irfley - + Sertal - + Bors - + ?? 201 - + Awain - + Gamord - + Nefva - + Tour-le-chêne - + Greth - + Tour Ywaine - + Galehaut - + Linor - + Keu - + Erec - + Gher-Noircav - + Cavendir - + Cavand - + Cro - + Seneol - + Vala - + Shamaen - + Fort-du-Rhü - + Adha - + Diran - + Threned - + Fort-Lahin - + Lahin - + Thël - + Ilik - + Boissin - + Uilin - + Enlë - + Delwë - + Wa'al - + Feulin - + Wëolin - + Frell - + Brüm - + Alaëhn - + Nilin-Oloran - + Fort-Kei - + Flamlin - + Fort-Elor - + Fort-Ithil - + Demon-Astang - + Draganlin - + Dran - + Fort-Hilyen - + Fort-Buhlan - + ?? 301 - + Velolia - + Astudipshir - + Saub - + Yatsim - + Jost - + Bloseon