fix updater

i feel dumb
This commit is contained in:
Jakob 2019-12-30 21:06:47 +01:00
parent 75762bd44f
commit 76ead73163
3 changed files with 19 additions and 1 deletions

View file

@ -75,6 +75,7 @@
<SubType>Designer</SubType>
</ApplicationDefinition>
<Compile Include="Notify.cs" />
<Compile Include="StringExt.cs" />
<Compile Include="Util.cs" />
<Page Include="MainWindow.xaml">
<Generator>MSBuild:Compile</Generator>

17
EnvyUpdate/StringExt.cs Normal file
View file

@ -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);
}
}
}

View file

@ -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;
}