Skip to content

Commit

Permalink
Merge branch 'CleanUpTask'
Browse files Browse the repository at this point in the history
  • Loading branch information
Triky313 committed Apr 7, 2022
2 parents 7eda014 + b33c561 commit bf0468a
Show file tree
Hide file tree
Showing 46 changed files with 253 additions and 223 deletions.
2 changes: 1 addition & 1 deletion src/StatisticsAnalysisTool/Common/Alert.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using log4net;
using StatisticsAnalysisTool.Annotations;
using StatisticsAnalysisTool.Exceptions;
using StatisticsAnalysisTool.Models;
using StatisticsAnalysisTool.Views;
Expand All @@ -10,6 +9,7 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Threading.Tasks;
using StatisticsAnalysisTool.Properties;

namespace StatisticsAnalysisTool.Common
{
Expand Down
1 change: 0 additions & 1 deletion src/StatisticsAnalysisTool/Common/ExtensionMethod.cs
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,6 @@ public static double ToPositiveFromNegativeOrZero(this double healthChange)
return healthChange >= 0d ? 0d : healthChange.ToPositive();
}


#endregion

#region Player Objects
Expand Down
5 changes: 2 additions & 3 deletions src/StatisticsAnalysisTool/Common/ItemController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -115,14 +115,13 @@ public static ulong GetMinPrice(List<ulong> list)
return min;
}


#endregion

#region Item specific

public static int GetItemLevel(string uniqueName)
{
if (uniqueName == null || !uniqueName.Contains("@"))
if (uniqueName == null || !uniqueName.Contains('@'))
{
return 0;
}
Expand All @@ -138,7 +137,7 @@ public static int GetItemTier(Item item)
}

var itemNameTierText = item.UniqueName.Split('_')[0];
if (itemNameTierText[..1] == "T" && int.TryParse(itemNameTierText.Substring(1, 1), out var result))
if (itemNameTierText[..1] == "T" && int.TryParse(itemNameTierText.AsSpan(1, 1), out var result))
{
return result;
}
Expand Down
40 changes: 37 additions & 3 deletions src/StatisticsAnalysisTool/Common/TextBoxHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,10 @@ public enum EvenOddConstraint

private static void DependencyPropertiesChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
if (!(d is TextBox textBox))
if (d is not TextBox textBox)
{
throw new Exception("Attached property must be used with TextBox.");
}

switch (e.Property.Name)
{
Expand Down Expand Up @@ -267,13 +269,19 @@ private static void TextBox_PasteEventHandler(object sender, DataObjectPastingEv
case EvenOddConstraint.OnlyEven:

if (number % 2 != 0)
{
e.CancelCommand();
}

break;

case EvenOddConstraint.OnlyOdd:

if (number % 2 == 0)
{
e.CancelCommand();
}

break;
}
}
Expand All @@ -291,15 +299,18 @@ private static void TextBox_PasteEventHandler(object sender, DataObjectPastingEv
case EvenOddConstraint.OnlyEven:

if (number % 2 != 0)
{
e.CancelCommand();
}

break;

case EvenOddConstraint.OnlyOdd:

if (number % 2 == 0)
{
e.CancelCommand();

}

break;
}
Expand All @@ -320,15 +331,18 @@ private static void TextBox_PasteEventHandler(object sender, DataObjectPastingEv
case EvenOddConstraint.OnlyEven:

if (number % 2 != 0)
{
e.CancelCommand();
}

break;

case EvenOddConstraint.OnlyOdd:

if (number % 2 == 0)
{
e.CancelCommand();

}

break;
}
Expand All @@ -353,14 +367,18 @@ private static void TextBox_PasteEventHandler(object sender, DataObjectPastingEv
case EvenOddConstraint.OnlyEven:

if (number % 2 != 0)
{
e.CancelCommand();
}

break;

case EvenOddConstraint.OnlyOdd:

if (number % 2 == 0)
{
e.CancelCommand();
}

break;
}
Expand Down Expand Up @@ -399,14 +417,18 @@ private static void TextBox_TextChanged(object sender, TextChangedEventArgs e)
case EvenOddConstraint.OnlyEven:

if (number % 2 != 0)
{
textBox.Text = defaultValue;
}

break;

case EvenOddConstraint.OnlyOdd:

if (number % 2 == 0)
{
textBox.Text = defaultValue;
}

break;
}
Expand All @@ -426,14 +448,18 @@ private static void TextBox_TextChanged(object sender, TextChangedEventArgs e)
case EvenOddConstraint.OnlyEven:

if (number % 2 != 0)
{
textBox.Text = defaultValue;
}

break;

case EvenOddConstraint.OnlyOdd:

