Compare commits

...

10 Commits

Author SHA1 Message Date
JustArchi
c27deb20a8 AppVeyor: Misc 2017-07-15 05:21:25 +02:00
JustArchi
b231abf19f AppVeyor: Webhook test 2017-07-15 04:45:44 +02:00
JustArchi
f17f2959b7 Don't put foil cards by default in matchable types, #586 2017-07-14 17:16:45 +02:00
JustArchi
9f7886df3f Travis: Cleanup 2017-07-14 16:55:34 +02:00
JustArchi
ecc0dac4d9 Closes #593 2017-07-14 16:24:30 +02:00
JustArchi
e2f9ebc715 Travis: bump to preview2 2017-07-14 16:08:13 +02:00
JustArchi
93716218a5 Misc 2017-07-13 06:08:52 +02:00
JustArchi
db149d16a7 Fix AutoUpdate for self-builds, #586 2017-07-13 05:37:17 +02:00
JustArchi
6d22b19ef3 Announce MatchableTypes 2017-07-10 23:04:33 +02:00
JustArchi
0f6cf10179 Bump 2017-07-10 17:48:36 +02:00
14 changed files with 88 additions and 54 deletions

View File

@@ -17,44 +17,44 @@ mono: none
# ASF requires .NET Core 2.0+
# TODO: We should target stable 2.0.0 once it's released
# TODO: Update at least to preview2 once https://github.com/travis-ci/travis-ci/issues/8037 is fixed
# TODO: Add --no-restore to dotnet test when we get preview2+
dotnet: 2.0.0-preview1-005977
dotnet: 2.0.0-preview2-006497
env:
global:
- DOTNET_CLI_TELEMETRY_OPTOUT: 1
- DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
before_script: dotnet restore
script:
- set -e
- dotnet restore
- dotnet build -c Release
- dotnet test -c Release --no-build ArchiSteamFarm.Tests
- dotnet publish -c Release -o out/generic
- echo "generic" > "ArchiSteamFarm/out/generic/ArchiSteamFarm.version"
- dotnet publish -c Release -r win-x64 -o out/win-x64
- echo "win-x64" > "ArchiSteamFarm/out/win-x64/ArchiSteamFarm.version"
- dotnet publish -c Release -r linux-x64 -o out/linux-x64
- echo "linux-x64" > "ArchiSteamFarm/out/linux-x64/ArchiSteamFarm.version"
- dotnet publish -c Release -r linux-arm -o out/linux-arm
- echo "linux-arm" > "ArchiSteamFarm/out/linux-arm/ArchiSteamFarm.version"
- dotnet publish -c Release -r osx-x64 -o out/osx-x64
- echo "osx-x64" > "ArchiSteamFarm/out/osx-x64/ArchiSteamFarm.version"
- |
set -e
RUNTIMES="generic win-x64 linux-x64 linux-arm osx-x64"
dotnet build -c Release
dotnet test -c Release --no-build --no-restore ArchiSteamFarm.Tests
for RUNTIME in $RUNTIMES; do
if [ "$RUNTIME" = "generic" ]; then
dotnet publish -c Release -o "out/${RUNTIME}"
else
dotnet publish -c Release -r "$RUNTIME" -o "out/${RUNTIME}"
fi
echo "$RUNTIME" > "ArchiSteamFarm/out/${RUNTIME}/ArchiSteamFarm.version"
done
matrix:
# We can use fast finish, as we don't need to wait for allow_failures builds to mark build as success
fast_finish: true
allow_failures:
# TODO: We allow OS X to fail until https://github.com/travis-ci/travis-ci/issues/7757 is fixed
- os: osx
include:
# We're building ASF with dotnet on latest versions of Linux and OS X
# Ref: https://docs.travis-ci.com/user/ci-environment/#Virtualization-environments
# Ref: https://docs.travis-ci.com/user/trusty-ci-environment/
# Ref: https://docs.travis-ci.com/user/osx-ci-environment/
- os: linux
# Ref: https://docs.travis-ci.com/user/trusty-ci-environment/
dist: trusty
sudo: false
- os: osx
# Ref: https://docs.travis-ci.com/user/osx-ci-environment/
osx_image: xcode9

Binary file not shown.

After

Width:  |  Height:  |  Size: 281 KiB

View File

@@ -5,7 +5,17 @@
<TargetFramework>netcoreapp2.0</TargetFramework>
<LangVersion>latest</LangVersion>
<ErrorReport>none</ErrorReport>
<ApplicationIcon>ASF.ico</ApplicationIcon>
<Copyright>Copyright © ArchiSteamFarm 2015-2017</Copyright>
<RuntimeIdentifiers>win-x64;linux-x64;linux-arm;osx-x64</RuntimeIdentifiers>
<Description>ASF is an application that allows you to farm steam cards using multiple steam accounts simultaneously.</Description>
<Authors>JustArchi</Authors>
<Company>JustArchi</Company>
<PackageLicenseUrl>http://www.apache.org/licenses/LICENSE-2.0</PackageLicenseUrl>
<PackageProjectUrl>https://github.com/JustArchi/ArchiSteamFarm</PackageProjectUrl>
<RepositoryUrl>https://github.com/JustArchi/ArchiSteamFarm.git</RepositoryUrl>
<PackageIconUrl>https://github.com/JustArchi/ArchiSteamFarm/raw/master/resources/ASF.ico</PackageIconUrl>
<RepositoryType>Git</RepositoryType>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">

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

@@ -3,14 +3,21 @@
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.0</TargetFramework>
<AssemblyVersion>3.0.0.4</AssemblyVersion>
<FileVersion>3.0.0.4</FileVersion>
<LangVersion>7</LangVersion>
<AssemblyVersion>3.0.0.5</AssemblyVersion>
<FileVersion>3.0.0.5</FileVersion>
<LangVersion>latest</LangVersion>
<ErrorReport>none</ErrorReport>
<ApplicationIcon>ASF.ico</ApplicationIcon>
<Copyright>Copyright © ArchiSteamFarm 2015-2017</Copyright>
<RuntimeIdentifiers>win-x64;linux-x64;linux-arm;osx-x64</RuntimeIdentifiers>
<Description>ASF is an application that allows you to farm steam cards using multiple steam accounts simultaneously.</Description>
<Authors>JustArchi</Authors>
<Company>JustArchi</Company>
<PackageLicenseUrl>http://www.apache.org/licenses/LICENSE-2.0</PackageLicenseUrl>
<PackageProjectUrl>https://github.com/JustArchi/ArchiSteamFarm</PackageProjectUrl>
<RepositoryUrl>https://github.com/JustArchi/ArchiSteamFarm.git</RepositoryUrl>
<PackageIconUrl>https://github.com/JustArchi/ArchiSteamFarm/raw/master/resources/ASF.ico</PackageIconUrl>
<RepositoryType>Git</RepositoryType>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
@@ -19,7 +26,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="HtmlAgilityPack" Version="1.5.2-beta1" />
<PackageReference Include="HtmlAgilityPack" Version="1.5.2-beta2" />
<PackageReference Include="Humanizer" Version="2.2.0" />
<PackageReference Include="Newtonsoft.Json" Version="10.0.3" />
<PackageReference Include="Nito.AsyncEx.Coordination" Version="5.0.0-pre-02" />
@@ -44,6 +51,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

