This repository has been archived by the owner on Oct 20, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
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
13 changed files
with
586 additions
and
83 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,19 @@ | ||
using System; | ||
using System.Globalization; | ||
using System.Windows; | ||
using System.Windows.Data; | ||
|
||
namespace HuntMmrReader.Converters; | ||
|
||
internal class BooleanToVisibilityConverter : IValueConverter | ||
{ | ||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) | ||
{ | ||
return value is true ? Visibility.Visible : Visibility.Collapsed; | ||
} | ||
|
||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) | ||
{ | ||
throw new NotSupportedException(); | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
HuntMmrReader/Converters/PlayerOptionsToBooleanConverter.cs
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,21 @@ | ||
using System; | ||
using System.Globalization; | ||
using System.Windows.Data; | ||
using HuntMmrReader.Enums; | ||
|
||
namespace HuntMmrReader.Converters; | ||
|
||
internal class PlayerOptionsToBooleanConverter : IValueConverter | ||
{ | ||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) | ||
{ | ||
if (value is PlayerOptions playerOptionsValue && parameter is PlayerOptions playerOptionsParameter) | ||
return playerOptionsValue.HasFlag(playerOptionsParameter); | ||
return false; | ||
} | ||
|
||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) | ||
{ | ||
throw new NotSupportedException(); | ||
} | ||
} |
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,86 @@ | ||
using System; | ||
using System.ComponentModel; | ||
|
||
namespace HuntMmrReader.Enums; | ||
|
||
/// <summary> | ||
/// Player options | ||
/// </summary> | ||
[Flags] | ||
internal enum PlayerOptions | ||
{ | ||
///<summary>Default value.</summary> | ||
None = 0, | ||
|
||
///<summary>This should be a string.</summary> | ||
[Description("blood_line_name")] BloodLineName = 1, | ||
|
||
///<summary>This should be a ushort.</summary> | ||
[Description("bountyextracted")] BountyExtracted = 2, | ||
|
||
///<summary>This should be a ushort.</summary> | ||
[Description("bountypickedup")] BountyPickedUp = 4, | ||
|
||
///<summary>This should be a ushort.</summary> | ||
[Description("downedbyme")] DownedByMe = 8, | ||
|
||
///<summary>This should be a ushort.</summary> | ||
[Description("downedbyteammate")] DownedByTeammate = 16, | ||
|
||
///<summary>This should be a ushort.</summary> | ||
[Description("downedme")] DownedMe = 32, | ||
|
||
///<summary>This should be a ushort.</summary> | ||
[Description("downedteammate")] DownedTeammate = 64, | ||
|
||
///<summary>This should be a bool.</summary> | ||
[Description("hadWellspring")] HadWellspring = 128, | ||
|
||
///<summary>This should be a bool.</summary> | ||
[Description("hadbounty")] HadBounty = 256, | ||
|
||
///<summary>This should be a bool.</summary> | ||
[Description("ispartner")] IsPartner = 512, | ||
|
||
///<summary>This should be a bool.</summary> | ||
[Description("issoulsurvivor")] IsSoulSurvivor = 1024, | ||
|
||
///<summary>This should be a ushort.</summary> | ||
[Description("killedbyme")] KilledByMe = 2048, | ||
|
||
///<summary>This should be a ushort.</summary> | ||
[Description("killedbyteammate")] KilledByTeammate = 4096, | ||
|
||
///<summary>This should be a ushort.</summary> | ||
[Description("killedme")] KilledMe = 8192, | ||
|
||
///<summary>This should be a ushort.</summary> | ||
[Description("killedteammate")] KilledTeammate = 16384, | ||
|
||
///<summary>This should be a ushort.</summary> | ||
[Description("mmr")] Mmr = 32768, | ||
|
||
///<summary>This should be a ulong.</summary> | ||
[Description("profileid")] ProfileId = 65536, | ||
|
||
///<summary>This should be a bool.</summary> | ||
[Description("proximity")] Proximity = 131072, | ||
|
||
///<summary>This should be a bool.</summary> | ||
[Description("proximitytome")] ProximityToMe = 262144, | ||
|
||
///<summary>This should be a bool.</summary> | ||
[Description("proximitytoteammate")] ProximityToTeammate = 524288, | ||
|
||
///<summary>This should be a bool.</summary> | ||
[Description("skillbased")] SkillBased = 1048576, | ||
|
||
///<summary>This should be a bool.</summary> | ||
[Description("teamextraction")] TeamExtraction = 2097152, | ||
|
||
///<summary>All values combined.</summary> | ||
All = BloodLineName | BountyExtracted | BountyPickedUp | DownedByMe | DownedByTeammate | DownedMe | DownedTeammate | | ||
HadWellspring | HadBounty | IsPartner | IsSoulSurvivor | KilledByMe | KilledByTeammate | KilledMe | | ||
KilledTeammate | Mmr | ProfileId | Proximity | ProximityToMe | ProximityToTeammate | SkillBased | | ||
TeamExtraction | ||
} |
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 System; | ||
using System.ComponentModel; | ||
using System.Linq; | ||
using System.Reflection; | ||
|
||
namespace HuntMmrReader.Extensions; | ||
|
||
internal static class EnumExtensions | ||
{ | ||
public static string GetDescription(this Enum e) | ||
{ | ||
var attribute = | ||
e.GetType() | ||
.GetTypeInfo() | ||
.GetMember(e.ToString()) | ||
.FirstOrDefault(member => member.MemberType == MemberTypes.Field) | ||
?.GetCustomAttributes(typeof(DescriptionAttribute), false) | ||
.SingleOrDefault() | ||
as DescriptionAttribute; | ||
|
||
return attribute?.Description ?? e.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
Oops, something went wrong.