From 4c2aca213c1b305a10851a35aa1bc1fd56001417 Mon Sep 17 00:00:00 2001 From: Herbert Milhomme Date: Mon, 4 Jun 2018 10:03:51 -0400 Subject: [PATCH 1/6] Modified ToString Return I added small comma here and there in the first part, and redid everything over again in the 2nd part. Not sure how much is broken. I didnt do any testing. Please double check my counting on `string.Format`, i'm not sure if it's really 33 values... The idea is, if it doesnt have any value, it doesnt need to be there. So i added a null check, and then told it to skip. I added commas before each value. Added a splash of `\n`, for clarity and readability. They arent a lot, and they're not needed. (So they can easily be removed) --- .../CSVDatabaseReader/Pokemon.cs | 201 +++++++++++++++++- 1 file changed, 198 insertions(+), 3 deletions(-) diff --git a/PokemonDatabase/Source Files/CSVDatabaseReader/CSVDatabaseReader/Pokemon.cs b/PokemonDatabase/Source Files/CSVDatabaseReader/CSVDatabaseReader/Pokemon.cs index a8c7c7fe0..a22d2f6af 100644 --- a/PokemonDatabase/Source Files/CSVDatabaseReader/CSVDatabaseReader/Pokemon.cs +++ b/PokemonDatabase/Source Files/CSVDatabaseReader/CSVDatabaseReader/Pokemon.cs @@ -94,14 +94,14 @@ public enum Types public override string ToString() { - return string.Format($"new PokemonData( Id: Pokemons.{NAME.ToUpper()}, regionalDex: new int[{RegionalDex}], type1: Types.{Type1}, type2: Types.{Type2},\n" + + return string.Format($"new PokemonData( Id: Pokemons.{NAME.ToUpper()}, regionalDex: new int[]{ {RegionalDex} }, type1: Types.{Type1}, type2: Types.{Type2},\n" + $"ability1: Abilities.{Ability1}, ability2: Abilities.{Ability2}, hiddenAbility: Abilities.{HiddenAbility},\n" + $"maleRatio: {MaleRatio}, catchRate: {CatchRate}, eggGroup1: EggGroups.{EggGroup1}, eggGroup2: EggGroups.{EggGroup2}, hatchTime: {HatchTime},\n" + $"height: {Height}, weight: {Weight}, baseExpYield: {EXPYield}, levelingRate: LevelingRate.{LevelingRate},\n" + $"pokedexColor: Color.{PokedexColor}, baseFriendship: {BaseFriendship},\n" + $"baseStatsHP: {BSHP}, baseStatsATK: {BSATK}, baseStatsDEF: {BSDEF}, baseStatsSPA: {BSSPA}, baseStatsSPD: {BSSPD}, baseStatsSPE: {BSSPE},\n" + $"effortValuesHP: {EYHP}, effortValuesATK: {EYATK}, effortValuesDEF: {EYDEF}, effortValuesSPA: {EYSPA}, effortValuesSPD: {EYSPD}, effortValues: {EYSPE},\n" + - $"luminance: {Luminance},\n" + + //$"luminance: {Luminance},\n" + @"movesetmoves: new PokemonMoveset[] " + $"\n" + @"{{" + @@ -112,7 +112,202 @@ public override string ToString() @"evolution: new IPokemonEvolution[] {{" + $"{PokemonEvolution}" + @"}}," + - $"\nheldItem: {HeldItem})"); + //$"\nheldItem: {HeldItem} + ),"); + } + + public override string ToString(1) + { + return string.Format("new PokemonData(" + Id: Pokemons.{NAME.ToUpper()}, regionalDex: new int[]{ {RegionalDex} }, type1: Types.{Type1}, type2: Types.{Type2},\n" + + $"ability1: Abilities.{Ability1}, ability2: Abilities.{Ability2}, hiddenAbility: Abilities.{HiddenAbility},\n" + + $"maleRatio: {MaleRatio}, catchRate: {CatchRate}, eggGroup1: EggGroups.{EggGroup1}, eggGroup2: EggGroups.{EggGroup2}, hatchTime: {HatchTime},\n" + + $"height: {Height}, weight: {Weight}, baseExpYield: {EXPYield}, levelingRate: LevelingRate.{LevelingRate},\n" + + $"pokedexColor: Color.{PokedexColor}, baseFriendship: {BaseFriendship},\n" + + $"baseStatsHP: {BSHP}, baseStatsATK: {BSATK}, baseStatsDEF: {BSDEF}, baseStatsSPA: {BSSPA}, baseStatsSPD: {BSSPD}, baseStatsSPE: {BSSPE},\n" + + $"effortValuesHP: {EYHP}, effortValuesATK: {EYATK}, effortValuesDEF: {EYDEF}, effortValuesSPA: {EYSPA}, effortValuesSPD: {EYSPD}, effortValues: {EYSPE},\n" + + //$"luminance: {Luminance},\n" + + @"movesetmoves: new PokemonMoveset[] " + + $"\n" +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using CsvHelper; + +namespace CSVDatabaseReader +{ + class Pokemon + { + public string RegionalDex { get; set; } //Done + public string ID { get; set; } //Done + public string NAME { get; set; } //Done + public enum Types + { + NONE = 0, + NORMAL = 1, + FIGHTING = 2, + FLYING = 3, + POISON = 4, + GROUND = 5, + ROCK = 6, + BUG = 7, + GHOST = 8, + STEEL = 9, + FIRE = 10, + WATER = 11, + GRASS = 12, + ELECTRIC = 13, + PSYCHIC = 14, + ICE = 15, + DRAGON = 16, + DARK = 17, + FAIRY = 18, + UNKNOWN = 10001, + SHADOW = 10002 + } + public string Type1 { get; set; } //Done + public string Type2 { get; set; } //Done + + public string Ability1 { get; set; } //Done + public string Ability2 { get; set; } //Done + public string HiddenAbility { get; set; } //Done + + public string MaleRatio { get; set; } //Done + + public string CatchRate { get; set; } //Done + + public string EggGroup1 { get; set; } //Done + public string EggGroup2 { get; set; } //Done + + public string HatchTime { get; set; } //Done + + public string Height { get; set; } //Done + public string Weight { get; set; } //Done + + public string EXPYield { get; set; } //Done + public string LevelingRate { get; set; } //Done + + public string EYHP { get; set; } //Done + public string EYATK { get; set; } //Done + public string EYDEF { get; set; } //Done + public string EYSPA { get; set; } //Done + public string EYSPD { get; set; } //Done + public string EYSPE { get; set; } //Done + + public string PokedexColor { get; set; } //Done + + public string BaseFriendship { get; set; } //Done + + public string Species { get; set; } //Done + + public string Description { get; set; } //Done + + public string BSHP { get; set; } //Done + public string BSATK { get; set; } //Done + public string BSDEF { get; set; } //Done + public string BSSPA { get; set; } //Done + public string BSSPD { get; set; } //Done + public string BSSPE { get; set; } //Done + + public string Luminance { get; set; } //not needed + public string LightColor { get; set; } //Done + + public string LevelMoves { get; set; } + public string TMMoves { get; set; } + + public string PokemonEvolution { get; set; }//Done + public string LevelEvolution { get; set; } //Done + + public string Forms { get; set; } //manually + public string HeldItem { get; set; } //manually + + public override string ToString() + { + return string.Format($"new PokemonData( Id: Pokemons.{NAME.ToUpper()}, regionalDex: new int[]{ {RegionalDex} }, type1: Types.{Type1}, type2: Types.{Type2},\n" + + $"ability1: Abilities.{Ability1}, ability2: Abilities.{Ability2}, hiddenAbility: Abilities.{HiddenAbility},\n" + + $"maleRatio: {MaleRatio}, catchRate: {CatchRate}, eggGroup1: EggGroups.{EggGroup1}, eggGroup2: EggGroups.{EggGroup2}, hatchTime: {HatchTime},\n" + + $"height: {Height}, weight: {Weight}, baseExpYield: {EXPYield}, levelingRate: LevelingRate.{LevelingRate},\n" + + $"pokedexColor: Color.{PokedexColor}, baseFriendship: {BaseFriendship},\n" + + $"baseStatsHP: {BSHP}, baseStatsATK: {BSATK}, baseStatsDEF: {BSDEF}, baseStatsSPA: {BSSPA}, baseStatsSPD: {BSSPD}, baseStatsSPE: {BSSPE},\n" + + $"effortValuesHP: {EYHP}, effortValuesATK: {EYATK}, effortValuesDEF: {EYDEF}, effortValuesSPA: {EYSPA}, effortValuesSPD: {EYSPD}, effortValues: {EYSPE},\n" + + //$"luminance: {Luminance},\n" + + @"movesetmoves: new PokemonMoveset[] " + + $"\n" + + @"{{" + + $"{LevelMoves}\n" + + $"{TMMoves}\n" + + @"}}," + + $"\n" + + @"evolution: new IPokemonEvolution[] {{" + + $"{PokemonEvolution}" + + @"}}," + + //$"\nheldItem: {HeldItem} + ),"); + } + + ///Int value doesnt matter, ex `.ToString(1);` + public override string ToString(int newVersion) + { + return string.Format("new PokemonData({0} {1} {2} {3} {4} {5} {6} {7} {8} {9} " + + "{10} {11} {12} {13} {14} {15} {16} {17} {18} {19} " + + "{20} {21} {22} {23} {24} {25} {26} {27} {28} {29} " + + "{30} {31} {32})", + NAME == null? "" : "Id: Pokemons."+NAME.ToUpper(), + RegionalDex == null? "" : ",\nregionalDex: new int[]{"+RegionalDex+"}", + Type1 == null? "" : ",\ntype1: Types."+Type1, + Type2 == null? "" : ",\ntype2: Types."+Type2, + Ability1 == null? "" : ",\nability1: Abilities."+Ability1, + Ability2 == null? "" : ",\nability2: Abilities."+Ability2, + HiddenAbility == null? "" : ",\nhiddenAbility: Abilities."+HiddenAbility, + MaleRatio == null? "" : ",\nmaleRatio: "+MaleRatio, + CatchRate == null? "" : ",\ncatchRate: "+CatchRate, + EggGroup1 == null? "" : ",\neggGroup1: EggGroups."+EggGroup1, + EggGroup2 == null? "" : ",\neggGroup2: EggGroups."+EggGroup2, + HatchTime == null? "" : ",\nhatchTime: "+HatchTime, + Height == null? "" : ",\nheight: "+Height, + Weight == null? "" : ",\nweight: "+Weight, + LevelingRate == null? "" : ",\nlevelingRate: LevelingRate."+LevelingRate,//\n" + + PokedexColor == null? "" : ",\npokedexColor: Color."+PokedexColor, + BaseFriendship == null? "" : ",\nbaseFriendship: "+BaseFriendship, + EXPYield == null? "" : ",\nbaseExpYield: "+EXPYield, + BSHP == null? "" : ",baseStatsHP: "+BSHP, + BSATK == null? "" : ",baseStatsATK: "+BSATK, + BSDEF == null? "" : ",baseStatsDEF: "+BSDEF, + BSSPA == null? "" : ",baseStatsSPA: "+BSSPA, + BSSPD == null? "" : ",baseStatsSPD: "+BSSPD, + BSSPE == null? "" : ",baseStatsSPE: "+BSSPE,//\n" + + EYHP == null? "" : ",\neffortValuesHP: "+EYHP, + EYATK == null? "" : ",evATK: "+EYATK, + EYDEF == null? "" : ",evDEF: "+EYDEF, + EYSPA == null? "" : ",evSPA: "+EYSPA, + EYSPD == null? "" : ",evSPD: "+EYSPD, + EYSPE == null? "" : ",evSPE: "+EYSPE,//\n" + + //NAME == null? "" : "$"luminance: "+Luminance,\n" + + ",movesetmoves: new PokemonMoveset[] " + + //$"\n" + + "{" + + LevelMoves + "\n" + + TMMoves + "\n" + + "}", + //$"\n" + + PokemonEvolution == null? "" : ",evolution: new IPokemonEvolution[] {" + PokemonEvolution +"}," + //,HeldItem == null? "" : "heldItem: "+HeldItem +"," + ); + } + } +} + + @"{{" + + $"{LevelMoves}\n" + + $"{TMMoves}\n" + + @"}}," + + $"\n" + + @"evolution: new IPokemonEvolution[] {{" + + $"{PokemonEvolution}" + + @"}}," + + //$"\nheldItem: {HeldItem} + ),"); } } } From 32e7e22223526f052f86f34efe6d7e796d6e34e8 Mon Sep 17 00:00:00 2001 From: Herbert Milhomme Date: Mon, 4 Jun 2018 10:24:00 -0400 Subject: [PATCH 2/6] Correcting Typos --- .../CSVDatabaseReader/Pokemon.cs | 188 ++---------------- 1 file changed, 22 insertions(+), 166 deletions(-) diff --git a/PokemonDatabase/Source Files/CSVDatabaseReader/CSVDatabaseReader/Pokemon.cs b/PokemonDatabase/Source Files/CSVDatabaseReader/CSVDatabaseReader/Pokemon.cs index a22d2f6af..11138b5ae 100644 --- a/PokemonDatabase/Source Files/CSVDatabaseReader/CSVDatabaseReader/Pokemon.cs +++ b/PokemonDatabase/Source Files/CSVDatabaseReader/CSVDatabaseReader/Pokemon.cs @@ -1,134 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using CsvHelper; - -namespace CSVDatabaseReader -{ - class Pokemon - { - public string RegionalDex { get; set; } //Done - public string ID { get; set; } //Done - public string NAME { get; set; } //Done - public enum Types - { - NONE = 0, - NORMAL = 1, - FIGHTING = 2, - FLYING = 3, - POISON = 4, - GROUND = 5, - ROCK = 6, - BUG = 7, - GHOST = 8, - STEEL = 9, - FIRE = 10, - WATER = 11, - GRASS = 12, - ELECTRIC = 13, - PSYCHIC = 14, - ICE = 15, - DRAGON = 16, - DARK = 17, - FAIRY = 18, - UNKNOWN = 10001, - SHADOW = 10002 - } - public string Type1 { get; set; } //Done - public string Type2 { get; set; } //Done - - public string Ability1 { get; set; } //Done - public string Ability2 { get; set; } //Done - public string HiddenAbility { get; set; } //Done - - public string MaleRatio { get; set; } //Done - - public string CatchRate { get; set; } //Done - - public string EggGroup1 { get; set; } //Done - public string EggGroup2 { get; set; } //Done - - public string HatchTime { get; set; } //Done - - public string Height { get; set; } //Done - public string Weight { get; set; } //Done - - public string EXPYield { get; set; } //Done - public string LevelingRate { get; set; } //Done - - public string EYHP { get; set; } //Done - public string EYATK { get; set; } //Done - public string EYDEF { get; set; } //Done - public string EYSPA { get; set; } //Done - public string EYSPD { get; set; } //Done - public string EYSPE { get; set; } //Done - - public string PokedexColor { get; set; } //Done - - public string BaseFriendship { get; set; } //Done - - public string Species { get; set; } //Done - - public string Description { get; set; } //Done - - public string BSHP { get; set; } //Done - public string BSATK { get; set; } //Done - public string BSDEF { get; set; } //Done - public string BSSPA { get; set; } //Done - public string BSSPD { get; set; } //Done - public string BSSPE { get; set; } //Done - - public string Luminance { get; set; } //Done - public string LightColor { get; set; } //Done - - public string LevelMoves { get; set; } - public string TMMoves { get; set; } - - public string PokemonEvolution { get; set; }//Done - public string LevelEvolution { get; set; } //Done - - public string Forms { get; set; } - public string HeldItem { get; set; } - - public override string ToString() - { - return string.Format($"new PokemonData( Id: Pokemons.{NAME.ToUpper()}, regionalDex: new int[]{ {RegionalDex} }, type1: Types.{Type1}, type2: Types.{Type2},\n" + - $"ability1: Abilities.{Ability1}, ability2: Abilities.{Ability2}, hiddenAbility: Abilities.{HiddenAbility},\n" + - $"maleRatio: {MaleRatio}, catchRate: {CatchRate}, eggGroup1: EggGroups.{EggGroup1}, eggGroup2: EggGroups.{EggGroup2}, hatchTime: {HatchTime},\n" + - $"height: {Height}, weight: {Weight}, baseExpYield: {EXPYield}, levelingRate: LevelingRate.{LevelingRate},\n" + - $"pokedexColor: Color.{PokedexColor}, baseFriendship: {BaseFriendship},\n" + - $"baseStatsHP: {BSHP}, baseStatsATK: {BSATK}, baseStatsDEF: {BSDEF}, baseStatsSPA: {BSSPA}, baseStatsSPD: {BSSPD}, baseStatsSPE: {BSSPE},\n" + - $"effortValuesHP: {EYHP}, effortValuesATK: {EYATK}, effortValuesDEF: {EYDEF}, effortValuesSPA: {EYSPA}, effortValuesSPD: {EYSPD}, effortValues: {EYSPE},\n" + - //$"luminance: {Luminance},\n" + - @"movesetmoves: new PokemonMoveset[] " + - $"\n" + - @"{{" + - $"{LevelMoves}\n" + - $"{TMMoves}\n" + - @"}}," + - $"\n" + - @"evolution: new IPokemonEvolution[] {{" + - $"{PokemonEvolution}" + - @"}}," + - //$"\nheldItem: {HeldItem} - ),"); - } - - public override string ToString(1) - { - return string.Format("new PokemonData(" - Id: Pokemons.{NAME.ToUpper()}, regionalDex: new int[]{ {RegionalDex} }, type1: Types.{Type1}, type2: Types.{Type2},\n" + - $"ability1: Abilities.{Ability1}, ability2: Abilities.{Ability2}, hiddenAbility: Abilities.{HiddenAbility},\n" + - $"maleRatio: {MaleRatio}, catchRate: {CatchRate}, eggGroup1: EggGroups.{EggGroup1}, eggGroup2: EggGroups.{EggGroup2}, hatchTime: {HatchTime},\n" + - $"height: {Height}, weight: {Weight}, baseExpYield: {EXPYield}, levelingRate: LevelingRate.{LevelingRate},\n" + - $"pokedexColor: Color.{PokedexColor}, baseFriendship: {BaseFriendship},\n" + - $"baseStatsHP: {BSHP}, baseStatsATK: {BSATK}, baseStatsDEF: {BSDEF}, baseStatsSPA: {BSSPA}, baseStatsSPD: {BSSPD}, baseStatsSPE: {BSSPE},\n" + - $"effortValuesHP: {EYHP}, effortValuesATK: {EYATK}, effortValuesDEF: {EYDEF}, effortValuesSPA: {EYSPA}, effortValuesSPD: {EYSPD}, effortValues: {EYSPE},\n" + - //$"luminance: {Luminance},\n" + - @"movesetmoves: new PokemonMoveset[] " + - $"\n" +using System; +using System; using System.Collections.Generic; using System.Linq; using System.Text; @@ -247,9 +117,9 @@ public override string ToString() } ///Int value doesnt matter, ex `.ToString(1);` - public override string ToString(int newVersion) - { - return string.Format("new PokemonData({0} {1} {2} {3} {4} {5} {6} {7} {8} {9} " + + public override string ToString(int newVersion) + { + return string.Format("new PokemonData({0} {1} {2} {3} {4} {5} {6} {7} {8} {9} " + "{10} {11} {12} {13} {14} {15} {16} {17} {18} {19} " + "{20} {21} {22} {23} {24} {25} {26} {27} {28} {29} " + "{30} {31} {32})", @@ -257,57 +127,43 @@ public override string ToString(int newVersion) RegionalDex == null? "" : ",\nregionalDex: new int[]{"+RegionalDex+"}", Type1 == null? "" : ",\ntype1: Types."+Type1, Type2 == null? "" : ",\ntype2: Types."+Type2, - Ability1 == null? "" : ",\nability1: Abilities."+Ability1, + Ability1 == null? "" : ",\nability1: Abilities."+Ability1, Ability2 == null? "" : ",\nability2: Abilities."+Ability2, HiddenAbility == null? "" : ",\nhiddenAbility: Abilities."+HiddenAbility, - MaleRatio == null? "" : ",\nmaleRatio: "+MaleRatio, + MaleRatio == null? "" : ",\nmaleRatio: "+MaleRatio, CatchRate == null? "" : ",\ncatchRate: "+CatchRate, EggGroup1 == null? "" : ",\neggGroup1: EggGroups."+EggGroup1, EggGroup2 == null? "" : ",\neggGroup2: EggGroups."+EggGroup2, HatchTime == null? "" : ",\nhatchTime: "+HatchTime, - Height == null? "" : ",\nheight: "+Height, + Height == null? "" : ",\nheight: "+Height, Weight == null? "" : ",\nweight: "+Weight, LevelingRate == null? "" : ",\nlevelingRate: LevelingRate."+LevelingRate,//\n" + - PokedexColor == null? "" : ",\npokedexColor: Color."+PokedexColor, + PokedexColor == null? "" : ",\npokedexColor: Color."+PokedexColor, BaseFriendship == null? "" : ",\nbaseFriendship: "+BaseFriendship, EXPYield == null? "" : ",\nbaseExpYield: "+EXPYield, - BSHP == null? "" : ",baseStatsHP: "+BSHP, + BSHP == null? "" : ",baseStatsHP: "+BSHP, BSATK == null? "" : ",baseStatsATK: "+BSATK, BSDEF == null? "" : ",baseStatsDEF: "+BSDEF, BSSPA == null? "" : ",baseStatsSPA: "+BSSPA, BSSPD == null? "" : ",baseStatsSPD: "+BSSPD, BSSPE == null? "" : ",baseStatsSPE: "+BSSPE,//\n" + - EYHP == null? "" : ",\neffortValuesHP: "+EYHP, + EYHP == null? "" : ",\nevHP: "+EYHP, EYATK == null? "" : ",evATK: "+EYATK, EYDEF == null? "" : ",evDEF: "+EYDEF, EYSPA == null? "" : ",evSPA: "+EYSPA, EYSPD == null? "" : ",evSPD: "+EYSPD, EYSPE == null? "" : ",evSPE: "+EYSPE,//\n" + - //NAME == null? "" : "$"luminance: "+Luminance,\n" + - ",movesetmoves: new PokemonMoveset[] " + - //$"\n" + - "{" + - LevelMoves + "\n" + - TMMoves + "\n" + - "}", - //$"\n" + - PokemonEvolution == null? "" : ",evolution: new IPokemonEvolution[] {" + PokemonEvolution +"}," - //,HeldItem == null? "" : "heldItem: "+HeldItem +"," + //NAME == null? "" : "$"luminance: "+Luminance,\n" + + ",movesetmoves: new PokemonMoveset[] " + + //$"\n" + + "{" + + LevelMoves + "\n" + + TMMoves + "\n" + + "}", + //$"\n" + + PokemonEvolution == null? "" : ",evolution: new IPokemonEvolution[] {" + PokemonEvolution +"}," + //,HeldItem == null? "" : "heldItem: "+HeldItem +"," ); - } - } -} - - @"{{" + - $"{LevelMoves}\n" + - $"{TMMoves}\n" + - @"}}," + - $"\n" + - @"evolution: new IPokemonEvolution[] {{" + - $"{PokemonEvolution}" + - @"}}," + - //$"\nheldItem: {HeldItem} - ),"); - } - } + } + } } From 38e3b46ec1c1cc5496c71a15192481f322b2a3c4 Mon Sep 17 00:00:00 2001 From: Herbert Milhomme Date: Mon, 4 Jun 2018 12:08:51 -0400 Subject: [PATCH 3/6] More NULL Checks, and Fixes --- .../CSVDatabaseReader/Pokemon.cs | 34 +++++++++---------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/PokemonDatabase/Source Files/CSVDatabaseReader/CSVDatabaseReader/Pokemon.cs b/PokemonDatabase/Source Files/CSVDatabaseReader/CSVDatabaseReader/Pokemon.cs index 11138b5ae..6c477146a 100644 --- a/PokemonDatabase/Source Files/CSVDatabaseReader/CSVDatabaseReader/Pokemon.cs +++ b/PokemonDatabase/Source Files/CSVDatabaseReader/CSVDatabaseReader/Pokemon.cs @@ -122,18 +122,18 @@ public override string ToString(int newVersion) return string.Format("new PokemonData({0} {1} {2} {3} {4} {5} {6} {7} {8} {9} " + "{10} {11} {12} {13} {14} {15} {16} {17} {18} {19} " + "{20} {21} {22} {23} {24} {25} {26} {27} {28} {29} " + - "{30} {31} {32})", + "{30} {31} {32}),", NAME == null? "" : "Id: Pokemons."+NAME.ToUpper(), RegionalDex == null? "" : ",\nregionalDex: new int[]{"+RegionalDex+"}", - Type1 == null? "" : ",\ntype1: Types."+Type1, - Type2 == null? "" : ",\ntype2: Types."+Type2, - Ability1 == null? "" : ",\nability1: Abilities."+Ability1, - Ability2 == null? "" : ",\nability2: Abilities."+Ability2, - HiddenAbility == null? "" : ",\nhiddenAbility: Abilities."+HiddenAbility, + Type1 == null || Type1 == "Types.NONE"? "" : ",\ntype1: Types."+Type1, + Type2 == null || Type2 == "Types.NONE"? "" : ",\ntype2: Types."+Type2, + Ability1 == null || Ability1 == "Abilities.NONE"? "" : ",\nability1: Abilities."+Ability1, + Ability2 == null || Ability2 == "Abilities.NONE"? "" : ",\nability2: Abilities."+Ability2, + HiddenAbility == null || HiddenAbility == "Abilities.NONE"? "" : ",\nhiddenAbility: Abilities."+HiddenAbility, MaleRatio == null? "" : ",\nmaleRatio: "+MaleRatio, CatchRate == null? "" : ",\ncatchRate: "+CatchRate, - EggGroup1 == null? "" : ",\neggGroup1: EggGroups."+EggGroup1, - EggGroup2 == null? "" : ",\neggGroup2: EggGroups."+EggGroup2, + EggGroup1 == null || EggGroup1 == "EggGroups.NONE"? "" : ",\neggGroup1: EggGroups."+EggGroup1, + EggGroup2 == null || EggGroup2 == "EggGroups.NONE"? "" : ",\neggGroup2: EggGroups."+EggGroup2, HatchTime == null? "" : ",\nhatchTime: "+HatchTime, Height == null? "" : ",\nheight: "+Height, Weight == null? "" : ",\nweight: "+Weight, @@ -147,21 +147,21 @@ public override string ToString(int newVersion) BSSPA == null? "" : ",baseStatsSPA: "+BSSPA, BSSPD == null? "" : ",baseStatsSPD: "+BSSPD, BSSPE == null? "" : ",baseStatsSPE: "+BSSPE,//\n" + - EYHP == null? "" : ",\nevHP: "+EYHP, - EYATK == null? "" : ",evATK: "+EYATK, - EYDEF == null? "" : ",evDEF: "+EYDEF, - EYSPA == null? "" : ",evSPA: "+EYSPA, - EYSPD == null? "" : ",evSPD: "+EYSPD, - EYSPE == null? "" : ",evSPE: "+EYSPE,//\n" + + EYHP == null || EYHP == "0"? "" : ",\nevHP: "+EYHP, + EYATK == null || EYATK == "0"? "" : ",evATK: "+EYATK, + EYDEF == null || EYDEF == "0"? "" : ",evDEF: "+EYDEF, + EYSPA == null || EYSPA == "0"? "" : ",evSPA: "+EYSPA, + EYSPD == null || EYSPD == "0"? "" : ",evSPD: "+EYSPD, + EYSPE == null || EYSPE == "0"? "" : ",evSPE: "+EYSPE,//\n" + //NAME == null? "" : "$"luminance: "+Luminance,\n" + ",movesetmoves: new PokemonMoveset[] " + //$"\n" + - "{" + + "{\n" + LevelMoves + "\n" + - TMMoves + "\n" + + TMMoves.TrimEnd(',') + "\n" + "}", //$"\n" + - PokemonEvolution == null? "" : ",evolution: new IPokemonEvolution[] {" + PokemonEvolution +"}," + PokemonEvolution == null? "" : ",evolution: new IPokemonEvolution[] {" + PokemonEvolution +"}" //,HeldItem == null? "" : "heldItem: "+HeldItem +"," ); } From 968a4dd122a2d31d37e9620b3bba0bc8f737e72c Mon Sep 17 00:00:00 2001 From: Herbert Milhomme Date: Mon, 4 Jun 2018 15:44:12 -0400 Subject: [PATCH 4/6] Last and final tweaks --- .../CSVDatabaseReader/CSVDatabaseReader/Pokemon.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/PokemonDatabase/Source Files/CSVDatabaseReader/CSVDatabaseReader/Pokemon.cs b/PokemonDatabase/Source Files/CSVDatabaseReader/CSVDatabaseReader/Pokemon.cs index 6c477146a..122c826ce 100644 --- a/PokemonDatabase/Source Files/CSVDatabaseReader/CSVDatabaseReader/Pokemon.cs +++ b/PokemonDatabase/Source Files/CSVDatabaseReader/CSVDatabaseReader/Pokemon.cs @@ -122,8 +122,8 @@ public override string ToString(int newVersion) return string.Format("new PokemonData({0} {1} {2} {3} {4} {5} {6} {7} {8} {9} " + "{10} {11} {12} {13} {14} {15} {16} {17} {18} {19} " + "{20} {21} {22} {23} {24} {25} {26} {27} {28} {29} " + - "{30} {31} {32}),", - NAME == null? "" : "Id: Pokemons."+NAME.ToUpper(), + "{30} {31}),", + NAME == null? "" : "\nId: Pokemons."+NAME.ToUpper(), RegionalDex == null? "" : ",\nregionalDex: new int[]{"+RegionalDex+"}", Type1 == null || Type1 == "Types.NONE"? "" : ",\ntype1: Types."+Type1, Type2 == null || Type2 == "Types.NONE"? "" : ",\ntype2: Types."+Type2, @@ -141,7 +141,7 @@ public override string ToString(int newVersion) PokedexColor == null? "" : ",\npokedexColor: Color."+PokedexColor, BaseFriendship == null? "" : ",\nbaseFriendship: "+BaseFriendship, EXPYield == null? "" : ",\nbaseExpYield: "+EXPYield, - BSHP == null? "" : ",baseStatsHP: "+BSHP, + BSHP == null? "" : ",\nbaseStatsHP: "+BSHP, BSATK == null? "" : ",baseStatsATK: "+BSATK, BSDEF == null? "" : ",baseStatsDEF: "+BSDEF, BSSPA == null? "" : ",baseStatsSPA: "+BSSPA, @@ -154,7 +154,7 @@ public override string ToString(int newVersion) EYSPD == null || EYSPD == "0"? "" : ",evSPD: "+EYSPD, EYSPE == null || EYSPE == "0"? "" : ",evSPE: "+EYSPE,//\n" + //NAME == null? "" : "$"luminance: "+Luminance,\n" + - ",movesetmoves: new PokemonMoveset[] " + + ",\nmovesetmoves: new PokemonMoveset[] " + //$"\n" + "{\n" + LevelMoves + "\n" + From 08e86b91de056aa8e359d8374675f323a7db10e4 Mon Sep 17 00:00:00 2001 From: Herbert Milhomme Date: Mon, 4 Jun 2018 15:51:30 -0400 Subject: [PATCH 5/6] Final FINAL tweaks... fixed comma concern on moves, and ocd issue with evolution new line spacing. --- .../CSVDatabaseReader/CSVDatabaseReader/Pokemon.cs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/PokemonDatabase/Source Files/CSVDatabaseReader/CSVDatabaseReader/Pokemon.cs b/PokemonDatabase/Source Files/CSVDatabaseReader/CSVDatabaseReader/Pokemon.cs index 122c826ce..b313c3740 100644 --- a/PokemonDatabase/Source Files/CSVDatabaseReader/CSVDatabaseReader/Pokemon.cs +++ b/PokemonDatabase/Source Files/CSVDatabaseReader/CSVDatabaseReader/Pokemon.cs @@ -157,11 +157,14 @@ public override string ToString(int newVersion) ",\nmovesetmoves: new PokemonMoveset[] " + //$"\n" + "{\n" + - LevelMoves + "\n" + - TMMoves.TrimEnd(',') + "\n" + + //trimend goes on last value, but there's also a comma before every value so it's fine + //it balances out the extra, and also if the value is null, you're not left with additional + //or dangling commas to trigger any errors. + LevelMoves.TrimEnd(',') + "\n" + + ","+TMMoves.TrimEnd(',') + "\n" + "}", //$"\n" + - PokemonEvolution == null? "" : ",evolution: new IPokemonEvolution[] {" + PokemonEvolution +"}" + PokemonEvolution == null? "" : ",\nevolution: new IPokemonEvolution[] {" + PokemonEvolution +"}" //,HeldItem == null? "" : "heldItem: "+HeldItem +"," ); } From b4d32f6c808ff6c2291a46f20c5d1a2a34c34272 Mon Sep 17 00:00:00 2001 From: Herbert Milhomme Date: Tue, 5 Jun 2018 09:34:21 -0400 Subject: [PATCH 6/6] Update Pokemon.cs --- .../CSVDatabaseReader/Pokemon.cs | 25 ------------------- 1 file changed, 25 deletions(-) diff --git a/PokemonDatabase/Source Files/CSVDatabaseReader/CSVDatabaseReader/Pokemon.cs b/PokemonDatabase/Source Files/CSVDatabaseReader/CSVDatabaseReader/Pokemon.cs index b313c3740..4b9489157 100644 --- a/PokemonDatabase/Source Files/CSVDatabaseReader/CSVDatabaseReader/Pokemon.cs +++ b/PokemonDatabase/Source Files/CSVDatabaseReader/CSVDatabaseReader/Pokemon.cs @@ -94,31 +94,6 @@ public enum Types public override string ToString() { - return string.Format($"new PokemonData( Id: Pokemons.{NAME.ToUpper()}, regionalDex: new int[]{ {RegionalDex} }, type1: Types.{Type1}, type2: Types.{Type2},\n" + - $"ability1: Abilities.{Ability1}, ability2: Abilities.{Ability2}, hiddenAbility: Abilities.{HiddenAbility},\n" + - $"maleRatio: {MaleRatio}, catchRate: {CatchRate}, eggGroup1: EggGroups.{EggGroup1}, eggGroup2: EggGroups.{EggGroup2}, hatchTime: {HatchTime},\n" + - $"height: {Height}, weight: {Weight}, baseExpYield: {EXPYield}, levelingRate: LevelingRate.{LevelingRate},\n" + - $"pokedexColor: Color.{PokedexColor}, baseFriendship: {BaseFriendship},\n" + - $"baseStatsHP: {BSHP}, baseStatsATK: {BSATK}, baseStatsDEF: {BSDEF}, baseStatsSPA: {BSSPA}, baseStatsSPD: {BSSPD}, baseStatsSPE: {BSSPE},\n" + - $"effortValuesHP: {EYHP}, effortValuesATK: {EYATK}, effortValuesDEF: {EYDEF}, effortValuesSPA: {EYSPA}, effortValuesSPD: {EYSPD}, effortValues: {EYSPE},\n" + - //$"luminance: {Luminance},\n" + - @"movesetmoves: new PokemonMoveset[] " + - $"\n" + - @"{{" + - $"{LevelMoves}\n" + - $"{TMMoves}\n" + - @"}}," + - $"\n" + - @"evolution: new IPokemonEvolution[] {{" + - $"{PokemonEvolution}" + - @"}}," + - //$"\nheldItem: {HeldItem} - ),"); - } - - ///Int value doesnt matter, ex `.ToString(1);` - public override string ToString(int newVersion) - { return string.Format("new PokemonData({0} {1} {2} {3} {4} {5} {6} {7} {8} {9} " + "{10} {11} {12} {13} {14} {15} {16} {17} {18} {19} " + "{20} {21} {22} {23} {24} {25} {26} {27} {28} {29} " +