Fix AutoUpdate for self-builds, #586

This commit is contained in:
JustArchi 2017-07-13 05:37:17 +02:00
parent 6d22b19ef3
commit db149d16a7
5 changed files with 12 additions and 4 deletions

View file

@ -37,6 +37,7 @@ using ArchiSteamFarm.Localization;
namespace ArchiSteamFarm {
internal static class ASF {
private const byte AutoUpdatePeriodInHours = 24;
private const string DefaultVersion = "source"; // Default entry of ArchiSteamFarm.version
internal static readonly ArchiLogger ArchiLogger = new ArchiLogger(SharedInfo.ASF);
@ -81,6 +82,10 @@ namespace ArchiSteamFarm {
return;
}
if (version.Equals(DefaultVersion)) {
return;
}
if ((AutoUpdatesTimer == null) && Program.GlobalConfig.AutoUpdates) {
TimeSpan autoUpdatePeriod = TimeSpan.FromHours(AutoUpdatePeriodInHours);
@ -290,6 +295,7 @@ namespace ArchiSteamFarm {
}
switch (version) {
case DefaultVersion:
case "generic":
case "linux-arm":
case "linux-x64":

View file

@ -44,6 +44,9 @@
</ItemGroup>
<ItemGroup>
<None Update="ArchiSteamFarm.version">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="config\ASF.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>

View file

@ -0,0 +1 @@
source

View file

@ -184,9 +184,7 @@ namespace ArchiSteamFarm {
ParsePostInitArgs(args);
}
if (!Debugging.IsDebugBuild) {
await ASF.CheckForUpdate().ConfigureAwait(false);
}
await ASF.CheckForUpdate().ConfigureAwait(false);
await ASF.InitBots().ConfigureAwait(false);
ASF.InitEvents();

View file

@ -33,7 +33,7 @@ after_test:
dotnet publish -c "$env:CONFIGURATION" -r "$RUNTIME" -o "out\$RUNTIME"
}
Add-Content "ArchiSteamFarm\out\$RUNTIME\ArchiSteamFarm.version" "$RUNTIME"
Set-Content -Path "ArchiSteamFarm\out\$RUNTIME\ArchiSteamFarm.version" -Value "$RUNTIME"
7z a -bd -tzip -mm=Deflate64 -mx=5 "ArchiSteamFarm\out\ASF-$RUNTIME.zip" "$env:APPVEYOR_BUILD_FOLDER\ArchiSteamFarm\out\$RUNTIME\*"
Push-AppveyorArtifact "ArchiSteamFarm\out\ASF-$RUNTIME.zip" -FileName "ASF-$RUNTIME.zip" -DeploymentName "ASF-$RUNTIME.zip"