From 70d38000f5a6c2613e9d183ebecd5957e017fc11 Mon Sep 17 00:00:00 2001 From: Latency McLaughlin Date: Sun, 4 Feb 2018 04:14:01 -0700 Subject: [PATCH] Refactored namespaces for standardization reasons. --- HearthStone.Database/Card.cs | 39 +++++++++---------- HearthStone.Database/CardDefs/CardDefs.cs | 2 +- HearthStone.Database/CardDefs/Entity.cs | 33 ++++++++-------- .../CardDefs/EntourageCard.cs | 2 +- .../CardDefs/PlayRequirement.cs | 2 +- HearthStone.Database/CardDefs/Power.cs | 2 +- HearthStone.Database/CardDefs/Tag.cs | 2 +- .../CardDefs/TriggeredPowerHistoryInfo.cs | 2 +- HearthStone.Database/CardIds.cs | 3 +- HearthStone.Database/Cards.cs | 4 +- HearthStone.Database/Deckstrings/Deck.cs | 5 ++- .../Deckstrings/DeckSerializer.cs | 5 ++- .../Deckstrings/InvalidDeckException.cs | 3 +- HearthStone.Database/Deckstrings/VarInt.cs | 3 +- HearthStone.Database/Enums/Converters.cs | 36 ++++++++--------- HearthStone.Database/Enums/Dictionaries.cs | 2 +- HearthStone.Database/Enums/Enums.cs | 2 +- .../HearthStone.Database.csproj | 6 +-- HearthStone.Database/Info.cs | 2 +- 19 files changed, 78 insertions(+), 77 deletions(-) diff --git a/HearthStone.Database/Card.cs b/HearthStone.Database/Card.cs index 5c8f2743..c0cf1f08 100644 --- a/HearthStone.Database/Card.cs +++ b/HearthStone.Database/Card.cs @@ -1,13 +1,12 @@ #region using System.Linq; -using HearthDb.CardDefs; -using HearthDb.Enums; -using static HearthDb.Enums.GameTag; +using HearthStone.Database.CardDefs; +using HearthStone.Database.Enums; #endregion -namespace HearthDb +namespace HearthStone.Database { public class Card { @@ -28,27 +27,27 @@ internal Card(Entity entity) public string FlavorText => GetLocFlavorText(DefaultLanguage); - public CardClass Class => (CardClass)Entity.GetTag(CLASS); + public CardClass Class => (CardClass)Entity.GetTag(GameTag.CLASS); - public Rarity Rarity => (Rarity)Entity.GetTag(RARITY); + public Rarity Rarity => (Rarity)Entity.GetTag(GameTag.RARITY); - public CardType Type => (CardType)Entity.GetTag(CARDTYPE); + public CardType Type => (CardType)Entity.GetTag(GameTag.CARDTYPE); - public Race Race => (Race)Entity.GetTag(CARDRACE); + public Race Race => (Race)Entity.GetTag(GameTag.CARDRACE); - public CardSet Set => (CardSet)Entity.GetTag(CARD_SET); + public CardSet Set => (CardSet)Entity.GetTag(GameTag.CARD_SET); - public Faction Faction => (Faction)Entity.GetTag(FACTION); + public Faction Faction => (Faction)Entity.GetTag(GameTag.FACTION); - public int Cost => Entity.GetTag(COST); + public int Cost => Entity.GetTag(GameTag.COST); - public int Attack => Entity.GetTag(ATK); + public int Attack => Entity.GetTag(GameTag.ATK); - public int Health => Entity.GetTag(HEALTH); + public int Health => Entity.GetTag(GameTag.HEALTH); - public int Durability => Entity.GetTag(DURABILITY); + public int Durability => Entity.GetTag(GameTag.DURABILITY); - public int Armor => Entity.GetTag(ARMOR); + public int Armor => Entity.GetTag(GameTag.ARMOR); public string[] Mechanics { @@ -62,25 +61,25 @@ public string[] Mechanics } } - public string ArtistName => Entity.GetInnerValue(ARTISTNAME); + public string ArtistName => Entity.GetInnerValue(GameTag.ARTISTNAME); public string[] EntourageCardIds => Entity.EntourageCards.Select(x => x.CardId).ToArray(); public Locale DefaultLanguage { get; set; } = Locale.enUS; - public bool Collectible => Entity.GetTag(COLLECTIBLE) != 0; + public bool Collectible => Entity.GetTag(GameTag.COLLECTIBLE) != 0; - public string GetLocName(Locale lang) => Entity.GetLocString(CARDNAME, lang); + public string GetLocName(Locale lang) => Entity.GetLocString(GameTag.CARDNAME, lang); public string GetLocText(Locale lang) { - var text = Entity.GetLocString(CARDTEXT_INHAND, lang)?.Replace("_", "\u00A0").Trim(); + var text = Entity.GetLocString(GameTag.CARDTEXT_INHAND, lang)?.Replace("_", "\u00A0").Trim(); if(text == null) return null; var index = text.IndexOf('@'); return index > 0 ? text.Substring(index + 1) : text; } - public string GetLocFlavorText(Locale lang) => Entity.GetLocString(FLAVORTEXT, lang); + public string GetLocFlavorText(Locale lang) => Entity.GetLocString(GameTag.FLAVORTEXT, lang); } } diff --git a/HearthStone.Database/CardDefs/CardDefs.cs b/HearthStone.Database/CardDefs/CardDefs.cs index a0c1fc70..c637a999 100644 --- a/HearthStone.Database/CardDefs/CardDefs.cs +++ b/HearthStone.Database/CardDefs/CardDefs.cs @@ -5,7 +5,7 @@ #endregion -namespace HearthDb.CardDefs +namespace HearthStone.Database.CardDefs { [XmlRoot("CardDefs")] public class CardDefs diff --git a/HearthStone.Database/CardDefs/Entity.cs b/HearthStone.Database/CardDefs/Entity.cs index e1e73423..2c13e8d2 100644 --- a/HearthStone.Database/CardDefs/Entity.cs +++ b/HearthStone.Database/CardDefs/Entity.cs @@ -3,12 +3,11 @@ using System.Collections.Generic; using System.Linq; using System.Xml.Serialization; -using HearthDb.Enums; -using static HearthDb.Enums.Locale; +using HearthStone.Database.Enums; #endregion -namespace HearthDb.CardDefs +namespace HearthStone.Database.CardDefs { public class Entity { @@ -54,33 +53,33 @@ public string GetLocString(GameTag gameTag, Locale lang) return null; switch(lang) { - case deDE: + case Locale.deDE: return tag.LocStringDeDe; - case enUS: + case Locale.enUS: return tag.LocStringEnUs; - case esES: + case Locale.esES: return tag.LocStringEsEs; - case esMX: + case Locale.esMX: return tag.LocStringEsMx; - case frFR: + case Locale.frFR: return tag.LocStringFrFr; - case itIT: + case Locale.itIT: return tag.LocStringItIt; - case jaJP: + case Locale.jaJP: return tag.LocStringJaJp; - case koKR: + case Locale.koKR: return tag.LocStringKoKr; - case plPL: + case Locale.plPL: return tag.LocStringPlPl; - case ptBR: + case Locale.ptBR: return tag.LocStringPtBr; - case ruRU: + case Locale.ruRU: return tag.LocStringRuRu; - case zhCN: + case Locale.zhCN: return tag.LocStringZhCn; - case zhTW: + case Locale.zhTW: return tag.LocStringZhTw; - case thTH: + case Locale.thTH: return tag.LocStringThTh; default: return null; diff --git a/HearthStone.Database/CardDefs/EntourageCard.cs b/HearthStone.Database/CardDefs/EntourageCard.cs index 5b6747e9..c7c34b66 100644 --- a/HearthStone.Database/CardDefs/EntourageCard.cs +++ b/HearthStone.Database/CardDefs/EntourageCard.cs @@ -4,7 +4,7 @@ #endregion -namespace HearthDb.CardDefs +namespace HearthStone.Database.CardDefs { public class EntourageCard { diff --git a/HearthStone.Database/CardDefs/PlayRequirement.cs b/HearthStone.Database/CardDefs/PlayRequirement.cs index 6319f859..f62c6c64 100644 --- a/HearthStone.Database/CardDefs/PlayRequirement.cs +++ b/HearthStone.Database/CardDefs/PlayRequirement.cs @@ -4,7 +4,7 @@ #endregion -namespace HearthDb.CardDefs +namespace HearthStone.Database.CardDefs { public class PlayRequirement { diff --git a/HearthStone.Database/CardDefs/Power.cs b/HearthStone.Database/CardDefs/Power.cs index b99b8350..663382be 100644 --- a/HearthStone.Database/CardDefs/Power.cs +++ b/HearthStone.Database/CardDefs/Power.cs @@ -5,7 +5,7 @@ #endregion -namespace HearthDb.CardDefs +namespace HearthStone.Database.CardDefs { public class Power { diff --git a/HearthStone.Database/CardDefs/Tag.cs b/HearthStone.Database/CardDefs/Tag.cs index 4eda459d..3902046d 100644 --- a/HearthStone.Database/CardDefs/Tag.cs +++ b/HearthStone.Database/CardDefs/Tag.cs @@ -4,7 +4,7 @@ #endregion -namespace HearthDb.CardDefs +namespace HearthStone.Database.CardDefs { public class Tag { diff --git a/HearthStone.Database/CardDefs/TriggeredPowerHistoryInfo.cs b/HearthStone.Database/CardDefs/TriggeredPowerHistoryInfo.cs index 96aad424..8da0da94 100644 --- a/HearthStone.Database/CardDefs/TriggeredPowerHistoryInfo.cs +++ b/HearthStone.Database/CardDefs/TriggeredPowerHistoryInfo.cs @@ -4,7 +4,7 @@ #endregion -namespace HearthDb.CardDefs +namespace HearthStone.Database.CardDefs { public class TriggeredPowerHistoryInfo { diff --git a/HearthStone.Database/CardIds.cs b/HearthStone.Database/CardIds.cs index 80eac790..81bbe59b 100644 --- a/HearthStone.Database/CardIds.cs +++ b/HearthStone.Database/CardIds.cs @@ -1,5 +1,4 @@ -// ReSharper disable InconsistentNaming -namespace HearthDb +namespace HearthStone.Database { /* THIS CLASS WAS GENERATED BY HearthDb.CardIdGenerator. DO NOT EDIT. */ public class CardIds diff --git a/HearthStone.Database/Cards.cs b/HearthStone.Database/Cards.cs index fcdc691a..f99d681c 100644 --- a/HearthStone.Database/Cards.cs +++ b/HearthStone.Database/Cards.cs @@ -5,11 +5,11 @@ using System.Linq; using System.Reflection; using System.Xml.Serialization; -using HearthDb.Enums; +using HearthStone.Database.Enums; #endregion -namespace HearthDb +namespace HearthStone.Database { public static class Cards { diff --git a/HearthStone.Database/Deckstrings/Deck.cs b/HearthStone.Database/Deckstrings/Deck.cs index ed6a0f6b..ffe5067f 100644 --- a/HearthStone.Database/Deckstrings/Deck.cs +++ b/HearthStone.Database/Deckstrings/Deck.cs @@ -1,8 +1,9 @@ using System.Collections.Generic; using System.Linq; -using HearthDb.Enums; +using HearthStone.Database.Enums; -namespace HearthDb.Deckstrings + +namespace HearthStone.Database.Deckstrings { public class Deck { diff --git a/HearthStone.Database/Deckstrings/DeckSerializer.cs b/HearthStone.Database/Deckstrings/DeckSerializer.cs index 6cc033f3..9c25539d 100644 --- a/HearthStone.Database/Deckstrings/DeckSerializer.cs +++ b/HearthStone.Database/Deckstrings/DeckSerializer.cs @@ -2,9 +2,10 @@ using System.IO; using System.Linq; using System.Text; -using HearthDb.Enums; +using HearthStone.Database.Enums; -namespace HearthDb.Deckstrings + +namespace HearthStone.Database.Deckstrings { public class DeckSerializer { diff --git a/HearthStone.Database/Deckstrings/InvalidDeckException.cs b/HearthStone.Database/Deckstrings/InvalidDeckException.cs index bd8e53b4..41765e32 100644 --- a/HearthStone.Database/Deckstrings/InvalidDeckException.cs +++ b/HearthStone.Database/Deckstrings/InvalidDeckException.cs @@ -1,6 +1,7 @@ using System; -namespace HearthDb.Deckstrings + +namespace HearthStone.Database.Deckstrings { public class InvalidDeckException : Exception { diff --git a/HearthStone.Database/Deckstrings/VarInt.cs b/HearthStone.Database/Deckstrings/VarInt.cs index 15c87dfe..273bb1d9 100644 --- a/HearthStone.Database/Deckstrings/VarInt.cs +++ b/HearthStone.Database/Deckstrings/VarInt.cs @@ -1,6 +1,7 @@ using System.IO; -namespace HearthDb.Deckstrings + +namespace HearthStone.Database.Deckstrings { internal static class VarInt { diff --git a/HearthStone.Database/Enums/Converters.cs b/HearthStone.Database/Enums/Converters.cs index 81ea79fb..280e5557 100644 --- a/HearthStone.Database/Enums/Converters.cs +++ b/HearthStone.Database/Enums/Converters.cs @@ -1,7 +1,7 @@ using System.Linq; -using static HearthDb.Enums.BnetGameType; -namespace HearthDb.Enums + +namespace HearthStone.Database.Enums { public static class Converters { @@ -10,37 +10,37 @@ public static BnetGameType GetBnetGameType(GameType gameType, FormatType format) switch(gameType) { case GameType.GT_UNKNOWN: - return BGT_UNKNOWN; + return BnetGameType.BGT_UNKNOWN; case GameType.GT_VS_AI: - return BGT_VS_AI; + return BnetGameType.BGT_VS_AI; case GameType.GT_VS_FRIEND: - return BGT_FRIENDS; + return BnetGameType.BGT_FRIENDS; case GameType.GT_TUTORIAL: - return BGT_TUTORIAL; + return BnetGameType.BGT_TUTORIAL; case GameType.GT_ARENA: - return BGT_ARENA; + return BnetGameType.BGT_ARENA; case GameType.GT_TEST: - return BGT_TEST1; + return BnetGameType.BGT_TEST1; case GameType.GT_RANKED: - return format == FormatType.FT_STANDARD ? BGT_RANKED_STANDARD : BGT_RANKED_WILD; + return format == FormatType.FT_STANDARD ? BnetGameType.BGT_RANKED_STANDARD : BnetGameType.BGT_RANKED_WILD; case GameType.GT_CASUAL: - return format == FormatType.FT_STANDARD? BGT_CASUAL_STANDARD : BGT_CASUAL_WILD; + return format == FormatType.FT_STANDARD? BnetGameType.BGT_CASUAL_STANDARD : BnetGameType.BGT_CASUAL_WILD; case GameType.GT_TAVERNBRAWL: - return BGT_TAVERNBRAWL_PVP; + return BnetGameType.BGT_TAVERNBRAWL_PVP; case GameType.GT_TB_1P_VS_AI: - return BGT_TAVERNBRAWL_1P_VERSUS_AI; + return BnetGameType.BGT_TAVERNBRAWL_1P_VERSUS_AI; case GameType.GT_TB_2P_COOP: - return BGT_TAVERNBRAWL_2P_COOP; + return BnetGameType.BGT_TAVERNBRAWL_2P_COOP; case GameType.GT_FSG_BRAWL: - return BGT_FSG_BRAWL_VS_FRIEND; + return BnetGameType.BGT_FSG_BRAWL_VS_FRIEND; case GameType.GT_FSG_BRAWL_1P_VS_AI: - return BGT_FSG_BRAWL_1P_VERSUS_AI; + return BnetGameType.BGT_FSG_BRAWL_1P_VERSUS_AI; case GameType.GT_FSG_BRAWL_2P_COOP: - return BGT_FSG_BRAWL_2P_COOP; + return BnetGameType.BGT_FSG_BRAWL_2P_COOP; case GameType.GT_FSG_BRAWL_VS_FRIEND: - return BGT_FSG_BRAWL_VS_FRIEND; + return BnetGameType.BGT_FSG_BRAWL_VS_FRIEND; default: - return BGT_UNKNOWN; + return BnetGameType.BGT_UNKNOWN; } } diff --git a/HearthStone.Database/Enums/Dictionaries.cs b/HearthStone.Database/Enums/Dictionaries.cs index 6d242bab..437ca706 100644 --- a/HearthStone.Database/Enums/Dictionaries.cs +++ b/HearthStone.Database/Enums/Dictionaries.cs @@ -4,7 +4,7 @@ #endregion -namespace HearthDb.Enums +namespace HearthStone.Database.Enums { public static class Dictionaries { diff --git a/HearthStone.Database/Enums/Enums.cs b/HearthStone.Database/Enums/Enums.cs index 10a6784d..629574c8 100644 --- a/HearthStone.Database/Enums/Enums.cs +++ b/HearthStone.Database/Enums/Enums.cs @@ -1,4 +1,4 @@ -namespace HearthDb.Enums +namespace HearthStone.Database.Enums { /* THIS FILE WAS GENERATED BY HearthDb.EnumsGenerator. DO NOT EDIT. */ diff --git a/HearthStone.Database/HearthStone.Database.csproj b/HearthStone.Database/HearthStone.Database.csproj index e41aadcb..cdbc5ccd 100644 --- a/HearthStone.Database/HearthStone.Database.csproj +++ b/HearthStone.Database/HearthStone.Database.csproj @@ -1,7 +1,7 @@  - 10.0.1 + 1.0.1 net471;net45;netcoreapp2.0;netstandard2.0 true snKey.snk @@ -19,8 +19,8 @@ HearthStone.Database HearthStone Database Initial build & release package. - HearthDb - HearthDb + HearthStone.Database + HearthStone.Database diff --git a/HearthStone.Database/Info.cs b/HearthStone.Database/Info.cs index 04e54fe5..a2ecd68d 100644 --- a/HearthStone.Database/Info.cs +++ b/HearthStone.Database/Info.cs @@ -5,7 +5,7 @@ #endregion -namespace HearthDb +namespace HearthStone.Database { public static class Info {