fix updater
i feel dumb
This commit is contained in:
parent
75762bd44f
commit
76ead73163
3 changed files with 19 additions and 1 deletions
|
@ -75,6 +75,7 @@
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
</ApplicationDefinition>
|
</ApplicationDefinition>
|
||||||
<Compile Include="Notify.cs" />
|
<Compile Include="Notify.cs" />
|
||||||
|
<Compile Include="StringExt.cs" />
|
||||||
<Compile Include="Util.cs" />
|
<Compile Include="Util.cs" />
|
||||||
<Page Include="MainWindow.xaml">
|
<Page Include="MainWindow.xaml">
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
|
17
EnvyUpdate/StringExt.cs
Normal file
17
EnvyUpdate/StringExt.cs
Normal 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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -111,7 +111,7 @@ namespace EnvyUpdate
|
||||||
string updPath = "https://raw.githubusercontent.com/fyr77/EnvyUpdate/master/res/version.txt";
|
string updPath = "https://raw.githubusercontent.com/fyr77/EnvyUpdate/master/res/version.txt";
|
||||||
|
|
||||||
System.Net.WebClient wc = new System.Net.WebClient();
|
System.Net.WebClient wc = new System.Net.WebClient();
|
||||||
string webData = wc.DownloadString(updPath);
|
string webData = wc.DownloadString(updPath).Truncate(3);
|
||||||
|
|
||||||
return webData;
|
return webData;
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue