This commit is contained in:
JustArchi
2015-10-31 06:09:03 +01:00
parent 71227168cf
commit 3ba90e5d6d
5 changed files with 55 additions and 13 deletions

View File

@@ -83,6 +83,7 @@
<Compile Include="Bot.cs" /> <Compile Include="Bot.cs" />
<Compile Include="CardsFarmer.cs" /> <Compile Include="CardsFarmer.cs" />
<Compile Include="CMsgClientClanInviteAction.cs" /> <Compile Include="CMsgClientClanInviteAction.cs" />
<Compile Include="Debugging.cs" />
<Compile Include="Logging.cs" /> <Compile Include="Logging.cs" />
<Compile Include="Program.cs" /> <Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
@@ -108,6 +109,9 @@
</BootstrapperPackage> </BootstrapperPackage>
</ItemGroup> </ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PostBuildEvent>(ROBOCOPY $(ProjectDir)config $(TargetDir)config /S /E) ^&amp; IF %25ERRORLEVEL%25 LEQ 1 exit 0</PostBuildEvent>
</PropertyGroup>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets. Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild"> <Target Name="BeforeBuild">

View File

@@ -63,7 +63,7 @@ namespace ArchiSteamFarm {
internal string SteamParentalPIN { get; private set; } = "0"; internal string SteamParentalPIN { get; private set; } = "0";
internal ulong SteamMasterID { get; private set; } = 76561198006963719; internal ulong SteamMasterID { get; private set; } = 76561198006963719;
internal ulong SteamMasterClanID { get; private set; } = 0; internal ulong SteamMasterClanID { get; private set; } = 0;
internal bool ShutdownOnFarmingFinished { get; private set; } = true; internal bool ShutdownOnFarmingFinished { get; private set; } = false;
internal HashSet<uint> Blacklist { get; private set; } = new HashSet<uint> { 368020 }; internal HashSet<uint> Blacklist { get; private set; } = new HashSet<uint> { 368020 };
internal bool Statistics { get; private set; } = true; internal bool Statistics { get; private set; } = true;

View File

@@ -52,6 +52,7 @@ namespace ArchiSteamFarm {
} }
Logging.LogGenericInfo(Bot.BotName, "Checking badges..."); Logging.LogGenericInfo(Bot.BotName, "Checking badges...");
// Find the number of badge pages // Find the number of badge pages
HtmlDocument badgesDocument = await Bot.ArchiWebHandler.GetBadgePage(1).ConfigureAwait(false); HtmlDocument badgesDocument = await Bot.ArchiWebHandler.GetBadgePage(1).ConfigureAwait(false);
if (badgesDocument == null) { if (badgesDocument == null) {

View File

@@ -0,0 +1,40 @@
/*
_ _ _ ____ _ _____
/ \ _ __ ___ | |__ (_)/ ___| | |_ ___ __ _ _ __ ___ | ___|__ _ _ __ _ __ ___
/ _ \ | '__|/ __|| '_ \ | |\___ \ | __|/ _ \ / _` || '_ ` _ \ | |_ / _` || '__|| '_ ` _ \
/ ___ \ | | | (__ | | | || | ___) || |_| __/| (_| || | | | | || _|| (_| || | | | | | | |
/_/ \_\|_| \___||_| |_||_||____/ \__|\___| \__,_||_| |_| |_||_| \__,_||_| |_| |_| |_|
Copyright 2015 Łukasz "JustArchi" Domeradzki
Contact: JustArchi@JustArchi.net
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
using System.Diagnostics;
namespace ArchiSteamFarm {
internal static class Debugging {
internal static bool IsReleaseBuild { get; private set; } = true;
static Debugging() {
MarkIfDebug();
}
[Conditional("DEBUG")]
private static void MarkIfDebug() {
IsReleaseBuild = false;
}
}
}

View File

@@ -43,9 +43,11 @@ namespace ArchiSteamFarm {
internal const string ConfigDirectoryPath = "config"; internal const string ConfigDirectoryPath = "config";
private const string LatestGithubReleaseURL = "https://api.github.com/repos/JustArchi/ArchiSteamFarm/releases/latest"; private const string LatestGithubReleaseURL = "https://api.github.com/repos/JustArchi/ArchiSteamFarm/releases/latest";
private static readonly ManualResetEvent ShutdownResetEvent = new ManualResetEvent(false);
internal static readonly object ConsoleLock = new object(); internal static readonly object ConsoleLock = new object();
internal static string Version { get { return Assembly.GetExecutingAssembly().GetName().Version.ToString(); } } private static readonly ManualResetEvent ShutdownResetEvent = new ManualResetEvent(false);
private static readonly AssemblyName AssemblyName = Assembly.GetExecutingAssembly().GetName();
private static readonly string ExeName = AssemblyName.Name + ".exe";
private static readonly string Version = AssemblyName.Version.ToString();
private static async Task CheckForUpdate() { private static async Task CheckForUpdate() {
JObject response = await Utilities.UrlToJObject(LatestGithubReleaseURL).ConfigureAwait(false); JObject response = await Utilities.UrlToJObject(LatestGithubReleaseURL).ConfigureAwait(false);
@@ -60,16 +62,16 @@ namespace ArchiSteamFarm {
string localVersion = Version; string localVersion = Version;
if (localVersion.CompareTo(remoteVersion) < 0) {
Logging.LogGenericNotice("", "New version is available!");
Logging.LogGenericNotice("", "Local version: " + localVersion); Logging.LogGenericNotice("", "Local version: " + localVersion);
Logging.LogGenericNotice("", "Remote version: " + remoteVersion); Logging.LogGenericNotice("", "Remote version: " + remoteVersion);
int comparisonResult = localVersion.CompareTo(remoteVersion);
if (localVersion.CompareTo(remoteVersion) < 0) {
Logging.LogGenericNotice("", "New version is available!");
Logging.LogGenericNotice("", "Consider updating yourself!"); Logging.LogGenericNotice("", "Consider updating yourself!");
Thread.Sleep(5000); Thread.Sleep(5000);
} else if (localVersion.CompareTo(remoteVersion) > 0) { } else if (localVersion.CompareTo(remoteVersion) > 0) {
Logging.LogGenericNotice("", "You're currently using pre-release version!"); Logging.LogGenericNotice("", "You're currently using pre-release version!");
Logging.LogGenericNotice("", "Local version: " + localVersion);
Logging.LogGenericNotice("", "Remote version: " + remoteVersion);
Logging.LogGenericNotice("", "Be careful!"); Logging.LogGenericNotice("", "Be careful!");
} }
} }
@@ -118,11 +120,6 @@ namespace ArchiSteamFarm {
Task.Run(async () => await CheckForUpdate().ConfigureAwait(false)).Wait(); Task.Run(async () => await CheckForUpdate().ConfigureAwait(false)).Wait();
// Config directory may not be in the same directory as the .exe, check maximum of 3 levels lower
for (var i = 0; i < 4 && !Directory.Exists(ConfigDirectoryPath); i++) {
Directory.SetCurrentDirectory("..");
}
if (!Directory.Exists(ConfigDirectoryPath)) { if (!Directory.Exists(ConfigDirectoryPath)) {
Logging.LogGenericError("Main", "Config directory doesn't exist!"); Logging.LogGenericError("Main", "Config directory doesn't exist!");
Console.ReadLine(); Console.ReadLine();