Code cleanup

This commit is contained in:
JustArchi
2016-12-18 16:03:32 +01:00
parent 4404874e52
commit 7fe65144c1
5 changed files with 32 additions and 8 deletions

View File

@@ -169,11 +169,19 @@ namespace ArchiSteamFarm {
ClientMsgProtobuf<CMsgClientGamesPlayed> request = new ClientMsgProtobuf<CMsgClientGamesPlayed>(EMsg.ClientGamesPlayed);
if (!string.IsNullOrEmpty(gameName)) {
request.Body.games_played.Add(new CMsgClientGamesPlayed.GamePlayed { game_extra_info = gameName, game_id = new GameID { AppType = GameID.GameType.Shortcut, ModID = uint.MaxValue } });
request.Body.games_played.Add(new CMsgClientGamesPlayed.GamePlayed {
game_extra_info = gameName,
game_id = new GameID {
AppType = GameID.GameType.Shortcut,
ModID = uint.MaxValue
}
});
}
foreach (uint gameID in gameIDs.Where(gameID => gameID != 0)) {
request.Body.games_played.Add(new CMsgClientGamesPlayed.GamePlayed { game_id = new GameID(gameID) });
request.Body.games_played.Add(new CMsgClientGamesPlayed.GamePlayed {
game_id = new GameID(gameID)
});
}
Client.Send(request);

View File

@@ -286,7 +286,9 @@ namespace ArchiSteamFarm {
}
internal static string GetAPIStatus() {
var response = new { Bots };
var response = new {
Bots
};
try {
return JsonConvert.SerializeObject(response);
@@ -1342,7 +1344,17 @@ namespace ArchiSteamFarm {
}
// Inform the steam servers that we're accepting this sentry file
SteamUser.SendMachineAuthResponse(new SteamUser.MachineAuthDetails { JobID = callback.JobID, FileName = callback.FileName, BytesWritten = callback.BytesToWrite, FileSize = fileSize, Offset = callback.Offset, Result = EResult.OK, LastError = 0, OneTimePassword = callback.OneTimePassword, SentryFileHash = sentryHash });
SteamUser.SendMachineAuthResponse(new SteamUser.MachineAuthDetails {
JobID = callback.JobID,
FileName = callback.FileName,
BytesWritten = callback.BytesToWrite,
FileSize = fileSize,
Offset = callback.Offset,
Result = EResult.OK,
LastError = 0,
OneTimePassword = callback.OneTimePassword,
SentryFileHash = sentryHash
});
}
private void OnNotifications(ArchiHandler.NotificationsCallback callback) {

View File

@@ -1,4 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<Weavers>
<Costura IncludeDebugSymbols='false' />
</Weavers>

View File

@@ -440,7 +440,10 @@ namespace ArchiSteamFarm.JSON {
foreach (Item item in ItemsToReceive) {
Dictionary<Item.EType, uint> itemsPerType;
if (!itemsToReceivePerGame.TryGetValue(item.RealAppID, out itemsPerType)) {
itemsPerType = new Dictionary<Item.EType, uint> { [item.Type] = item.Amount };
itemsPerType = new Dictionary<Item.EType, uint> {
{ item.Type, item.Amount }
};
itemsToReceivePerGame[item.RealAppID] = itemsPerType;
} else {
uint amount;

View File

@@ -36,15 +36,15 @@ namespace ArchiSteamFarm {
private readonly Bot Bot;
private readonly SemaphoreSlim Semaphore = new SemaphoreSlim(1);
private bool HasAutomatedTrading => Bot.HasMobileAuthenticator && Bot.HasValidApiKey;
private bool SteamTradeMatcher => Bot.BotConfig.TradingPreferences.HasFlag(BotConfig.ETradingPreferences.SteamTradeMatcher);
private string LastAvatarHash;
private DateTime LastHeartBeat = DateTime.MinValue;
private bool? LastMatchEverything;
private string LastNickname;
private bool ShouldSendHeartBeats;
private bool HasAutomatedTrading => Bot.HasMobileAuthenticator && Bot.HasValidApiKey;
private bool SteamTradeMatcher => Bot.BotConfig.TradingPreferences.HasFlag(BotConfig.ETradingPreferences.SteamTradeMatcher);
internal Statistics(Bot bot) {
if (bot == null) {
throw new ArgumentNullException(nameof(bot));