Skip to content
This repository has been archived by the owner on Sep 5, 2019. It is now read-only.

Commit

Permalink
Compatibility with ASF v2.1.3.9
Browse files Browse the repository at this point in the history
  • Loading branch information
alvr committed Aug 6, 2016
1 parent c069adc commit a471bb2
Show file tree
Hide file tree
Showing 13 changed files with 92 additions and 52 deletions.
21 changes: 6 additions & 15 deletions ASFui/API.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
using System;
using System.Collections.Generic;
using System.Net;
using System.Text;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;

namespace ASFui
{
Expand All @@ -20,14 +18,6 @@ private IEnumerable<string> GetBots()
return _data.Bot.Keys;
}

private static string GetAppName(uint id)
{
var url = "http://store.steampowered.com/api/appdetails?appids=" + id;
var content = new WebClient().DownloadString(url);
var json = JObject.Parse(content);
return json[id.ToString()]["data"]["name"].ToString();
}

public string AllApi()
{
var result = new StringBuilder();
Expand All @@ -38,15 +28,16 @@ public string AllApi()
result.Append(@" ⟐ Active: " + _data.Bot[bot].KeepRunning + Environment.NewLine);

var games = _data.Bot[bot].CardsFarmer.GamesToFarm;
if (games.Keys.Count > 0)
if (games.Count > 0)
{
result.Append(@" ⟐ Games to Farm:" + Environment.NewLine);

foreach (var game in games)
{
var timePlayed = TimeSpan.FromHours(game.Value);
result.Append(@" ◇ " + GetAppName(game.Key) + @"; Time Farmed: "
+ string.Format("{0:00}:{1:00}", timePlayed.Hours, timePlayed.Minutes) + Environment.NewLine);
var timePlayed = TimeSpan.FromHours(game.HoursPlayed);
result.Append(@" ◇ " + game.GameName + @"; Hours Played: "
+ $"{timePlayed.Hours:00}:{timePlayed.Minutes:00}"
+ @"; Cards Remaining: " + game.CardsRemaining + Environment.NewLine);
}
}
else
Expand All @@ -62,7 +53,7 @@ public string AllApi()

foreach (var game in farming)
{
result.Append(@" ◇ " + GetAppName(game) + Environment.NewLine);
result.Append(@" ◇ " + game.GameName + Environment.NewLine);
}
}
else
Expand Down
47 changes: 18 additions & 29 deletions ASFui/ASFui.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions ASFui/ASFui.cs
Original file line number Diff line number Diff line change
Expand Up @@ -609,7 +609,6 @@ private void EnableElements()
btnASFVersion.Enabled = true;
btnAPI.Enabled = true;
btn2FA.Enabled = true;
btn2FAOff.Enabled = true;
btn2FAOk.Enabled = true;
btn2FANo.Enabled = true;
}
Expand Down Expand Up @@ -638,7 +637,6 @@ private void DisableElements()
btnASFVersion.Enabled = false;
btnAPI.Enabled = false;
btn2FA.Enabled = false;
btn2FAOff.Enabled = false;
btn2FAOk.Enabled = false;
btn2FANo.Enabled = false;

Expand Down
3 changes: 3 additions & 0 deletions ASFui/ASFui.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,9 @@
<Content Include="NLog.config">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<None Include="Resources\settings.png" />
<None Include="Resources\refresh.png" />
<None Include="Resources\help.png" />
<None Include="NLog.xsd">
<SubType>Designer</SubType>
</None>
Expand Down
23 changes: 20 additions & 3 deletions ASFui/Bot.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using Newtonsoft.Json;

namespace ASFui
{
[SuppressMessage("ReSharper", "InconsistentNaming")]
public class Bot
{
public class Root
Expand All @@ -23,14 +25,29 @@ public class Bots
public class CardsFarmer
{
[JsonProperty("GamesToFarm")]
public Dictionary<uint, float> GamesToFarm { get; set; }
public HashSet<Game> GamesToFarm { get; set; }

[JsonProperty("CurrentGamesFarming")]
public HashSet<uint> CurrentGamesFarming { get; set; }
public HashSet<Game> CurrentGamesFarming { get; set; }

[JsonProperty("ManualMode")]
public bool ManualMode { get; set; }
}

public class Game
{
[JsonProperty("AppID")]
public uint AppID { get; set; }

[JsonProperty("GameName")]
public string GameName { get; set; }

[JsonProperty("HoursPlayed")]
public float HoursPlayed { get; set; }

[JsonProperty("CardsRemaining")]
public ushort CardsRemaining { get; set; }
}

}
}
}
2 changes: 2 additions & 0 deletions ASFui/Client.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.ServiceModel;
using System.ServiceModel.Channels;
using Newtonsoft.Json;

namespace ASFui
{
Expand Down
4 changes: 2 additions & 2 deletions ASFui/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,5 @@
// Puede especificar todos los valores o usar los valores predeterminados de número de compilación y de revisión
// mediante el carácter '*', como se muestra a continuación:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.3.3.0")]
[assembly: AssemblyFileVersion("0.3.3.0")]
[assembly: AssemblyVersion("0.3.4.0")]
[assembly: AssemblyFileVersion("0.3.4.0")]
30 changes: 30 additions & 0 deletions ASFui/Properties/Resources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions ASFui/Properties/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -1784,4 +1784,14 @@
AAAAAAAAAAAAAAAAAAAAAAAA
</value>
</data>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="help" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\help.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="refresh" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\refresh.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="settings" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\settings.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>
Binary file added ASFui/Resources/help.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ASFui/Resources/refresh.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ASFui/Resources/settings.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.3.3.0
0.3.4.0

0 comments on commit a471bb2

Please sign in to comment.