if (number % 2 == 0)
{
textBox.Text = defaultValue;
}

break;
}
Expand All @@ -453,14 +479,18 @@ private static void TextBox_TextChanged(object sender, TextChangedEventArgs e)
case EvenOddConstraint.OnlyEven:

if (number % 2 != 0)
{
textBox.Text = defaultValue;
}

break;

case EvenOddConstraint.OnlyOdd:

if (number % 2 == 0)
{
textBox.Text = defaultValue;
}

break;
}
Expand All @@ -484,14 +514,18 @@ private static void TextBox_TextChanged(object sender, TextChangedEventArgs e)
case EvenOddConstraint.OnlyEven:

if (number % 2 != 0)
{
textBox.Text = defaultValue;
}

break;

case EvenOddConstraint.OnlyOdd:

if (number % 2 == 0)
{
textBox.Text = defaultValue;
}

break;
}
Expand Down
1 change: 0 additions & 1 deletion src/StatisticsAnalysisTool/Common/Utilities.cs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ private struct FlashInfo
public uint cbSize; //The size of the structure in bytes.
public IntPtr hwnd; //A Handle to the Window to be Flashed. The window can be either opened or minimized.


public uint dwFlags; //The Flash Status.
public uint uCount; // number of times to flash the window

Expand Down
8 changes: 8 additions & 0 deletions src/StatisticsAnalysisTool/Models/AllResponse.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
namespace StatisticsAnalysisTool.Models;

public class AllResponse
{
public ulong Total { get; set; }
public ulong Royal { get; set; }
public ulong Outlands { get; set; }
}
8 changes: 8 additions & 0 deletions src/StatisticsAnalysisTool/Models/CraftingResponse.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
namespace StatisticsAnalysisTool.Models;

public class CraftingResponse
{
public ulong Total { get; set; }
public ulong Royal { get; set; }
public ulong Outlands { get; set; }
}
5 changes: 2 additions & 3 deletions src/StatisticsAnalysisTool/Models/DashboardObject.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
using StatisticsAnalysisTool.Annotations;
using System.Collections.Generic;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Runtime.CompilerServices;
using StatisticsAnalysisTool.Properties;

