This repository has been archived by the owner on Sep 5, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
151 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Net; | ||
using System.Text; | ||
using Newtonsoft.Json; | ||
using Newtonsoft.Json.Linq; | ||
|
||
namespace ASFui | ||
{ | ||
public class Api | ||
{ | ||
private readonly Bot.Root _data; | ||
public Api(string result) | ||
{ | ||
_data = JsonConvert.DeserializeObject<Bot.Root>(result); | ||
} | ||
|
||
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(); | ||
|
||
foreach (var bot in GetBots()) | ||
{ | ||
result.Append(@"◈ Bot: " + bot + Environment.NewLine); | ||
result.Append(@" ⟐ Active: " + _data.Bot[bot].KeepRunning + Environment.NewLine); | ||
|
||
var games = _data.Bot[bot].CardsFarmer.GamesToFarm; | ||
if (games.Keys.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); | ||
} | ||
} | ||
else | ||
{ | ||
result.Append(@" ⟐ Games to Farm: None" + Environment.NewLine); | ||
} | ||
|
||
|
||
var farming = _data.Bot[bot].CardsFarmer.CurrentGamesFarming; | ||
if (farming.Count > 0) | ||
{ | ||
result.Append(@" ⟐ Current Farming:" + Environment.NewLine); | ||
|
||
foreach (var game in farming) | ||
{ | ||
result.Append(@" ◇ " + GetAppName(game) + Environment.NewLine); | ||
} | ||
} | ||
else | ||
{ | ||
result.Append(@" ⟐ Current Farming: Nothing" + Environment.NewLine); | ||
} | ||
|
||
result.Append(@" ⟐ Manual: " + _data.Bot[bot].CardsFarmer.ManualMode + Environment.NewLine); | ||
|
||
result.Append(Environment.NewLine); | ||
} | ||
|
||
return result.ToString(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
using System.Collections.Generic; | ||
using Newtonsoft.Json; | ||
|
||
namespace ASFui | ||
{ | ||
public class Bot | ||
{ | ||
public class Root | ||
{ | ||
[JsonProperty("Bots")] | ||
public Dictionary<string, Bots> Bot { get; set; } | ||
} | ||
|
||
public class Bots | ||
{ | ||
[JsonProperty("CardsFarmer")] | ||
public CardsFarmer CardsFarmer { get; set; } | ||
|
||
[JsonProperty("KeepRunning")] | ||
public bool KeepRunning { get; set; } | ||
} | ||
|
||
public class CardsFarmer | ||
{ | ||
[JsonProperty("GamesToFarm")] | ||
public Dictionary<uint, float> GamesToFarm { get; set; } | ||
|
||
[JsonProperty("CurrentGamesFarming")] | ||
public HashSet<uint> CurrentGamesFarming { get; set; } | ||
|
||
[JsonProperty("ManualMode")] | ||
public bool ManualMode { get; set; } | ||
} | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
0.3.2.0 | ||
0.3.3.0 |