context: #region " Imports "
  
  using System;
  using System.IO;
  using System.Linq;
  using System.Collections.Generic;
  using System.Globalization;
  using System.Text.RegularExpressions;
  using System.Xml.Serialization;
  using System.Threading.Tasks;
  
  using PokeRoadie.Api;
  using PokeRoadie.Api.Enums;
  using PokeRoadie.Api.Logging;
  
  using POGOProtos.Inventory.Item;
  using POGOProtos.Enums;
  using POGOProtos.Data;
  
  using PokeRoadie.Forms;
  
  #endregion
  
  namespace PokeRoadie
  {
      public class PokeRoadieSettings : PokeRoadie.Api.ISettings
      {
  
          #region " Members "
  
          private static object syncRoot = new object();
          private static object sessionRoot = new object();
          private static string configs_path = Path.Combine(Directory.GetCurrentDirectory(), "Configs");
          private static string temp_path = Path.Combine(Directory.GetCurrentDirectory(), "Temp");
          private ICollection<PokemonId> _pokemonsNotToTransfer;
          private ICollection<PokemonId> _pokemonsToEvolve;
          private ICollection<PokemonId> _pokemonsNotToCatch;
          private ICollection<PokemonId> _pokemonsToPowerUp;
          private IList<LocationData> _destinations;
          private IList<PokemonData> _pokemonpicker;
          private ICollection<KeyValuePair<ItemId, int>> _itemRecycleFilter;
          private ICollection<MoveData> _pokemonMoveDetails;
          private static string destinationcoords_file = Path.Combine(configs_path, "DestinationCoords.ini");
          private static string pokemonpicker_file = Path.Combine(configs_path, "PokemonPicker.ini");
          [XmlIgnore()]
          public DateTime? DestinationEndDate { get; set; }
  
          #endregion
          #region " General Properties "
  
          //auth related
          public virtual AuthType AuthType { get; set; }
          public virtual string Username { get; set; }
          public virtual string Password { get; set; }
          public virtual string GoogleRefreshToken { get; set; }
  
          //destinations/travel
          public virtual bool DestinationsEnabled { get; set; }
          public virtual int MinutesPerDestination { get; set; }
          public virtual int DestinationIndex { get; set; }
  
          //location related
          public virtual double CurrentLatitude { get; set; }
          public virtual double CurrentLongitude { get; set; }
          public virtual double CurrentAltitude { get; set; }
  
          //waypoints - being moved to State object
          public virtual double WaypointLatitude { get; set; }
          public virtual double WaypointLongitude { get; set; }
          public virtual double WaypointAltitude { get; set; }
  
          //movement related
          public virtual double MinSpeed { get; set; }
          public virtual int MaxSpeed { get; set; }
          public virtual int MaxDistance { get; set; }
          public virtual int MaxDistanceForLongTravel { get; set; }
          public virtual bool EnableSpeedAdjustment { get; set; }
          public virtual bool EnableSpeedRandomizer { get; set; }
          public virtual int MaxSecondsBetweenStops { get; set; }
          public virtual int MaxLocationAttempts { get; set; }
          public virtual int LongDistanceSpeed { get; set; }
          public virtual int SpeedCurveDistance { get; set; }
          public virtual bool UseGPXPathing { get; set; }
          public virtual string GPXFile { get; set; }
          public virtual bool EnableWandering { get; set; }
  
          //evolution
          public virtual bool EvolvePokemon { get; set; }
          public PriorityTypes EvolvePriorityType { get; set; }
          public PriorityTypes EvolvePriorityType2 { get; set; }
          public virtual int EvolveAboveCp { get; set; }
          public virtual double EvolveAboveIV { get; set; }
          public virtual double EvolveAboveV { get; set; }
          public virtual double EvolveAboveLV { get; set; }
          public virtual bool UsePokemonsToEvolveList { get; set; }
  
          //transfers
          public virtual bool TransferPokemon { get; set; }
          public virtual PriorityTypes TransferPriorityType { get; set; }
          public virtual PriorityTypes TransferPriorityType2 { get; set; }
          public virtual int KeepDuplicateAmount { get; set; }
          public virtual int KeepAboveCP { get; set; }
          public virtual double KeepAboveIV { get; set; }
          public virtual double KeepAboveV { get; set; }
          public virtual double KeepAboveLV { get; set; }
          public virtual int AlwaysTransferBelowCp { get; set; }
          public virtual double AlwaysTransferBelowIV { get; set; }
          public virtual double AlwaysTransferBelowLV { get; set; }
          public virtual double AlwaysTransferBelowV { get; set; }
          public virtual int TransferTrimFatCount { get; set; }
          public virtual bool NotTransferPokemonsThatCanEvolve { get; set; }
  
          //power-ups
          public virtual bool PowerUpPokemon { get; set; }
          public virtual PriorityTypes PowerUpPriorityType { get; set; }
          public virtual PriorityTypes PowerUpPriorityType2 { get; set; }
          public virtual int PowerUpAboveCp { get; set; }
          public virtual double PowerUpAboveIV { get; set; }
          public virtual double PowerUpAboveV { get; set; }
          public virtual double PowerUpAboveLV { get; set; }
          public virtual int MinStarDustForPowerUps { get; set; }
          public virtual bool UsePokemonsToPowerUpList { get; set; }
          public virtual int MinCandyForPowerUps { get; set; }
          public virtual int MaxPowerUpsPerRound { get; set; }
  
          //favorites
          public virtual bool FavoritePokemon { get; set; }
          public virtual int FavoriteAboveCp { get; set; }
          public virtual double FavoriteAboveIV { get; set; }
          public virtual double FavoriteAboveV { get; set; }
          public virtual double FavoriteAboveLV { get; set; }
  
          //pokestops
          public virtual bool VisitPokestops { get; set; }
          public virtual bool IncludeHotPokestops { get; set; }
          public virtual bool MoveWhenNoStops { get; set; }
          public virtual bool PrioritizeStopsWithLures { get; set; }
          public virtual bool LoiteringActive { get; set; }
  
          //catching - general
          public virtual bool CatchPokemon { get; set; }
          public virtual double MaxCatchSpeed { get; set; }
          public virtual bool UsePokemonToNotCatchList { get; set; }
          public virtual bool PokeBallBalancing { get; set; }
          public virtual int PokeballRefillDelayMinutes { get; set; }
  
          //humanized throws
          public virtual bool EnableHumanizedThrows { get; set; }
          public virtual int ForceExcellentThrowOverCp { get; set; }
          public virtual double ForceExcellentThrowOverIV { get; set; }
          public virtual double ForceExcellentThrowOverV { get; set; }
          public virtual int ForceGreatThrowOverCp { get; set; }
          public virtual double ForceGreatThrowOverIV { get; set; }
          public virtual double ForceGreatThrowOverV { get; set; }
          public virtual int ExcellentThrowChance { get; set; }
          public virtual int GreatThrowChance { get; set; }
          public virtual int NiceThrowChance { get; set; }
          public virtual double CurveThrowChance { get; set; }
  
          //inventory
          public virtual bool UseLuckyEggs { get; set; }
          public virtual bool UseIncense { get; set; }
          public virtual bool UseRevives { get; set; }
          public virtual bool UsePotions { get; set; }
          public virtual bool UseEggIncubators { get; set; }
  
          //gyms
          public virtual bool VisitGyms { get; set; }
          public virtual bool PrioritizeGyms { get; set; }
          public virtual bool AutoDeployAtTeamGyms { get; set; }
          public virtual bool PickupDailyDefenderBonuses { get; set; }
          public virtual int MinGymsBeforeBonusPickup { get; set; }
  
          //rename
          public virtual bool RenamePokemon { get; set; }
          public virtual string RenameFormat { get; set; }
  
          //emulation & safety
          public virtual string DevicePackageName { get; set; }
          public virtual string DeviceId { get; set; }
  
          //session
          public virtual string MaxRunTimespan { get; set; }
          public virtual string MinBreakTimespan { get; set; }
          public virtual int MaxPokemonCatches { get; set; }
          public virtual int MaxPokestopVisits { get; set; }
  
          //configurable delays
          public virtual int MinDelay { get; set; }
          public virtual int MaxDelay { get; set; }
          public virtual int EvolutionMinDelay { get; set; }
          public virtual int EvolutionMaxDelay { get; set; }
          public virtual int EggHatchMinDelay { get; set; }
          public virtual int EggHatchMaxDelay { get; set; }
          public virtual int TransferMinDelay { get; set; }
          public virtual int TransferMaxDelay { get; set; }
          public virtual int CatchMinDelay { get; set; }
          public virtual int CatchMaxDelay { get; set; }
          public virtual int RecycleMinDelay { get; set; }
          public virtual int RecycleMaxDelay { get; set; }
          public virtual int PowerUpMinDelay { get; set; }
          public virtual int PowerUpMaxDelay { get; set; }
          public virtual int PokedexEntryMinDelay { get; set; }
          public virtual int PokedexEntryMaxDelay { get; set; }
          public virtual int LocationsMinDelay { get; set; }
          public virtual int LocationsMaxDelay { get; set; }
          public virtual int PokemonProcessDelayMinutes { get; set; }
  
          //tutorials
          public virtual bool CompleteTutorials { get; set; }
          public virtual PokemonId TutorialPokmonId { get; set; }
          public virtual TeamColor TeamColor { get; set; }
          public virtual string TutorialCodename { get; set; }
          public virtual bool TutorialGenerateCodename { get; set; }
  
          //logging
          public virtual int DisplayRefreshMinutes { get; set; }
          public virtual bool DisplayAggregateLog { get; set; }
          public virtual bool DisplayAllPokemonInLog { get; set; }
          public virtual int DisplayPokemonCount { get; set; }
          public virtual int DisplayTopCandyCount { get; set; }
  
          //system
          public virtual bool ShowDebugMessages { get; set; }
  
          //proxy
          public virtual bool UseProxy { get; set; }
          public virtual string UseProxyHost { get; set; }
          public virtual int UseProxyPort { get; set; }
          public virtual bool UseProxyAuthentication { get; set; }
          public virtual string UseProxyUsername { get; set; }
          public virtual string UseProxyPassword { get; set; }
  
          #endregion
          #region " Collection Properties "
  
          [XmlIgnore()]
          public ICollection<KeyValuePair<ItemId, int>> ItemRecycleFilter
          {
              get
              {
                  //Type of pokemons to evolve
                  _itemRecycleFilter = _itemRecycleFilter ?? LoadItemList("Configs\\ConfigItemList.ini", new List<KeyValuePair<ItemId, int>>
                  {
                      new KeyValuePair<ItemId, int>(ItemId.ItemUnknown, 0),
                      new KeyValuePair<ItemId, int>(ItemId.ItemPokeBall, 50),
                      new KeyValuePair<ItemId, int>(ItemId.ItemGreatBall, 75),
                      new KeyValuePair<ItemId, int>(ItemId.ItemUltraBall, 75),
                      new KeyValuePair<ItemId, int>(ItemId.ItemMasterBall, 100),
  
  
gt:                     new KeyValuePair<ItemId, int>(ItemId.ItemPotion, 30),