diff --git a/WaGis IP-Blacklister/Form1.cs b/WaGis IP-Blacklister/Form1.cs index 24c9080..4dca744 100644 --- a/WaGis IP-Blacklister/Form1.cs +++ b/WaGis IP-Blacklister/Form1.cs @@ -197,7 +197,9 @@ private void btnADD_Click(object sender, EventArgs e) //Only grab all IPv4/6 IPs/ranges and put them in a List - allips.AddRange(Regex.Matches(richtbList.Text, @"((?:^|(?<=\s))(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))(?=\s|$)|\b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b)") + //IPv6 CIDR aka. IP-Range support REGEX by WaGi-Coding--- (\b((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]d|1dd|[1-9]?d)(.(25[0-5]|2[0-4]d|1dd|[1-9]?d)){3}))|:)))(%.+)?s*(\/([0-9]|[1-9][0-9]|1[0-1][0-9]|12[0-8]))?\b)(?!\/) + //IPv4 CIDR aka IP-Range support by WaGi-Coding---- (\b([0-9]{1,3}\.){3}[0-9]{1,3}(\/([0-9]|[1-2][0-9]|3[0-2]))?\b)(?!\/) + allips.AddRange(Regex.Matches(richtbList.Text, @"((\b((([0-9A-Fa-f]{1,4}:){7}([0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)(?!\/))") .Cast() .Select(m => m.Value) .ToList()); diff --git a/WaGis IP-Blacklister/Properties/AssemblyInfo.cs b/WaGis IP-Blacklister/Properties/AssemblyInfo.cs index d0cbeec..79c7ee3 100644 --- a/WaGis IP-Blacklister/Properties/AssemblyInfo.cs +++ b/WaGis IP-Blacklister/Properties/AssemblyInfo.cs @@ -20,5 +20,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.3.6")] -[assembly: AssemblyFileVersion("1.3.6")] +[assembly: AssemblyVersion("1.3.7")] +[assembly: AssemblyFileVersion("1.3.7")] diff --git a/WaGis IP-Blacklister/Update.cs b/WaGis IP-Blacklister/Update.cs index 81a21dc..8778381 100644 --- a/WaGis IP-Blacklister/Update.cs +++ b/WaGis IP-Blacklister/Update.cs @@ -1,4 +1,5 @@ -using Newtonsoft.Json.Linq; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; using System; using System.Collections.Generic; using System.ComponentModel; @@ -65,11 +66,35 @@ protected String WaGiRequest(string url) } } + List fullInfo; private void Update_Load(object sender, EventArgs e) { try { + Version curV = new Version(Application.ProductVersion); + jsonData = WaGiRequest("https://api.github.com/repos/WaGi-Coding/WaGis-Mass-IP-Blacklister-Windows/releases/latest"); + + var jsonArr = JArray.Parse(WaGiRequest("https://api.github.com/repos/WaGi-Coding/WaGis-Mass-IP-Blacklister-Windows/releases")); + fullInfo = new List(); + + foreach (JObject jO in jsonArr) + { + Version tempVersion = new Version(jO.SelectToken("tag_name").ToString()); + + if (curV.CompareTo(tempVersion) < 0) + { + Console.WriteLine(tempVersion); + fullInfo.Add(((jsonArr.First == jO) ? "" : "\n\n") + tempVersion.ToString() + ':'); + fullInfo.Add(jO.SelectToken("body").ToString().Split(new string[] { "---" }, StringSplitOptions.None)[1].Replace('*', '●')); + } + else + { + break; + } + + + } JObject jObject = JObject.Parse(jsonData); newV = Convert.ToString(jObject.SelectToken("tag_name")); @@ -81,7 +106,7 @@ private void Update_Load(object sender, EventArgs e) } catch (Exception) { - MessageBox.Show("Seems there is an Update, but a Problem with resolving the newest Version. Checkout yourself for the new Version on Github or SourceForge", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); + MessageBox.Show("Seems there is an Update, but a Problem with resolving the newest Version Data. Checkout yourself for the new Version on Github or SourceForge", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } newVersion = new Version(newV); curVersion = new Version(Application.ProductVersion); @@ -100,9 +125,8 @@ private void Update_Load(object sender, EventArgs e) btnDownload.Enabled = true; } - string[] bodyArray = body.Split(new string[] { "---" }, StringSplitOptions.None); - - richTextBox1.Text = bodyArray[1].Replace('*', '●'); + //richTextBox1.Text = body.Split(new string[] { "---" }, StringSplitOptions.None)[1].Replace('*', '●'); + richTextBox1.Text = string.Join("\n", fullInfo); } }