namespace StatisticsAnalysisTool.Models
{

public class DashboardObject : INotifyPropertyChanged
{
private double _famePerHour;
Expand Down
26 changes: 13 additions & 13 deletions src/StatisticsAnalysisTool/Models/DungeonStats.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using StatisticsAnalysisTool.Annotations;
using StatisticsAnalysisTool.Common;
using StatisticsAnalysisTool.Common;
using System.ComponentModel;
using System.Runtime.CompilerServices;
using StatisticsAnalysisTool.Properties;

namespace StatisticsAnalysisTool.Models
{
Expand Down Expand Up @@ -137,17 +137,17 @@ public string TranslationTitle {
}
}

public string TranslationEnteredDungeon => LanguageController.Translation("ENTERED_DUNGEON");
public string TranslationOpenedStandardChests => LanguageController.Translation("OPENED_STANDARD_CHESTS");
public string TranslationOpenedUncommonChests => LanguageController.Translation("OPENED_UNCOMMON_CHESTS");
public string TranslationOpenedRareChests => LanguageController.Translation("OPENED_RARE_CHESTS");
public string TranslationOpenedLegendaryChests => LanguageController.Translation("OPENED_LEGENDARY_CHESTS");
public string TranslationFame => LanguageController.Translation("FAME");
public string TranslationReSpec => LanguageController.Translation("RESPEC");
public string TranslationSilver => LanguageController.Translation("SILVER");
public string TranslationAverageFame => LanguageController.Translation("AVERAGE_FAME");
public string TranslationAverageReSpec => LanguageController.Translation("AVERAGE_RESPEC");
public string TranslationAverageSilver => LanguageController.Translation("AVERAGE_SILVER");
public static string TranslationEnteredDungeon => LanguageController.Translation("ENTERED_DUNGEON");
public static string TranslationOpenedStandardChests => LanguageController.Translation("OPENED_STANDARD_CHESTS");
public static string TranslationOpenedUncommonChests => LanguageController.Translation("OPENED_UNCOMMON_CHESTS");
public static string TranslationOpenedRareChests => LanguageController.Translation("OPENED_RARE_CHESTS");
public static string TranslationOpenedLegendaryChests => LanguageController.Translation("OPENED_LEGENDARY_CHESTS");
public static string TranslationFame => LanguageController.Translation("FAME");
public static string TranslationReSpec => LanguageController.Translation("RESPEC");
public static string TranslationSilver => LanguageController.Translation("SILVER");
public static string TranslationAverageFame => LanguageController.Translation("AVERAGE_FAME");
public static string TranslationAverageReSpec => LanguageController.Translation("AVERAGE_RESPEC");
public static string TranslationAverageSilver => LanguageController.Translation("AVERAGE_SILVER");

public event PropertyChangedEventHandler PropertyChanged;

Expand Down
34 changes: 17 additions & 17 deletions src/StatisticsAnalysisTool/Models/DungeonStatsFilter.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
using StatisticsAnalysisTool.Annotations;
using StatisticsAnalysisTool.Common;
using StatisticsAnalysisTool.Common;
using StatisticsAnalysisTool.Enumerations;
using StatisticsAnalysisTool.Network.Manager;
using System.Collections.Generic;
using System.ComponentModel;
using System.Runtime.CompilerServices;
using StatisticsAnalysisTool.Properties;

namespace StatisticsAnalysisTool.Models
{
Expand All @@ -17,7 +17,7 @@ public class DungeonStatsFilter : INotifyPropertyChanged
private bool? _expeditionCheckbox = true;
private bool? _corruptedCheckbox = true;
private bool? _unknownCheckbox = true;
private List<DungeonMode> _dungeonModeFilters = new List<DungeonMode>()
private List<DungeonMode> _dungeonModeFilters = new ()
{
DungeonMode.Solo,
DungeonMode.Standard,
Expand Down Expand Up @@ -146,20 +146,20 @@ private void RemoveDungeonMode(DungeonMode dungeonMode)
}
}

public string TranslationFilter => LanguageController.Translation("FILTER");
public string TranslationSolo => LanguageController.Translation("SOLO");
public string TranslationSoloDungeon => LanguageController.Translation("SOLO_DUNGEON");
public string TranslationStandard => LanguageController.Translation("STANDARD");
public string TranslationStandardDungeon => LanguageController.Translation("STANDARD_DUNGEON");
public string TranslationAva => LanguageController.Translation("AVA");
public string TranslationAvalonianDungeon => LanguageController.Translation("AVALONIAN_DUNGEON");
public string TranslationHg => LanguageController.Translation("HG");
public string TranslationHellGate => LanguageController.Translation("HELLGATE");
public string TranslationCorrupted => LanguageController.Translation("CORRUPTED");
public string TranslationCorruptedDungeon => LanguageController.Translation("CORRUPTED_LAIR");
public string TranslationExped => LanguageController.Translation("EXPED");
public string TranslationExpedition => LanguageController.Translation("EXPEDITION");
public string TranslationUnknown => LanguageController.Translation("UNKNOWN");
public static string TranslationFilter => LanguageController.Translation("FILTER");
public static string TranslationSolo => LanguageController.Translation("SOLO");
public static string TranslationSoloDungeon => LanguageController.Translation("SOLO_DUNGEON");
public static string TranslationStandard => LanguageController.Translation("STANDARD");
public static string TranslationStandardDungeon => LanguageController.Translation("STANDARD_DUNGEON");
public static string TranslationAva => LanguageController.Translation("AVA");
public static string TranslationAvalonianDungeon => LanguageController.Translation("AVALONIAN_DUNGEON");
public static string TranslationHg => LanguageController.Translation("HG");
public static string TranslationHellGate => LanguageController.Translation("HELLGATE");
public static string TranslationCorrupted => LanguageController.Translation("CORRUPTED");
public static string TranslationCorruptedDungeon => LanguageController.Translation("CORRUPTED_LAIR");
public static string TranslationExped => LanguageController.Translation("EXPED");
public static string TranslationExpedition => LanguageController.Translation("EXPEDITION");
public static string TranslationUnknown => LanguageController.Translation("UNKNOWN");


public event PropertyChangedEventHandler PropertyChanged;
Expand Down
15 changes: 15 additions & 0 deletions src/StatisticsAnalysisTool/Models/EquipmentResponse.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
namespace StatisticsAnalysisTool.Models;

public class EquipmentResponse
{
public object MainHand { get; set; }
public object OffHand { get; set; }
public object Head { get; set; }
public object Armor { get; set; }
public object Shoes { get; set; }
public object Bag { get; set; }
public object Cape { get; set; }
public object Mount { get; set; }
public object Potion { get; set; }
public object Food { get; set; }
}
8 changes: 8 additions & 0 deletions src/StatisticsAnalysisTool/Models/FiberResponse.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
namespace StatisticsAnalysisTool.Models;

public class FiberResponse
{
public ulong Total { get; set; }
public ulong Royal { get; set; }
public ulong Outlands { get; set; }
}
Loading

0 comments on commit bf0468a

Please sign in to comment.