From 6285967d1cf6e9322f584de761eea31ade32b3e5 Mon Sep 17 00:00:00 2001 From: TrueDoctor Date: Mon, 1 Oct 2018 02:28:42 +0200 Subject: Completed Weapon import function to automagically load data from an dsa website into the database --- DSACore/Auxiliary/WeaponImporter.cs | 177 ++++++++++++++++++++++++++++++++++++ DSACore/DSA_Game/Dsa.cs | 7 +- DSACore/FireBase/Database.cs | 13 ++- DSACore/Hubs/ChatHub.cs | 40 ++++++-- DSACore/Models/Database/Group.cs | 3 + DSACore/Models/Database/Weapon.cs | 40 +++++++- DSACore/Models/Network/Group.cs | 24 +++++ 7 files changed, 285 insertions(+), 19 deletions(-) create mode 100644 DSACore/Auxiliary/WeaponImporter.cs diff --git a/DSACore/Auxiliary/WeaponImporter.cs b/DSACore/Auxiliary/WeaponImporter.cs new file mode 100644 index 0000000..7a5a182 --- /dev/null +++ b/DSACore/Auxiliary/WeaponImporter.cs @@ -0,0 +1,177 @@ +using DSACore.Models.Database; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net.Http; +using System.Text.RegularExpressions; +using System.Threading.Tasks; +using DSACore.FireBase; +using Group = System.Text.RegularExpressions.Group; + +namespace DSACore.Auxiliary +{ + public class WeaponImporter + { + private List Weapons = new List(); + private List Range = new List(); + + public async Task DownloadWeapons() + { + var client = new HttpClient(); + + + + for (int i = 18; i <= 25; i++) + { + var responseString = await client.GetStringAsync("http://diarium.eu/dsa4-forge/ajax/categoryChanged/" + i); + + Regex talentRegex = new Regex(@"(?<=