@@ -82,7 +82,6 @@ namespace ArchiSteamFarm {
private readonly SemaphoreSlim InitializationSemaphore = new SemaphoreSlim(1);
private readonly SemaphoreSlim LootingSemaphore = new SemaphoreSlim(1);
private readonly ConcurrentHashSet<uint> OwnedPackageIDs = new ConcurrentHashSet<uint>();
private readonly Statistics Statistics;
private readonly SteamApps SteamApps;
private readonly SteamClient SteamClient;

View File

@@ -94,7 +94,6 @@ namespace ArchiSteamFarm {
[JsonProperty(ObjectCreationHandling = ObjectCreationHandling.Replace, Required = Required.DisallowNull)]
internal readonly HashSet<Steam.Item.EType> MatchableTypes = new HashSet<Steam.Item.EType> {
Steam.Item.EType.FoilTradingCard,
Steam.Item.EType.TradingCard
};

View File

@@ -28,10 +28,8 @@ using ArchiSteamFarm.Localization;
namespace ArchiSteamFarm {
internal static class OS {
private static readonly PlatformID PlatformID = Environment.OSVersion.Platform;
internal static void Init(bool headless) {
switch (PlatformID) {
switch (Environment.OSVersion.Platform) {
case PlatformID.Win32NT:
case PlatformID.Win32S:
case PlatformID.Win32Windows:
@@ -76,7 +74,7 @@ namespace ArchiSteamFarm {
private static class NativeMethods {
internal const uint EnableQuickEditMode = 0x0040;
internal const int StandardInputHandle = -10;
internal const sbyte StandardInputHandle = -10;
[DllImport("kernel32.dll", CharSet = CharSet.Auto)]
internal static extern bool GetConsoleMode(IntPtr hConsoleHandle, out uint lpMode);

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

@@ -28,19 +28,20 @@ using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using ArchiSteamFarm.JSON;
using Newtonsoft.Json;
using SteamKit2;
namespace ArchiSteamFarm {
internal sealed class Statistics : IDisposable {
private const byte MinAnnouncementCheckTTL = 6; // Minimum amount of hours we must wait before checking eligibility for Announcement, should be lower than MinPersonaStateTTL
private const byte MinCardsCount = 100; // Minimum amount of cards to be eligible for public listing
private const byte MinHeartBeatTTL = 10; // Minimum amount of minutes we must wait before sending next HeartBeat
private const byte MinItemsCount = 100; // Minimum amount of items to be eligible for public listing
private const byte MinPersonaStateTTL = 8; // Minimum amount of hours we must wait before requesting persona state update
private const string URL = "https://" + SharedInfo.StatisticsServer;
private readonly Bot Bot;
private readonly SemaphoreSlim Semaphore = new SemaphoreSlim(1);
private DateTime LastAnnouncementCheck = DateTime.MinValue;
private DateTime LastHeartBeat = DateTime.MinValue;
private DateTime LastPersonaStateRequest = DateTime.MinValue;
@@ -97,7 +98,7 @@ namespace ArchiSteamFarm {
// Don't announce if we don't meet conditions
string tradeToken;
if (!Bot.HasMobileAuthenticator || !Bot.BotConfig.TradingPreferences.HasFlag(BotConfig.ETradingPreferences.SteamTradeMatcher) || !await Bot.ArchiWebHandler.HasValidApiKey().ConfigureAwait(false) || !await Bot.ArchiWebHandler.HasPublicInventory().ConfigureAwait(false) || string.IsNullOrEmpty(tradeToken = await Bot.ArchiWebHandler.GetTradeToken().ConfigureAwait(false))) {
if (!Bot.HasMobileAuthenticator || !Bot.BotConfig.TradingPreferences.HasFlag(BotConfig.ETradingPreferences.SteamTradeMatcher) || (Bot.BotConfig.MatchableTypes.Count == 0) || !await Bot.ArchiWebHandler.HasValidApiKey().ConfigureAwait(false) || !await Bot.ArchiWebHandler.HasPublicInventory().ConfigureAwait(false) || string.IsNullOrEmpty(tradeToken = await Bot.ArchiWebHandler.GetTradeToken().ConfigureAwait(false))) {
LastAnnouncementCheck = DateTime.UtcNow;
ShouldSendHeartBeats = false;
return;
@@ -113,8 +114,6 @@ namespace ArchiSteamFarm {
}
}
bool matchEverything = Bot.BotConfig.TradingPreferences.HasFlag(BotConfig.ETradingPreferences.MatchEverything);
await Semaphore.WaitAsync().ConfigureAwait(false);
try {
@@ -122,7 +121,7 @@ namespace ArchiSteamFarm {
return;
}
HashSet<Steam.Item> inventory = await Bot.ArchiWebHandler.GetMySteamInventory(true, new HashSet<Steam.Item.EType> { Steam.Item.EType.TradingCard }).ConfigureAwait(false);
HashSet<Steam.Item> inventory = await Bot.ArchiWebHandler.GetMySteamInventory(true, Bot.BotConfig.MatchableTypes).ConfigureAwait(false);
// This is actually inventory failure, so we'll stop sending heartbeats but not record it as valid check
if (inventory == null) {
@@ -131,21 +130,22 @@ namespace ArchiSteamFarm {
}
// This is actual inventory
if (inventory.Count < MinCardsCount) {
if (inventory.Count < MinItemsCount) {
LastAnnouncementCheck = DateTime.UtcNow;
ShouldSendHeartBeats = false;
return;
}
const string request = URL + "/api/Announce";
Dictionary<string, string> data = new Dictionary<string, string>(7) {
Dictionary<string, string> data = new Dictionary<string, string>(8) {
{ "SteamID", Bot.SteamID.ToString() },
{ "Guid", Program.GlobalDatabase.Guid.ToString("N") },
{ "Nickname", nickname },
{ "AvatarHash", avatarHash },
{ "MatchEverything", matchEverything ? "1" : "0" },
{ "MatchableTypes", JsonConvert.SerializeObject(Bot.BotConfig.MatchableTypes) },
{ "MatchEverything", Bot.BotConfig.TradingPreferences.HasFlag(BotConfig.ETradingPreferences.MatchEverything) ? "1" : "0" },
{ "TradeToken", tradeToken },
{ "CardsCount", inventory.Count.ToString() }
{ "ItemsCount", inventory.Count.ToString() }
};
// We don't need retry logic here

View File

@@ -152,12 +152,12 @@ namespace ArchiSteamFarm {
internal async Task<T> UrlGetToJsonResultRetry<T>(string request, string referer = null) {
if (string.IsNullOrEmpty(request)) {
ArchiLogger.LogNullError(nameof(request));
return default(T);
return default;
}
string json = await UrlGetToContentRetry(request, referer).ConfigureAwait(false);
if (string.IsNullOrEmpty(json)) {
return default(T);
return default;
}
try {
@@ -169,7 +169,7 @@ namespace ArchiSteamFarm {
ArchiLogger.LogGenericDebug(string.Format(Strings.Content, json));
}
return default(T);
return default;
}
}
@@ -277,12 +277,12 @@ namespace ArchiSteamFarm {
internal async Task<T> UrlPostToJsonResultRetry<T>(string request, ICollection<KeyValuePair<string, string>> data = null, string referer = null) {
if (string.IsNullOrEmpty(request)) {
ArchiLogger.LogNullError(nameof(request));
return default(T);
return default;
}
string json = await UrlPostToContentRetry(request, data, referer).ConfigureAwait(false);
if (string.IsNullOrEmpty(json)) {
return default(T);
return default;
}
try {
@@ -294,7 +294,7 @@ namespace ArchiSteamFarm {
ArchiLogger.LogGenericDebug(string.Format(Strings.Content, json));
}
return default(T);
return default;
}
}

View File

@@ -16,7 +16,6 @@
5
],
"MatchableTypes": [
3,
5
],
"PasswordFormat": 0,

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"
@@ -52,4 +52,18 @@ deploy:
on:
branch: master
configuration: Release
appveyor_repo_tag: true
appveyor_repo_tag: true
notifications:
- provider: Webhook
url:
secure: i/og7KzkpbcWcKoUubrLH+KB6bkfqA55FHUlGxLepLmgZNQeNMiMoAFICOFY795fFrFfUNUKqwk7ApXE6HUyWMoiijLj7G/JBLTPkBiTCu8fZMTMqwQm6FiHB3+/0h0C+ukcrBEqnXYSQUh6znpKqJSTrIfXUQ7ftNuC966kBAw=
method: POST
body: >-
{
"avatar_url": "https://www.appveyor.com/assets/img/appveyor-logo-256.png",
"username": "AppVeyor",
"content": "[{{projectName}}:{{branch}}] {{commitMessage}} - {{committerName}} ({{commitId}}) | **{{status}}** | {{buildUrl}}"
}
on_build_success: true
on_build_failure: true
on_build_status_changed: false