public MethodResult <AccountExportModel> GetAccountExport() { if (Stats == null) { LogCaller(new LoggerEventArgs(String.Format("No stats found for {0}. Please update details", UserSettings.Username), LoggerTypes.Warning)); return(new MethodResult <AccountExportModel>()); } IEnumerable <InventoryItem> AllItems = new List <InventoryItem>(); if (_client.LoggedIn) { AllItems = _client.ClientSession.Player.Inventory.InventoryItems; } if (!AllItems.Any()) { LogCaller(new LoggerEventArgs(String.Format("No items found for {0}. Please update details", UserSettings.Username), LoggerTypes.Warning)); return(new MethodResult <AccountExportModel>()); } if (!Pokedex.Any()) { LogCaller(new LoggerEventArgs(String.Format("No pokedex found for {0}. Please update details", UserSettings.Username), LoggerTypes.Warning)); return(new MethodResult <AccountExportModel>()); } var exportModel = new AccountExportModel { Level = Stats.Level, Type = UserSettings.AuthType, Username = UserSettings.Username, Password = UserSettings.Password, Pokedex = Pokedex.Select(x => new PokedexEntryExportModel(x)).ToList(), Pokemon = Pokemon.Select(x => new PokemonDataExportModel(x, CalculateIVPerfection(x))).ToList(), Items = Items.Select(x => new ItemDataExportModel(x)).ToList(), Eggs = Eggs.Select(x => new EggDataExportModel(x)).ToList() }; return(new MethodResult <AccountExportModel> { Data = exportModel, Success = true }); }
public MethodResult <AccountExportModel> GetAccountExport() { if (Stats == null) { LogCaller(new LoggerEventArgs(String.Format("No stats found for {0}. Please update details", UserSettings.Username), LoggerTypes.Warning)); } if (!Items.Any()) { LogCaller(new LoggerEventArgs(String.Format("No items found for {0}. Please update details", UserSettings.Username), LoggerTypes.Warning)); } if (!Pokedex.Any()) { LogCaller(new LoggerEventArgs(String.Format("No pokedex found for {0}. Please update details", UserSettings.Username), LoggerTypes.Warning)); } var exportModel = new AccountExportModel() { Level = Stats.Level, Type = UserSettings.AuthType, Username = UserSettings.Username, Password = UserSettings.Password, Pokedex = Pokedex.Select(x => new PokedexEntryExportModel(x)).ToList(), Pokemon = Pokemon.Select(x => new PokemonDataExportModel(x, CalculateIVPerfection(x))).ToList(), Items = Items.Select(x => new ItemDataExportModel(x)).ToList(), Eggs = Eggs.Select(x => new EggDataExportModel(x)).ToList(), ExportTime = DateTime.Now }; return(new MethodResult <AccountExportModel> { Data = exportModel, Success = true }); }