diff --git a/EnvyUpdate/EnvyUpdate.csproj b/EnvyUpdate/EnvyUpdate.csproj index edcf909..c773f85 100644 --- a/EnvyUpdate/EnvyUpdate.csproj +++ b/EnvyUpdate/EnvyUpdate.csproj @@ -75,6 +75,7 @@ Designer + MSBuild:Compile diff --git a/EnvyUpdate/StringExt.cs b/EnvyUpdate/StringExt.cs new file mode 100644 index 0000000..7f421b5 --- /dev/null +++ b/EnvyUpdate/StringExt.cs @@ -0,0 +1,17 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace EnvyUpdate +{ + public static class StringExt + { + public static string Truncate(this string value, int maxLength) + { + if (string.IsNullOrEmpty(value)) return value; + return value.Length <= maxLength ? value : value.Substring(0, maxLength); + } + } +} diff --git a/EnvyUpdate/Util.cs b/EnvyUpdate/Util.cs index f4a1ba1..9a10b15 100644 --- a/EnvyUpdate/Util.cs +++ b/EnvyUpdate/Util.cs @@ -111,7 +111,7 @@ namespace EnvyUpdate string updPath = "https://raw.githubusercontent.com/fyr77/EnvyUpdate/master/res/version.txt"; System.Net.WebClient wc = new System.Net.WebClient(); - string webData = wc.DownloadString(updPath); + string webData = wc.DownloadString(updPath).Truncate(3); return webData; }