diff --git a/GlobalTerminalService/GTServer4.cs b/GlobalTerminalService/GTServer4.cs index 5dd9e84d..f1d7445b 100644 --- a/GlobalTerminalService/GTServer4.cs +++ b/GlobalTerminalService/GTServer4.cs @@ -8,6 +8,7 @@ using PkmnFoundations.Structures; using PkmnFoundations.Data; using System.Net.Sockets; using System.Diagnostics; +using PkmnFoundations.Wfc; namespace PkmnFoundations.GlobalTerminalService { diff --git a/GlobalTerminalService/GTServer5.cs b/GlobalTerminalService/GTServer5.cs index f1568dda..4da070cd 100644 --- a/GlobalTerminalService/GTServer5.cs +++ b/GlobalTerminalService/GTServer5.cs @@ -9,6 +9,7 @@ using PkmnFoundations.Data; using System.Security.Cryptography.X509Certificates; using System.Net.Sockets; using System.Diagnostics; +using PkmnFoundations.Wfc; namespace PkmnFoundations.GlobalTerminalService { diff --git a/bvRestorer4/Program.cs b/bvRestorer4/Program.cs index c4f316ea..dadd6dfb 100644 --- a/bvRestorer4/Program.cs +++ b/bvRestorer4/Program.cs @@ -6,6 +6,7 @@ using System.IO; using PkmnFoundations.Support; using PkmnFoundations.Structures; using PkmnFoundations.Data; +using PkmnFoundations.Wfc; namespace bvRestorer4 { diff --git a/bvRestorer5/Program.cs b/bvRestorer5/Program.cs index 7207b34b..657e131c 100644 --- a/bvRestorer5/Program.cs +++ b/bvRestorer5/Program.cs @@ -6,6 +6,7 @@ using System.Text; using PkmnFoundations.Data; using PkmnFoundations.Structures; using PkmnFoundations.Support; +using PkmnFoundations.Wfc; namespace bvRestorer5 { diff --git a/gts/pokemondpds.ashx.cs b/gts/pokemondpds.ashx.cs index 260dce39..bd021534 100644 --- a/gts/pokemondpds.ashx.cs +++ b/gts/pokemondpds.ashx.cs @@ -9,6 +9,7 @@ using PkmnFoundations.Support; using System.IO; using System.Threading; using GamestatsBase; +using PkmnFoundations.Wfc; namespace PkmnFoundations.GTS { diff --git a/gts/pokemondpds_web.ashx.cs b/gts/pokemondpds_web.ashx.cs index 1766c43f..56f6f235 100644 --- a/gts/pokemondpds_web.ashx.cs +++ b/gts/pokemondpds_web.ashx.cs @@ -6,6 +6,7 @@ using System.Web; using GamestatsBase; using PkmnFoundations.Data; using PkmnFoundations.Structures; +using PkmnFoundations.Wfc; namespace PkmnFoundations.GTS { diff --git a/gts/src/BanHelper.cs b/gts/src/BanHelper.cs index 514866af..d2ddf153 100644 --- a/gts/src/BanHelper.cs +++ b/gts/src/BanHelper.cs @@ -1,5 +1,6 @@ using PkmnFoundations.Data; using PkmnFoundations.Structures; +using PkmnFoundations.Wfc; using System; using System.Collections.Generic; using System.Linq; diff --git a/gts/src/FakeOpponentGenerator.cs b/gts/src/FakeOpponentGenerator.cs index 903f4394..7084547e 100644 --- a/gts/src/FakeOpponentGenerator.cs +++ b/gts/src/FakeOpponentGenerator.cs @@ -4,6 +4,7 @@ using System.Linq; using System.Web; using PkmnFoundations.Structures; using PkmnFoundations.Support; +using PkmnFoundations.Wfc; namespace PkmnFoundations.GTS { diff --git a/gts/syachi2ds.ashx.cs b/gts/syachi2ds.ashx.cs index 3ab1aef2..dca9c7ea 100644 --- a/gts/syachi2ds.ashx.cs +++ b/gts/syachi2ds.ashx.cs @@ -8,6 +8,7 @@ using PkmnFoundations.Structures; using PkmnFoundations.Support; using System.IO; using GamestatsBase; +using PkmnFoundations.Wfc; namespace PkmnFoundations.GTS { diff --git a/library/Data/DataMysql.cs b/library/Data/DataMysql.cs index 6b8f923e..5e6362bd 100644 --- a/library/Data/DataMysql.cs +++ b/library/Data/DataMysql.cs @@ -8,6 +8,7 @@ using PkmnFoundations.Structures; using PkmnFoundations.Support; using System.Security.Cryptography; using PkmnFoundations.Pokedex; +using PkmnFoundations.Wfc; namespace PkmnFoundations.Data { diff --git a/library/Data/Database.cs b/library/Data/Database.cs index cd905f25..ba87f75d 100644 --- a/library/Data/Database.cs +++ b/library/Data/Database.cs @@ -6,6 +6,7 @@ using System.Data; using PkmnFoundations.Structures; using System.Configuration; using PkmnFoundations.Pokedex; +using PkmnFoundations.Wfc; namespace PkmnFoundations.Data { diff --git a/library/Library.csproj b/library/Library.csproj index 3011aece..bb2b1584 100644 --- a/library/Library.csproj +++ b/library/Library.csproj @@ -75,33 +75,33 @@ - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + - + - + - - + + - + @@ -112,11 +112,11 @@ - - - - - + + + + + diff --git a/library/Structures/BinarySerializableBase.cs b/library/Support/BinarySerializableBase.cs similarity index 97% rename from library/Structures/BinarySerializableBase.cs rename to library/Support/BinarySerializableBase.cs index 29bf463c..c7b3a29c 100644 --- a/library/Structures/BinarySerializableBase.cs +++ b/library/Support/BinarySerializableBase.cs @@ -5,7 +5,7 @@ using System.Linq; using System.Runtime.Serialization; using System.Text; -namespace PkmnFoundations.Structures +namespace PkmnFoundations.Support { /// /// Base class for objects which serialize using BinaryReader and BinaryWriter diff --git a/library/Structures/BanStatus.cs b/library/Wfc/BanStatus.cs similarity index 94% rename from library/Structures/BanStatus.cs rename to library/Wfc/BanStatus.cs index d378bc57..8b50dc2b 100644 --- a/library/Structures/BanStatus.cs +++ b/library/Wfc/BanStatus.cs @@ -3,7 +3,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; -namespace PkmnFoundations.Structures +namespace PkmnFoundations.Wfc { public class BanStatus { diff --git a/library/Structures/BattleSubwayPokemon5.cs b/library/Wfc/BattleSubwayPokemon5.cs similarity index 98% rename from library/Structures/BattleSubwayPokemon5.cs rename to library/Wfc/BattleSubwayPokemon5.cs index 1d239630..ac40b103 100644 --- a/library/Structures/BattleSubwayPokemon5.cs +++ b/library/Wfc/BattleSubwayPokemon5.cs @@ -3,9 +3,10 @@ using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; +using PkmnFoundations.Structures; using PkmnFoundations.Support; -namespace PkmnFoundations.Structures +namespace PkmnFoundations.Wfc { public class BattleSubwayPokemon5 : BattleTowerPokemonBase { diff --git a/library/Structures/BattleSubwayProfile5.cs b/library/Wfc/BattleSubwayProfile5.cs similarity index 97% rename from library/Structures/BattleSubwayProfile5.cs rename to library/Wfc/BattleSubwayProfile5.cs index 644e4182..c17daf78 100644 --- a/library/Structures/BattleSubwayProfile5.cs +++ b/library/Wfc/BattleSubwayProfile5.cs @@ -3,9 +3,10 @@ using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; +using PkmnFoundations.Structures; using PkmnFoundations.Support; -namespace PkmnFoundations.Structures +namespace PkmnFoundations.Wfc { public class BattleSubwayProfile5 : BattleTowerProfileBase { diff --git a/library/Structures/BattleSubwayRecord5.cs b/library/Wfc/BattleSubwayRecord5.cs similarity index 99% rename from library/Structures/BattleSubwayRecord5.cs rename to library/Wfc/BattleSubwayRecord5.cs index 5cc23af7..d9a6119c 100644 --- a/library/Structures/BattleSubwayRecord5.cs +++ b/library/Wfc/BattleSubwayRecord5.cs @@ -5,7 +5,7 @@ using System.Linq; using System.Text; using PkmnFoundations.Support; -namespace PkmnFoundations.Structures +namespace PkmnFoundations.Wfc { public class BattleSubwayRecord5 : BattleTowerRecordBase { diff --git a/library/Structures/BattleTowerPokemon4.cs b/library/Wfc/BattleTowerPokemon4.cs similarity index 98% rename from library/Structures/BattleTowerPokemon4.cs rename to library/Wfc/BattleTowerPokemon4.cs index 47abc51a..d51de5e6 100644 --- a/library/Structures/BattleTowerPokemon4.cs +++ b/library/Wfc/BattleTowerPokemon4.cs @@ -3,9 +3,10 @@ using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; +using PkmnFoundations.Structures; using PkmnFoundations.Support; -namespace PkmnFoundations.Structures +namespace PkmnFoundations.Wfc { public class BattleTowerPokemon4 : BattleTowerPokemonBase { diff --git a/library/Structures/BattleTowerPokemonBase.cs b/library/Wfc/BattleTowerPokemonBase.cs similarity index 97% rename from library/Structures/BattleTowerPokemonBase.cs rename to library/Wfc/BattleTowerPokemonBase.cs index 10a2f505..1c097e52 100644 --- a/library/Structures/BattleTowerPokemonBase.cs +++ b/library/Wfc/BattleTowerPokemonBase.cs @@ -4,9 +4,10 @@ using System.IO; using System.Linq; using System.Text; using PkmnFoundations.Pokedex; +using PkmnFoundations.Structures; using PkmnFoundations.Support; -namespace PkmnFoundations.Structures +namespace PkmnFoundations.Wfc { public abstract class BattleTowerPokemonBase : PokemonBase { diff --git a/library/Structures/BattleTowerProfile4.cs b/library/Wfc/BattleTowerProfile4.cs similarity index 98% rename from library/Structures/BattleTowerProfile4.cs rename to library/Wfc/BattleTowerProfile4.cs index 48256172..cf3dce68 100644 --- a/library/Structures/BattleTowerProfile4.cs +++ b/library/Wfc/BattleTowerProfile4.cs @@ -3,9 +3,10 @@ using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; +using PkmnFoundations.Structures; using PkmnFoundations.Support; -namespace PkmnFoundations.Structures +namespace PkmnFoundations.Wfc { public class BattleTowerProfile4 : BattleTowerProfileBase { diff --git a/library/Structures/BattleTowerProfileBase.cs b/library/Wfc/BattleTowerProfileBase.cs similarity index 86% rename from library/Structures/BattleTowerProfileBase.cs rename to library/Wfc/BattleTowerProfileBase.cs index feb09420..05b95e92 100644 --- a/library/Structures/BattleTowerProfileBase.cs +++ b/library/Wfc/BattleTowerProfileBase.cs @@ -3,7 +3,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; -namespace PkmnFoundations.Structures +namespace PkmnFoundations.Wfc { public abstract class BattleTowerProfileBase { diff --git a/library/Structures/BattleTowerRecord4.cs b/library/Wfc/BattleTowerRecord4.cs similarity index 99% rename from library/Structures/BattleTowerRecord4.cs rename to library/Wfc/BattleTowerRecord4.cs index 87b12da3..b4f35f02 100644 --- a/library/Structures/BattleTowerRecord4.cs +++ b/library/Wfc/BattleTowerRecord4.cs @@ -5,7 +5,7 @@ using System.Linq; using System.Text; using PkmnFoundations.Support; -namespace PkmnFoundations.Structures +namespace PkmnFoundations.Wfc { public class BattleTowerRecord4 : BattleTowerRecordBase { diff --git a/library/Structures/BattleTowerRecordBase.cs b/library/Wfc/BattleTowerRecordBase.cs similarity index 94% rename from library/Structures/BattleTowerRecordBase.cs rename to library/Wfc/BattleTowerRecordBase.cs index 05dd833c..b7729c1b 100644 --- a/library/Structures/BattleTowerRecordBase.cs +++ b/library/Wfc/BattleTowerRecordBase.cs @@ -4,7 +4,7 @@ using System.Linq; using System.Text; using PkmnFoundations.Support; -namespace PkmnFoundations.Structures +namespace PkmnFoundations.Wfc { public abstract class BattleTowerRecordBase { diff --git a/library/Structures/BattleVideoHeader4.cs b/library/Wfc/BattleVideoHeader4.cs similarity index 99% rename from library/Structures/BattleVideoHeader4.cs rename to library/Wfc/BattleVideoHeader4.cs index 0a7997b6..acd0c13a 100644 --- a/library/Structures/BattleVideoHeader4.cs +++ b/library/Wfc/BattleVideoHeader4.cs @@ -3,7 +3,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; -namespace PkmnFoundations.Structures +namespace PkmnFoundations.Wfc { public class BattleVideoHeader4 { diff --git a/library/Structures/BattleVideoHeader5.cs b/library/Wfc/BattleVideoHeader5.cs similarity index 98% rename from library/Structures/BattleVideoHeader5.cs rename to library/Wfc/BattleVideoHeader5.cs index 81526759..243ebc27 100644 --- a/library/Structures/BattleVideoHeader5.cs +++ b/library/Wfc/BattleVideoHeader5.cs @@ -3,7 +3,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; -namespace PkmnFoundations.Structures +namespace PkmnFoundations.Wfc { public class BattleVideoHeader5 { diff --git a/library/Structures/BattleVideoRecord4.cs b/library/Wfc/BattleVideoRecord4.cs similarity index 97% rename from library/Structures/BattleVideoRecord4.cs rename to library/Wfc/BattleVideoRecord4.cs index 91d8c73a..97a31875 100644 --- a/library/Structures/BattleVideoRecord4.cs +++ b/library/Wfc/BattleVideoRecord4.cs @@ -3,7 +3,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; -namespace PkmnFoundations.Structures +namespace PkmnFoundations.Wfc { public class BattleVideoRecord4 { diff --git a/library/Structures/BattleVideoRecord5.cs b/library/Wfc/BattleVideoRecord5.cs similarity index 97% rename from library/Structures/BattleVideoRecord5.cs rename to library/Wfc/BattleVideoRecord5.cs index 301f49a0..813c8644 100644 --- a/library/Structures/BattleVideoRecord5.cs +++ b/library/Wfc/BattleVideoRecord5.cs @@ -3,7 +3,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; -namespace PkmnFoundations.Structures +namespace PkmnFoundations.Wfc { public class BattleVideoRecord5 { diff --git a/library/Structures/BoxRecord4.cs b/library/Wfc/BoxRecord4.cs similarity index 97% rename from library/Structures/BoxRecord4.cs rename to library/Wfc/BoxRecord4.cs index ce3a21ba..9dc5636b 100644 --- a/library/Structures/BoxRecord4.cs +++ b/library/Wfc/BoxRecord4.cs @@ -3,8 +3,9 @@ using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; +using PkmnFoundations.Support; -namespace PkmnFoundations.Structures +namespace PkmnFoundations.Wfc { public class BoxRecord4 : BinarySerializableBase { diff --git a/library/Structures/DressupRecord4.cs b/library/Wfc/DressupRecord4.cs similarity index 97% rename from library/Structures/DressupRecord4.cs rename to library/Wfc/DressupRecord4.cs index 9c471864..74f5d1b3 100644 --- a/library/Structures/DressupRecord4.cs +++ b/library/Wfc/DressupRecord4.cs @@ -3,8 +3,9 @@ using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; +using PkmnFoundations.Support; -namespace PkmnFoundations.Structures +namespace PkmnFoundations.Wfc { public class DressupRecord4 : BinarySerializableBase { diff --git a/library/Structures/GtsRecord4.cs b/library/Wfc/GtsRecord4.cs similarity index 97% rename from library/Structures/GtsRecord4.cs rename to library/Wfc/GtsRecord4.cs index a373f0a3..41aa8829 100644 --- a/library/Structures/GtsRecord4.cs +++ b/library/Wfc/GtsRecord4.cs @@ -1,282 +1,283 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Runtime.Serialization; -using System.IO; -using PkmnFoundations.Support; -using System.Collections.ObjectModel; - -namespace PkmnFoundations.Structures -{ - /// - /// Structure used to represent Pokémon on the GTS in Generation IV. - /// Includes a Pokémon box structure and metadata related to the trainer - /// and request. - /// - public class GtsRecord4 : GtsRecordBase, IEquatable - { - public GtsRecord4(Pokedex.Pokedex pokedex) - : base(pokedex) - { - Initialize(); - } - - public GtsRecord4(Pokedex.Pokedex pokedex, BinaryReader data) - : base(pokedex) - { - Initialize(); - Load(data); - } - - public GtsRecord4(Pokedex.Pokedex pokedex, byte[] data) - : base(pokedex) - { - Initialize(); - Load(data); - } - - public GtsRecord4(Pokedex.Pokedex pokedex, byte[] data, int offset) - : base(pokedex) - { - Initialize(); - Load(data, offset); - } - - private void Initialize() - { - - } - - /// - /// Obfuscated Pokémon (pkm) data. 236 bytes - /// - public IList Data - { - get - { - return m_data_readonly; - } - set - { - DataActual = value.ToArray(); - } - } - - private byte[] DataActual - { - get - { - return m_data; - } - set - { - if (value == null) - { - m_data = null; - m_data_readonly = null; - m_pokemon = null; - return; - } - if (value.Length != 0xEC) throw new ArgumentException("PKM length is incorrect"); - m_data = value; - m_data_readonly = new ReadOnlyCollection(m_data); - m_pokemon = null; - } - } - private byte[] m_data; - private ReadOnlyCollection m_data_readonly; - private PokemonParty4 m_pokemon; - - public override PokemonPartyBase Pokemon - { - get - { - if (DataActual == null || m_pokedex == null) - return null; - if (m_pokemon == null) - m_pokemon = new PokemonParty4(m_pokedex, DataActual); - - return m_pokemon; - } - } - - public byte Unknown1; - public byte Unknown2; - - /// - /// 16 bytes - /// - public EncodedString4 TrainerNameEncoded; - - public override string TrainerName - { - get - { - if (TrainerNameEncoded == null) return null; - return TrainerNameEncoded.Text; - } - set - { - if (TrainerNameEncoded == null) TrainerNameEncoded = new EncodedString4(value, 16); - else TrainerNameEncoded.Text = value; - } - } - - public ushort TrainerOT; - - protected override void Save(BinaryWriter writer) - { - // todo: enclose in properties and validate these when assigning. - if (TrainerNameEncoded.RawData.Length != 0x10) throw new FormatException("Trainer name length is incorrect"); - - writer.Write(DataActual, 0, 0xec); // 0000 - writer.Write(Species); // 00EC - writer.Write((byte)Gender); // 00EE - writer.Write(Level); // 00EF - writer.Write(RequestedSpecies); // 00F0 - writer.Write((byte)RequestedGender); // 00F2 - writer.Write(RequestedMinLevel); // 00F3 - writer.Write(RequestedMaxLevel); // 00F4 - writer.Write(Unknown1); // 00F5 - writer.Write((byte)TrainerGender); // 00F6 - writer.Write(Unknown2); // 00F7 - writer.Write(DateToTimestamp(TimeDeposited)); // 00F8 - writer.Write(DateToTimestamp(TimeExchanged)); // 0100 - writer.Write(PID); // 0108 - writer.Write(TrainerNameEncoded.RawData, 0, 0x10); // 010C - writer.Write(TrainerOT); // 011C - writer.Write(TrainerCountry); // 011E - writer.Write(TrainerRegion); // 011F - writer.Write(TrainerClass); // 0120 - writer.Write(IsExchanged); // 0121 - writer.Write((byte)TrainerVersion); // 0122 - writer.Write((byte)TrainerLanguage); // 0123 - } - - protected override void Load(BinaryReader reader) - { - DataActual = reader.ReadBytes(0xec); // 0000 - Species = reader.ReadUInt16(); // 00EC - Gender = (Genders)reader.ReadByte(); // 00EE - Level = reader.ReadByte(); // 00EF - RequestedSpecies = reader.ReadUInt16(); // 00F0 - RequestedGender = (Genders)reader.ReadByte(); // 00F2 - RequestedMinLevel = reader.ReadByte(); // 00F3 - RequestedMaxLevel = reader.ReadByte(); // 00F4 - Unknown1 = reader.ReadByte(); // 00F5 - TrainerGender = (TrainerGenders)reader.ReadByte(); // 00F6 - Unknown2 = reader.ReadByte(); // 00F7 - TimeDeposited = TimestampToDate(reader.ReadUInt64()); // 00F8 - TimeExchanged = TimestampToDate(reader.ReadUInt64()); // 0100 - PID = reader.ReadInt32(); // 0108 - TrainerNameEncoded = new EncodedString4(reader.ReadBytes(0x10)); // 010C - TrainerOT = reader.ReadUInt16(); // 011C - TrainerCountry = reader.ReadByte(); // 011E - TrainerRegion = reader.ReadByte(); // 011F - TrainerClass = reader.ReadByte(); // 0120 - IsExchanged = reader.ReadByte(); // 0121 - TrainerVersion = (Versions)reader.ReadByte(); // 0122 - TrainerLanguage = (Languages)reader.ReadByte(); // 0123 - } - - public override int Size - { - get { return 292; } - } - - public GtsRecord4 Clone() - { - // todo: I am not very efficient - return new GtsRecord4(m_pokedex, Save()); - } - - public override bool Validate() - { - if (!base.Validate()) return false; - - // Forbid ball capsules. Credit: Gannio - if (((PokemonParty4)Pokemon).CapsuleIndex != 0) return false; - - return true; - } - - public bool CanTrade(GtsRecord4 other) - { - if (IsExchanged != 0 || other.IsExchanged != 0) return false; - - if (Species != other.RequestedSpecies) return false; - if (other.RequestedGender != Genders.Either && Gender != other.RequestedGender) return false; - if (!CheckLevels(other.RequestedMinLevel, other.RequestedMaxLevel, Level)) return false; - - if (RequestedSpecies != other.Species) return false; - if (RequestedGender != Genders.Either && other.Gender != RequestedGender) return false; - if (!CheckLevels(RequestedMinLevel, RequestedMaxLevel, other.Level)) return false; - - return true; - } - - public void FlagTraded(GtsRecord4 other) - { - Species = other.Species; - Gender = other.Gender; - Level = other.Level; - RequestedSpecies = other.RequestedSpecies; - RequestedGender = other.RequestedGender; - RequestedMinLevel = other.RequestedMinLevel; - RequestedMaxLevel = other.RequestedMaxLevel; - TimeDeposited = other.TimeDeposited; - TimeExchanged = DateTime.UtcNow; - PID = other.PID; - IsExchanged = 0x01; - } - - public override TrainerProfileBase ExtrapolateProfile() - { - TrainerProfile4 result = new TrainerProfile4(); - result.PID = PID; - result.Version = TrainerVersion; - result.Language = TrainerLanguage; - result.Country = TrainerCountry; - result.Region = TrainerRegion; - result.OT = TrainerOT; - result.Name = TrainerNameEncoded.Clone(); - - return result; - } - - public static bool operator ==(GtsRecord4 a, GtsRecord4 b) - { - if ((object)a == null && (object)b == null) return true; - if ((object)a == null || (object)b == null) return false; - // todo: optimize me - return a.Save().SequenceEqual(b.Save()); - } - - public static bool operator !=(GtsRecord4 a, GtsRecord4 b) - { - return !(a == b); - } - - public override bool Equals(object obj) - { - return this.Equals(obj as GtsRecord4); - } - - public bool Equals(GtsRecord4 other) - { - return this == other; - } - - public override int GetHashCode() - { - return ((int)DateToBinary(TimeDeposited) + (int)DateToBinary(TimeExchanged)) ^ PID; - } - - internal static long DateToBinary(DateTime ? dt) - { - if (dt == null) return 0L; - return ((DateTime)dt).ToBinary(); - } - } -} +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Runtime.Serialization; +using System.IO; +using PkmnFoundations.Structures; +using PkmnFoundations.Support; +using System.Collections.ObjectModel; + +namespace PkmnFoundations.Wfc +{ + /// + /// Structure used to represent Pokémon on the GTS in Generation IV. + /// Includes a Pokémon box structure and metadata related to the trainer + /// and request. + /// + public class GtsRecord4 : GtsRecordBase, IEquatable + { + public GtsRecord4(Pokedex.Pokedex pokedex) + : base(pokedex) + { + Initialize(); + } + + public GtsRecord4(Pokedex.Pokedex pokedex, BinaryReader data) + : base(pokedex) + { + Initialize(); + Load(data); + } + + public GtsRecord4(Pokedex.Pokedex pokedex, byte[] data) + : base(pokedex) + { + Initialize(); + Load(data); + } + + public GtsRecord4(Pokedex.Pokedex pokedex, byte[] data, int offset) + : base(pokedex) + { + Initialize(); + Load(data, offset); + } + + private void Initialize() + { + + } + + /// + /// Obfuscated Pokémon (pkm) data. 236 bytes + /// + public IList Data + { + get + { + return m_data_readonly; + } + set + { + DataActual = value.ToArray(); + } + } + + private byte[] DataActual + { + get + { + return m_data; + } + set + { + if (value == null) + { + m_data = null; + m_data_readonly = null; + m_pokemon = null; + return; + } + if (value.Length != 0xEC) throw new ArgumentException("PKM length is incorrect"); + m_data = value; + m_data_readonly = new ReadOnlyCollection(m_data); + m_pokemon = null; + } + } + private byte[] m_data; + private ReadOnlyCollection m_data_readonly; + private PokemonParty4 m_pokemon; + + public override PokemonPartyBase Pokemon + { + get + { + if (DataActual == null || m_pokedex == null) + return null; + if (m_pokemon == null) + m_pokemon = new PokemonParty4(m_pokedex, DataActual); + + return m_pokemon; + } + } + + public byte Unknown1; + public byte Unknown2; + + /// + /// 16 bytes + /// + public EncodedString4 TrainerNameEncoded; + + public override string TrainerName + { + get + { + if (TrainerNameEncoded == null) return null; + return TrainerNameEncoded.Text; + } + set + { + if (TrainerNameEncoded == null) TrainerNameEncoded = new EncodedString4(value, 16); + else TrainerNameEncoded.Text = value; + } + } + + public ushort TrainerOT; + + protected override void Save(BinaryWriter writer) + { + // todo: enclose in properties and validate these when assigning. + if (TrainerNameEncoded.RawData.Length != 0x10) throw new FormatException("Trainer name length is incorrect"); + + writer.Write(DataActual, 0, 0xec); // 0000 + writer.Write(Species); // 00EC + writer.Write((byte)Gender); // 00EE + writer.Write(Level); // 00EF + writer.Write(RequestedSpecies); // 00F0 + writer.Write((byte)RequestedGender); // 00F2 + writer.Write(RequestedMinLevel); // 00F3 + writer.Write(RequestedMaxLevel); // 00F4 + writer.Write(Unknown1); // 00F5 + writer.Write((byte)TrainerGender); // 00F6 + writer.Write(Unknown2); // 00F7 + writer.Write(DateToTimestamp(TimeDeposited)); // 00F8 + writer.Write(DateToTimestamp(TimeExchanged)); // 0100 + writer.Write(PID); // 0108 + writer.Write(TrainerNameEncoded.RawData, 0, 0x10); // 010C + writer.Write(TrainerOT); // 011C + writer.Write(TrainerCountry); // 011E + writer.Write(TrainerRegion); // 011F + writer.Write(TrainerClass); // 0120 + writer.Write(IsExchanged); // 0121 + writer.Write((byte)TrainerVersion); // 0122 + writer.Write((byte)TrainerLanguage); // 0123 + } + + protected override void Load(BinaryReader reader) + { + DataActual = reader.ReadBytes(0xec); // 0000 + Species = reader.ReadUInt16(); // 00EC + Gender = (Genders)reader.ReadByte(); // 00EE + Level = reader.ReadByte(); // 00EF + RequestedSpecies = reader.ReadUInt16(); // 00F0 + RequestedGender = (Genders)reader.ReadByte(); // 00F2 + RequestedMinLevel = reader.ReadByte(); // 00F3 + RequestedMaxLevel = reader.ReadByte(); // 00F4 + Unknown1 = reader.ReadByte(); // 00F5 + TrainerGender = (TrainerGenders)reader.ReadByte(); // 00F6 + Unknown2 = reader.ReadByte(); // 00F7 + TimeDeposited = TimestampToDate(reader.ReadUInt64()); // 00F8 + TimeExchanged = TimestampToDate(reader.ReadUInt64()); // 0100 + PID = reader.ReadInt32(); // 0108 + TrainerNameEncoded = new EncodedString4(reader.ReadBytes(0x10)); // 010C + TrainerOT = reader.ReadUInt16(); // 011C + TrainerCountry = reader.ReadByte(); // 011E + TrainerRegion = reader.ReadByte(); // 011F + TrainerClass = reader.ReadByte(); // 0120 + IsExchanged = reader.ReadByte(); // 0121 + TrainerVersion = (Versions)reader.ReadByte(); // 0122 + TrainerLanguage = (Languages)reader.ReadByte(); // 0123 + } + + public override int Size + { + get { return 292; } + } + + public GtsRecord4 Clone() + { + // todo: I am not very efficient + return new GtsRecord4(m_pokedex, Save()); + } + + public override bool Validate() + { + if (!base.Validate()) return false; + + // Forbid ball capsules. Credit: Gannio + if (((PokemonParty4)Pokemon).CapsuleIndex != 0) return false; + + return true; + } + + public bool CanTrade(GtsRecord4 other) + { + if (IsExchanged != 0 || other.IsExchanged != 0) return false; + + if (Species != other.RequestedSpecies) return false; + if (other.RequestedGender != Genders.Either && Gender != other.RequestedGender) return false; + if (!CheckLevels(other.RequestedMinLevel, other.RequestedMaxLevel, Level)) return false; + + if (RequestedSpecies != other.Species) return false; + if (RequestedGender != Genders.Either && other.Gender != RequestedGender) return false; + if (!CheckLevels(RequestedMinLevel, RequestedMaxLevel, other.Level)) return false; + + return true; + } + + public void FlagTraded(GtsRecord4 other) + { + Species = other.Species; + Gender = other.Gender; + Level = other.Level; + RequestedSpecies = other.RequestedSpecies; + RequestedGender = other.RequestedGender; + RequestedMinLevel = other.RequestedMinLevel; + RequestedMaxLevel = other.RequestedMaxLevel; + TimeDeposited = other.TimeDeposited; + TimeExchanged = DateTime.UtcNow; + PID = other.PID; + IsExchanged = 0x01; + } + + public override TrainerProfileBase ExtrapolateProfile() + { + TrainerProfile4 result = new TrainerProfile4(); + result.PID = PID; + result.Version = TrainerVersion; + result.Language = TrainerLanguage; + result.Country = TrainerCountry; + result.Region = TrainerRegion; + result.OT = TrainerOT; + result.Name = TrainerNameEncoded.Clone(); + + return result; + } + + public static bool operator ==(GtsRecord4 a, GtsRecord4 b) + { + if ((object)a == null && (object)b == null) return true; + if ((object)a == null || (object)b == null) return false; + // todo: optimize me + return a.Save().SequenceEqual(b.Save()); + } + + public static bool operator !=(GtsRecord4 a, GtsRecord4 b) + { + return !(a == b); + } + + public override bool Equals(object obj) + { + return this.Equals(obj as GtsRecord4); + } + + public bool Equals(GtsRecord4 other) + { + return this == other; + } + + public override int GetHashCode() + { + return ((int)DateToBinary(TimeDeposited) + (int)DateToBinary(TimeExchanged)) ^ PID; + } + + internal static long DateToBinary(DateTime ? dt) + { + if (dt == null) return 0L; + return ((DateTime)dt).ToBinary(); + } + } +} diff --git a/library/Structures/GtsRecord5.cs b/library/Wfc/GtsRecord5.cs similarity index 97% rename from library/Structures/GtsRecord5.cs rename to library/Wfc/GtsRecord5.cs index b71c784e..45373578 100644 --- a/library/Structures/GtsRecord5.cs +++ b/library/Wfc/GtsRecord5.cs @@ -1,280 +1,281 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Runtime.Serialization; -using System.IO; -using PkmnFoundations.Support; -using System.Collections.ObjectModel; - -namespace PkmnFoundations.Structures -{ - /// - /// Structure used to represent Pokémon on the GTS in Generation V. - /// Includes a Pokémon box structure and metadata related to the trainer - /// and request. - /// - public class GtsRecord5 : GtsRecordBase, IEquatable - { - public GtsRecord5(Pokedex.Pokedex pokedex) - : base(pokedex) - { - Initialize(); - } - - public GtsRecord5(Pokedex.Pokedex pokedex, BinaryReader data) - : base(pokedex) - { - Initialize(); - Load(data); - } - - public GtsRecord5(Pokedex.Pokedex pokedex, byte[] data) - : base(pokedex) - { - Initialize(); - Load(data); - } - - public GtsRecord5(Pokedex.Pokedex pokedex, byte[] data, int offset) - : base(pokedex) - { - Initialize(); - Load(data, offset); - } - - private void Initialize() - { - - } - - /// - /// Obfuscated Pokémon (pkm) data. 236 bytes - /// - public IList Data - { - get - { - return m_data_readonly; - } - set - { - DataActual = value.ToArray(); - } - } - - private byte[] DataActual - { - get - { - return m_data; - } - set - { - if (value == null) - { - m_data = null; - m_data_readonly = null; - m_pokemon = null; - return; - } - if (value.Length != 0xEC) throw new ArgumentException("PKM length is incorrect"); - m_data = value; - m_data_readonly = new ReadOnlyCollection(m_data); - m_pokemon = null; - } - } - private byte[] m_data; - private ReadOnlyCollection m_data_readonly; - private PokemonParty5 m_pokemon; - - public override PokemonPartyBase Pokemon - { - get - { - if (DataActual == null || m_pokedex == null) - return null; - if (m_pokemon == null) - m_pokemon = new PokemonParty5(m_pokedex, DataActual); - - return m_pokemon; - } - } - - public byte Unknown1; - public byte Unknown2; - - public uint TrainerOT; - - /// - /// 16 bytes - /// - public EncodedString5 TrainerNameEncoded; - - public override string TrainerName - { - get - { - if (TrainerNameEncoded == null) return null; - return TrainerNameEncoded.Text; - } - set - { - if (TrainerNameEncoded == null) TrainerNameEncoded = new EncodedString5(value, 16); - else TrainerNameEncoded.Text = value; - } - } - - public byte TrainerBadges; // speculative. Usually 8. - public byte TrainerUnityTower; - - protected override void Save(BinaryWriter writer) - { - // todo: enclose in properties and validate these when assigning. - if (TrainerNameEncoded.RawData.Length != 0x10) throw new FormatException("Trainer name length is incorrect"); - - writer.Write(DataActual, 0, 0xEC); // 0000 - writer.Write(Species); // 00EC - writer.Write((byte)Gender); // 00EE - writer.Write(Level); // 00EF - writer.Write(RequestedSpecies); // 00F0 - writer.Write((byte)RequestedGender); // 00F2 - writer.Write(RequestedMinLevel); // 00F3 - writer.Write(RequestedMaxLevel); // 00F4 - writer.Write(Unknown1); // 00F5 - writer.Write((byte)TrainerGender); // 00F6 - writer.Write(Unknown2); // 00F7 - writer.Write(DateToTimestamp(TimeDeposited)); // 00F8 - writer.Write(DateToTimestamp(TimeExchanged)); // 0100 - writer.Write(PID); // 0108 - writer.Write(TrainerOT); // 010C - writer.Write(TrainerNameEncoded.RawData, 0, 0x10); // 0110 - writer.Write(TrainerCountry); // 0120 - writer.Write(TrainerRegion); // 0121 - writer.Write(TrainerClass); // 0122 - writer.Write(IsExchanged); // 0123 - writer.Write((byte)TrainerVersion); // 0124 - writer.Write((byte)TrainerLanguage); // 0125 - writer.Write(TrainerBadges); // 0126 - writer.Write(TrainerUnityTower); // 0127 - } - - protected override void Load(BinaryReader reader) - { - DataActual = reader.ReadBytes(0xEC); // 0000 - Species = reader.ReadUInt16(); // 00EC - Gender = (Genders)reader.ReadByte(); // 00EE - Level = reader.ReadByte(); // 00EF - RequestedSpecies = reader.ReadUInt16(); // 00F0 - RequestedGender = (Genders)reader.ReadByte(); // 00F2 - RequestedMinLevel = reader.ReadByte(); // 00F3 - RequestedMaxLevel = reader.ReadByte(); // 00F4 - Unknown1 = reader.ReadByte(); // 00F5 - TrainerGender = (TrainerGenders)reader.ReadByte(); // 00F6 - Unknown2 = reader.ReadByte(); // 00F7 - TimeDeposited = TimestampToDate(reader.ReadUInt64()); // 00F8 - TimeExchanged = TimestampToDate(reader.ReadUInt64()); // 0100 - PID = reader.ReadInt32(); // 0108 - TrainerOT = reader.ReadUInt32(); // 010C - TrainerNameEncoded = new EncodedString5(reader.ReadBytes(0x10)); // 0110 - TrainerCountry = reader.ReadByte(); // 0120 - TrainerRegion = reader.ReadByte(); // 0121 - TrainerClass = reader.ReadByte(); // 0122 - IsExchanged = reader.ReadByte(); // 0123 - TrainerVersion = (Versions)reader.ReadByte(); // 0124 - TrainerLanguage = (Languages)reader.ReadByte(); // 0125 - TrainerBadges = reader.ReadByte(); // 0126 - TrainerUnityTower = reader.ReadByte(); // 0127 - } - - public override int Size - { - get { return 296; } - } - - public GtsRecord5 Clone() - { - // todo: I am not very efficient - return new GtsRecord5(m_pokedex, Save()); - } - - public override bool Validate() - { - if (!base.Validate()) return false; - - return true; - } - - public bool CanTrade(GtsRecord5 other) - { - if (IsExchanged != 0 || other.IsExchanged != 0) return false; - - if (Species != other.RequestedSpecies) return false; - if (other.RequestedGender != Genders.Either && Gender != other.RequestedGender) return false; - if (!CheckLevels(other.RequestedMinLevel, other.RequestedMaxLevel, Level)) return false; - - if (RequestedSpecies != other.Species) return false; - if (RequestedGender != Genders.Either && other.Gender != RequestedGender) return false; - if (!CheckLevels(RequestedMinLevel, RequestedMaxLevel, other.Level)) return false; - - return true; - } - - public void FlagTraded(GtsRecord5 other) - { - Species = other.Species; - Gender = other.Gender; - Level = other.Level; - RequestedSpecies = other.RequestedSpecies; - RequestedGender = other.RequestedGender; - RequestedMinLevel = other.RequestedMinLevel; - RequestedMaxLevel = other.RequestedMaxLevel; - TimeDeposited = other.TimeDeposited; - TimeExchanged = DateTime.UtcNow; - PID = other.PID; - IsExchanged = 0x01; - } - - public override TrainerProfileBase ExtrapolateProfile() - { - TrainerProfile5 result = new TrainerProfile5(); - result.PID = PID; - result.Version = TrainerVersion; - result.Language = TrainerLanguage; - result.Country = TrainerCountry; - result.Region = TrainerRegion; - result.OT = TrainerOT; - result.Name = TrainerNameEncoded.Clone(); - - return result; - } - - public static bool operator ==(GtsRecord5 a, GtsRecord5 b) - { - if ((object)a == null && (object)b == null) return true; - if ((object)a == null || (object)b == null) return false; - // todo: optimize me - return a.Save().SequenceEqual(b.Save()); - } - - public static bool operator !=(GtsRecord5 a, GtsRecord5 b) - { - return !(a == b); - } - - public override bool Equals(object obj) - { - return this.Equals(obj as GtsRecord5); - } - - public bool Equals(GtsRecord5 other) - { - return this == other; - } - - public override int GetHashCode() - { - return ((int)GtsRecord4.DateToBinary(TimeDeposited) + (int)GtsRecord4.DateToBinary(TimeExchanged)) ^ PID; - } - } -} +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Runtime.Serialization; +using System.IO; +using PkmnFoundations.Structures; +using PkmnFoundations.Support; +using System.Collections.ObjectModel; + +namespace PkmnFoundations.Wfc +{ + /// + /// Structure used to represent Pokémon on the GTS in Generation V. + /// Includes a Pokémon box structure and metadata related to the trainer + /// and request. + /// + public class GtsRecord5 : GtsRecordBase, IEquatable + { + public GtsRecord5(Pokedex.Pokedex pokedex) + : base(pokedex) + { + Initialize(); + } + + public GtsRecord5(Pokedex.Pokedex pokedex, BinaryReader data) + : base(pokedex) + { + Initialize(); + Load(data); + } + + public GtsRecord5(Pokedex.Pokedex pokedex, byte[] data) + : base(pokedex) + { + Initialize(); + Load(data); + } + + public GtsRecord5(Pokedex.Pokedex pokedex, byte[] data, int offset) + : base(pokedex) + { + Initialize(); + Load(data, offset); + } + + private void Initialize() + { + + } + + /// + /// Obfuscated Pokémon (pkm) data. 236 bytes + /// + public IList Data + { + get + { + return m_data_readonly; + } + set + { + DataActual = value.ToArray(); + } + } + + private byte[] DataActual + { + get + { + return m_data; + } + set + { + if (value == null) + { + m_data = null; + m_data_readonly = null; + m_pokemon = null; + return; + } + if (value.Length != 0xEC) throw new ArgumentException("PKM length is incorrect"); + m_data = value; + m_data_readonly = new ReadOnlyCollection(m_data); + m_pokemon = null; + } + } + private byte[] m_data; + private ReadOnlyCollection m_data_readonly; + private PokemonParty5 m_pokemon; + + public override PokemonPartyBase Pokemon + { + get + { + if (DataActual == null || m_pokedex == null) + return null; + if (m_pokemon == null) + m_pokemon = new PokemonParty5(m_pokedex, DataActual); + + return m_pokemon; + } + } + + public byte Unknown1; + public byte Unknown2; + + public uint TrainerOT; + + /// + /// 16 bytes + /// + public EncodedString5 TrainerNameEncoded; + + public override string TrainerName + { + get + { + if (TrainerNameEncoded == null) return null; + return TrainerNameEncoded.Text; + } + set + { + if (TrainerNameEncoded == null) TrainerNameEncoded = new EncodedString5(value, 16); + else TrainerNameEncoded.Text = value; + } + } + + public byte TrainerBadges; // speculative. Usually 8. + public byte TrainerUnityTower; + + protected override void Save(BinaryWriter writer) + { + // todo: enclose in properties and validate these when assigning. + if (TrainerNameEncoded.RawData.Length != 0x10) throw new FormatException("Trainer name length is incorrect"); + + writer.Write(DataActual, 0, 0xEC); // 0000 + writer.Write(Species); // 00EC + writer.Write((byte)Gender); // 00EE + writer.Write(Level); // 00EF + writer.Write(RequestedSpecies); // 00F0 + writer.Write((byte)RequestedGender); // 00F2 + writer.Write(RequestedMinLevel); // 00F3 + writer.Write(RequestedMaxLevel); // 00F4 + writer.Write(Unknown1); // 00F5 + writer.Write((byte)TrainerGender); // 00F6 + writer.Write(Unknown2); // 00F7 + writer.Write(DateToTimestamp(TimeDeposited)); // 00F8 + writer.Write(DateToTimestamp(TimeExchanged)); // 0100 + writer.Write(PID); // 0108 + writer.Write(TrainerOT); // 010C + writer.Write(TrainerNameEncoded.RawData, 0, 0x10); // 0110 + writer.Write(TrainerCountry); // 0120 + writer.Write(TrainerRegion); // 0121 + writer.Write(TrainerClass); // 0122 + writer.Write(IsExchanged); // 0123 + writer.Write((byte)TrainerVersion); // 0124 + writer.Write((byte)TrainerLanguage); // 0125 + writer.Write(TrainerBadges); // 0126 + writer.Write(TrainerUnityTower); // 0127 + } + + protected override void Load(BinaryReader reader) + { + DataActual = reader.ReadBytes(0xEC); // 0000 + Species = reader.ReadUInt16(); // 00EC + Gender = (Genders)reader.ReadByte(); // 00EE + Level = reader.ReadByte(); // 00EF + RequestedSpecies = reader.ReadUInt16(); // 00F0 + RequestedGender = (Genders)reader.ReadByte(); // 00F2 + RequestedMinLevel = reader.ReadByte(); // 00F3 + RequestedMaxLevel = reader.ReadByte(); // 00F4 + Unknown1 = reader.ReadByte(); // 00F5 + TrainerGender = (TrainerGenders)reader.ReadByte(); // 00F6 + Unknown2 = reader.ReadByte(); // 00F7 + TimeDeposited = TimestampToDate(reader.ReadUInt64()); // 00F8 + TimeExchanged = TimestampToDate(reader.ReadUInt64()); // 0100 + PID = reader.ReadInt32(); // 0108 + TrainerOT = reader.ReadUInt32(); // 010C + TrainerNameEncoded = new EncodedString5(reader.ReadBytes(0x10)); // 0110 + TrainerCountry = reader.ReadByte(); // 0120 + TrainerRegion = reader.ReadByte(); // 0121 + TrainerClass = reader.ReadByte(); // 0122 + IsExchanged = reader.ReadByte(); // 0123 + TrainerVersion = (Versions)reader.ReadByte(); // 0124 + TrainerLanguage = (Languages)reader.ReadByte(); // 0125 + TrainerBadges = reader.ReadByte(); // 0126 + TrainerUnityTower = reader.ReadByte(); // 0127 + } + + public override int Size + { + get { return 296; } + } + + public GtsRecord5 Clone() + { + // todo: I am not very efficient + return new GtsRecord5(m_pokedex, Save()); + } + + public override bool Validate() + { + if (!base.Validate()) return false; + + return true; + } + + public bool CanTrade(GtsRecord5 other) + { + if (IsExchanged != 0 || other.IsExchanged != 0) return false; + + if (Species != other.RequestedSpecies) return false; + if (other.RequestedGender != Genders.Either && Gender != other.RequestedGender) return false; + if (!CheckLevels(other.RequestedMinLevel, other.RequestedMaxLevel, Level)) return false; + + if (RequestedSpecies != other.Species) return false; + if (RequestedGender != Genders.Either && other.Gender != RequestedGender) return false; + if (!CheckLevels(RequestedMinLevel, RequestedMaxLevel, other.Level)) return false; + + return true; + } + + public void FlagTraded(GtsRecord5 other) + { + Species = other.Species; + Gender = other.Gender; + Level = other.Level; + RequestedSpecies = other.RequestedSpecies; + RequestedGender = other.RequestedGender; + RequestedMinLevel = other.RequestedMinLevel; + RequestedMaxLevel = other.RequestedMaxLevel; + TimeDeposited = other.TimeDeposited; + TimeExchanged = DateTime.UtcNow; + PID = other.PID; + IsExchanged = 0x01; + } + + public override TrainerProfileBase ExtrapolateProfile() + { + TrainerProfile5 result = new TrainerProfile5(); + result.PID = PID; + result.Version = TrainerVersion; + result.Language = TrainerLanguage; + result.Country = TrainerCountry; + result.Region = TrainerRegion; + result.OT = TrainerOT; + result.Name = TrainerNameEncoded.Clone(); + + return result; + } + + public static bool operator ==(GtsRecord5 a, GtsRecord5 b) + { + if ((object)a == null && (object)b == null) return true; + if ((object)a == null || (object)b == null) return false; + // todo: optimize me + return a.Save().SequenceEqual(b.Save()); + } + + public static bool operator !=(GtsRecord5 a, GtsRecord5 b) + { + return !(a == b); + } + + public override bool Equals(object obj) + { + return this.Equals(obj as GtsRecord5); + } + + public bool Equals(GtsRecord5 other) + { + return this == other; + } + + public override int GetHashCode() + { + return ((int)GtsRecord4.DateToBinary(TimeDeposited) + (int)GtsRecord4.DateToBinary(TimeExchanged)) ^ PID; + } + } +} diff --git a/library/Structures/GtsRecordBase.cs b/library/Wfc/GtsRecordBase.cs similarity index 98% rename from library/Structures/GtsRecordBase.cs rename to library/Wfc/GtsRecordBase.cs index c3255b14..55fc3d18 100644 --- a/library/Structures/GtsRecordBase.cs +++ b/library/Wfc/GtsRecordBase.cs @@ -3,8 +3,9 @@ using System; using System.Collections.Generic; using System.Linq; using System.Text; +using PkmnFoundations.Structures; -namespace PkmnFoundations.Structures +namespace PkmnFoundations.Wfc { public abstract class GtsRecordBase : BinarySerializableBase { diff --git a/library/Structures/MusicalRecord5.cs b/library/Wfc/MusicalRecord5.cs similarity index 98% rename from library/Structures/MusicalRecord5.cs rename to library/Wfc/MusicalRecord5.cs index a7810503..96109ae9 100644 --- a/library/Structures/MusicalRecord5.cs +++ b/library/Wfc/MusicalRecord5.cs @@ -3,8 +3,9 @@ using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; +using PkmnFoundations.Support; -namespace PkmnFoundations.Structures +namespace PkmnFoundations.Wfc { public class MusicalRecord5 : BinarySerializableBase { diff --git a/library/Structures/TrainerProfile4.cs b/library/Wfc/TrainerProfile4.cs similarity index 95% rename from library/Structures/TrainerProfile4.cs rename to library/Wfc/TrainerProfile4.cs index 90c2e07b..ec5e306b 100644 --- a/library/Structures/TrainerProfile4.cs +++ b/library/Wfc/TrainerProfile4.cs @@ -3,7 +3,7 @@ using System.Collections.Generic; using System.Linq; using PkmnFoundations.Support; -namespace PkmnFoundations.Structures +namespace PkmnFoundations.Wfc { public class TrainerProfile4 : TrainerProfileBase { diff --git a/library/Structures/TrainerProfile5.cs b/library/Wfc/TrainerProfile5.cs similarity index 95% rename from library/Structures/TrainerProfile5.cs rename to library/Wfc/TrainerProfile5.cs index a2603d0a..1d6726a4 100644 --- a/library/Structures/TrainerProfile5.cs +++ b/library/Wfc/TrainerProfile5.cs @@ -3,7 +3,7 @@ using System.Collections.Generic; using System.Linq; using PkmnFoundations.Support; -namespace PkmnFoundations.Structures +namespace PkmnFoundations.Wfc { public class TrainerProfile5 : TrainerProfileBase { diff --git a/library/Structures/TrainerProfileBase.cs b/library/Wfc/TrainerProfileBase.cs similarity index 97% rename from library/Structures/TrainerProfileBase.cs rename to library/Wfc/TrainerProfileBase.cs index 19af7873..d70f2be7 100644 --- a/library/Structures/TrainerProfileBase.cs +++ b/library/Wfc/TrainerProfileBase.cs @@ -1,10 +1,11 @@ -using System; +using PkmnFoundations.Structures; +using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; -namespace PkmnFoundations.Structures +namespace PkmnFoundations.Wfc { public abstract class TrainerProfileBase { diff --git a/library/Structures/TrainerProfilePlaza.cs b/library/Wfc/TrainerProfilePlaza.cs similarity index 96% rename from library/Structures/TrainerProfilePlaza.cs rename to library/Wfc/TrainerProfilePlaza.cs index e4c5b682..832fb64b 100644 --- a/library/Structures/TrainerProfilePlaza.cs +++ b/library/Wfc/TrainerProfilePlaza.cs @@ -2,9 +2,10 @@ using System.Collections.Generic; using System.Linq; using System.Text; +using PkmnFoundations.Structures; using PkmnFoundations.Support; -namespace PkmnFoundations.Structures +namespace PkmnFoundations.Wfc { public class TrainerProfilePlaza { diff --git a/library/Structures/TrainerRankings.cs b/library/Wfc/TrainerRankings.cs similarity index 99% rename from library/Structures/TrainerRankings.cs rename to library/Wfc/TrainerRankings.cs index 8733b7bf..9dcbc853 100644 --- a/library/Structures/TrainerRankings.cs +++ b/library/Wfc/TrainerRankings.cs @@ -1,11 +1,12 @@ -using PkmnFoundations.Support; +using PkmnFoundations.Structures; +using PkmnFoundations.Support; using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; -namespace PkmnFoundations.Structures +namespace PkmnFoundations.Wfc { public class TrainerRankingsReport { diff --git a/towerRestorer4/Program.cs b/towerRestorer4/Program.cs index f49cb29d..2f9639be 100644 --- a/towerRestorer4/Program.cs +++ b/towerRestorer4/Program.cs @@ -7,6 +7,7 @@ using PkmnFoundations.Data; using PkmnFoundations.Pokedex; using PkmnFoundations.Structures; using PkmnFoundations.Support; +using PkmnFoundations.Wfc; namespace towerRestorer { diff --git a/web/RoomLeaders.aspx.cs b/web/RoomLeaders.aspx.cs index 8e6362e1..c1bfbe1f 100644 --- a/web/RoomLeaders.aspx.cs +++ b/web/RoomLeaders.aspx.cs @@ -9,6 +9,7 @@ using PkmnFoundations.Data; using PkmnFoundations.Structures; using PkmnFoundations.Support; using PkmnFoundations.Web; +using PkmnFoundations.Wfc; namespace PkmnFoundations.GTS { diff --git a/web/admin/AddBoxes.aspx.cs b/web/admin/AddBoxes.aspx.cs index db814ad0..a8d5263a 100644 --- a/web/admin/AddBoxes.aspx.cs +++ b/web/admin/AddBoxes.aspx.cs @@ -7,6 +7,7 @@ using System.Web.UI.WebControls; using PkmnFoundations.Structures; using PkmnFoundations.Data; using PkmnFoundations.Web; +using PkmnFoundations.Wfc; namespace PkmnFoundations.GTS.admin { diff --git a/web/admin/AddDressup.aspx.cs b/web/admin/AddDressup.aspx.cs index fe80fd8c..14a79e1d 100644 --- a/web/admin/AddDressup.aspx.cs +++ b/web/admin/AddDressup.aspx.cs @@ -8,6 +8,7 @@ using System.IO; using PkmnFoundations.Structures; using PkmnFoundations.Data; using PkmnFoundations.Web; +using PkmnFoundations.Wfc; namespace PkmnFoundations.GTS.test { diff --git a/web/admin/AddMusical.aspx.cs b/web/admin/AddMusical.aspx.cs index 3d291f23..55bf0ae7 100644 --- a/web/admin/AddMusical.aspx.cs +++ b/web/admin/AddMusical.aspx.cs @@ -6,6 +6,7 @@ using System.Web.UI; using System.Web.UI.WebControls; using PkmnFoundations.Data; using PkmnFoundations.Structures; +using PkmnFoundations.Wfc; namespace PkmnFoundations.GTS.admin { diff --git a/web/gts/Default.aspx.cs b/web/gts/Default.aspx.cs index 4de80ab4..184d32bc 100644 --- a/web/gts/Default.aspx.cs +++ b/web/gts/Default.aspx.cs @@ -9,6 +9,7 @@ using PkmnFoundations.Data; using PkmnFoundations.Pokedex; using PkmnFoundations.Structures; using PkmnFoundations.Web; +using PkmnFoundations.Wfc; namespace PkmnFoundations.GTS { diff --git a/web/gts/Pokemon.aspx.cs b/web/gts/Pokemon.aspx.cs index 60c1c228..2188df4e 100644 --- a/web/gts/Pokemon.aspx.cs +++ b/web/gts/Pokemon.aspx.cs @@ -9,6 +9,7 @@ using PkmnFoundations.Data; using PkmnFoundations.Pokedex; using PkmnFoundations.Structures; using PkmnFoundations.Support; +using PkmnFoundations.Wfc; namespace PkmnFoundations.Web.gts { diff --git a/web/test/VideoId.aspx.cs b/web/test/VideoId.aspx.cs index 7e978035..6fe686b4 100644 --- a/web/test/VideoId.aspx.cs +++ b/web/test/VideoId.aspx.cs @@ -5,6 +5,7 @@ using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using PkmnFoundations.Structures; +using PkmnFoundations.Wfc; namespace PkmnFoundations.GTS.test {