-
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.
Error Logging to Crash file, Restart on error, seperation of class in…
…to other files.
- Loading branch information
1 parent
c316b8f
commit baa51bf
Showing
10 changed files
with
233 additions
and
185 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
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,49 @@ | ||
using Newtonsoft.Json; | ||
using PlayerCountBots; | ||
using System.Collections.Generic; | ||
|
||
namespace PlayerCountBot | ||
{ | ||
class BotConfig | ||
{ | ||
[JsonProperty] | ||
public int _updateTime { get; set; } | ||
|
||
[JsonProperty] | ||
public string _steamAPIKey { get; set; } | ||
|
||
|
||
[JsonProperty] | ||
public bool _isDebug { get; set; } | ||
|
||
[JsonProperty] | ||
public List<DayZServerBot> _serverInformation; | ||
|
||
public BotConfig() | ||
{ | ||
_serverInformation = new List<DayZServerBot>(); | ||
} | ||
|
||
public void CreateDefaults() | ||
{ | ||
_serverInformation.Add(new DayZServerBot("VPPTestBot", "127.0.0.1:2532", "DiscordTokenHere")); | ||
_updateTime = 30; | ||
_steamAPIKey = "SteamAPIKeyHere"; | ||
} | ||
public List<string> GetAddresses() | ||
{ | ||
List<string> addresses = new List<string>(); | ||
|
||
foreach (DayZServerBot bot in _serverInformation) | ||
{ | ||
string ipAddress = bot.botAddress.Split(":")[0]; | ||
|
||
if (!addresses.Contains(ipAddress)) | ||
{ | ||
addresses.Add(ipAddress); | ||
} | ||
} | ||
return addresses; | ||
} | ||
} | ||
} |
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,23 @@ | ||
using Newtonsoft.Json; | ||
|
||
namespace PlayerCountBot | ||
{ | ||
class DayZServerBot | ||
{ | ||
[JsonProperty] | ||
public string botName { get; set; } | ||
|
||
[JsonProperty] | ||
public string botAddress { get; set; } | ||
|
||
[JsonProperty] | ||
public string discordBotToken { get; set; } | ||
|
||
public DayZServerBot(string name, string address, string discordKey) | ||
{ | ||
botName = name; | ||
botAddress = address; | ||
discordBotToken = discordKey; | ||
} | ||
} | ||
} |
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
Oops, something went wrong.