Skip to content

Commit c4e8756

Browse files
committed
Version 1.4. This version adds the ability to register accounts with discord names, link accounts with battle.net profiles and automatically list a players highest MMR and race on the beef ladder.
1 parent 0498776 commit c4e8756

19 files changed

+1712
-97
lines changed

Beef/Application.cs

+369-33
Large diffs are not rendered by default.

Beef/Beef.csproj

+10-1
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,6 @@
136136
<Reference Include="System.Security.Cryptography.X509Certificates, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
137137
<HintPath>..\packages\System.Security.Cryptography.X509Certificates.4.3.0\lib\net461\System.Security.Cryptography.X509Certificates.dll</HintPath>
138138
</Reference>
139-
<Reference Include="System.Web" />
140139
<Reference Include="System.Web.Extensions" />
141140
<Reference Include="System.Xml.Linq" />
142141
<Reference Include="System.Data.DataSetExtensions" />
@@ -146,17 +145,27 @@
146145
<Reference Include="System.Xml.ReaderWriter, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
147146
<HintPath>..\packages\System.Xml.ReaderWriter.4.3.0\lib\net46\System.Xml.ReaderWriter.dll</HintPath>
148147
</Reference>
148+
<Reference Include="WindowsBase" />
149149
</ItemGroup>
150150
<ItemGroup>
151151
<Compile Include="Application.cs" />
152152
<Compile Include="BackupManager.cs" />
153153
<Compile Include="BeefEntry.cs" />
154+
<Compile Include="BeefUserConfig.cs" />
155+
<Compile Include="BeefUserConfigManager.cs" />
154156
<Compile Include="ConfigFileManager.cs" />
155157
<Compile Include="ErrorCodes.cs" />
158+
<Compile Include="JsonUtil.cs" />
159+
<Compile Include="MmrReader\LadderInfo.cs" />
160+
<Compile Include="MmrReader\ProfileInfo.cs" />
161+
<Compile Include="MmrReader\ProfileInfoProvider.cs" />
162+
<Compile Include="MmrReader\MmrListener.cs" />
163+
<Compile Include="MmrReader\MmrReader.cs" />
156164
<Compile Include="PresentationManager.cs" />
157165
<Compile Include="Program.cs" />
158166
<Compile Include="Properties\AssemblyInfo.cs" />
159167
<Compile Include="BeefConfig.cs" />
168+
<Compile Include="MmrReader\ReaderConfig.cs" />
160169
</ItemGroup>
161170
<ItemGroup>
162171
<None Include="App.config" />

Beef/BeefConfig.cs

+4-3
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ namespace Beef {
77
/// </summary>
88
public class BeefConfig {
99
// This is the current version and should always be incremented when changing the config file format.
10-
public static int ReaderConfigVersion = 0;
10+
public static int ReaderConfigVersion = 1;
1111

1212
// Version
13-
public int Version { get; set; } = 0; // This identifies the version of the config file.
13+
public int Version { get; set; } = ReaderConfigVersion; // This identifies the version of the config file.
1414

1515
// Discord stuff
1616
public String DiscordBotToken { get; set; } = "";
@@ -23,14 +23,15 @@ public class BeefConfig {
2323
public String GoogleApiApplicationName { get; set; } = "";
2424
public String BeefLadderLink { get; set; } = ""; // This is separate from the presentation ID because you need the readonly link.
2525

26+
public ReaderConfig MmrReaderConfig { get; set; } = ReaderConfig.CreateDefault();
27+
2628
/// <summary>
2729
/// Creates a ReaderConfig with default settings.
2830
/// </summary>
2931
/// <returns>Returns the created config.</returns>
3032
public static BeefConfig CreateDefault() {
3133
// Fill out the default settings and version
3234
BeefConfig config = new BeefConfig();
33-
config.Version = ReaderConfigVersion;
3435

3536
// The credentials are left blank and need to be filled out after
3637
return config;

Beef/BeefEntry.cs

+10
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,15 @@ public int CompareTo(BeefEntry other) {
1313
return 0;
1414
return 1;
1515
}
16+
17+
public BeefEntry() {
18+
// Nothing to do
19+
}
20+
21+
public BeefEntry(BeefEntry other) {
22+
ObjectId = other.ObjectId;
23+
PlayerName = other.PlayerName;
24+
PlayerRank = other.PlayerRank;
25+
}
1626
}
1727
}

Beef/BeefUserConfig.cs

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
using System;
2+
3+
namespace Beef {
4+
/// <summary>
5+
/// Keeps track of information for each user on the Beef ladder.
6+
/// It is persisted to disk in the BeefUsers folder.
7+
/// </summary>
8+
class BeefUserConfig {
9+
// This is the current version and should always be incremented when changing the config file format.
10+
public static int BeefUserVersion = 0;
11+
12+
// This is the persisted version so we know if it's not the latest when we start up.
13+
public int Version = BeefUserVersion;
14+
15+
// User information
16+
public String BeefName = ""; // This is the name that is displayed on the Beef ladder. It must be unique on the ladder.
17+
public String DiscordName = ""; // This is the discord name including the #1234 tag.
18+
19+
public ProfileInfo ProfileInfo = null; // This is information about their profile so we can update their MMR.
20+
21+
public BeefUserConfig(String beefName, String discordName) {
22+
BeefName = beefName;
23+
DiscordName = discordName;
24+
}
25+
26+
public BeefUserConfig(BeefUserConfig other) {
27+
BeefName = other.BeefName;
28+
DiscordName = other.DiscordName;
29+
30+
if (other.ProfileInfo != null)
31+
ProfileInfo = new ProfileInfo(other.ProfileInfo);
32+
else
33+
ProfileInfo = null;
34+
}
35+
36+
public BeefUserConfig() {
37+
// This is so we can deserialize from JSON.
38+
}
39+
40+
public BeefUserConfig Clone() {
41+
return new BeefUserConfig(this);
42+
}
43+
}
44+
}

0 commit comments

Comments
 (0)