コード例 #1
0
ファイル: Program.cs プロジェクト: Rhialto74/swgoh-dotnet-api
 private static void LogIn()
 {
     helper = new SwgohHelper(new UserSettings()
     {
         Username = testUsername, Password = testPassword, Debug = "true"
     });
     helper.Login();
 }
コード例 #2
0
 public void SetupTheLogin()
 {
     helper = new SwgohHelper(new UserSettings()
     {
         Username = testUsername, Password = testPassword, Debug = "true"
     });
     helper.Login();
 }
コード例 #3
0
        public void FetchAllPlayerDataFromCrinolo()
        {
            var data = SwgohHelper.fetchAllUnitsForPlayerFromCrinolo("999531726");

            TestContext.Write(data);
            //var units = JsonConvert.DeserializeObject<UnitDict>(data);
            //Assert.AreEqual(units["MAGMATROOPER"].unit.Player,"Rhialto The Marvelous");
        }
コード例 #4
0
ファイル: GGTests.cs プロジェクト: Rhialto74/swgoh-dotnet-api
        public void DownloadAbilityIconsFromSwgohGG()
        {
            var    abilities = JsonConvert.DeserializeObject <List <Ability> >(SwgohHelper.fetchAllAbilitiesFromSwgohGGApi());
            string uri;

            foreach (var item in abilities)
            {
                uri = "https://swgoh.gg" + item.Image;
                var imageName = item.BaseId + ".png";
                using (WebClient client = new WebClient())
                {
                    client.DownloadFile(new Uri(uri), @"c:\temp-images\" + imageName);
                }
            }
        }
コード例 #5
0
ファイル: GGTests.cs プロジェクト: Rhialto74/swgoh-dotnet-api
        public void DownloadIconsFromSwgohGG()
        {
            var    gear = JsonConvert.DeserializeObject <List <Gear> >(SwgohHelper.fetchAllGearFromSwgohGGApi());
            string uri;

            foreach (var item in gear)
            {
                uri = "https://swgoh.gg" + item.Image;
                var imageName = item.BaseId;
                using (WebClient client = new WebClient())
                {
                    client.DownloadFile(new Uri(uri), @"f:\temp-images\" + imageName + ".png");
                }
            }
        }
コード例 #6
0
        private SwgohHelper Authenticate()
        {
            SwgohHelper helper;

            if (!_cache.TryGetValue(HelperEntry, out helper))
            {
                helper = new SwgohHelper(new UserSettings()
                {
                    Username = _testUsername, Password = _testPassword, Debug = "true"
                });
                helper.Login();
                SetCacheValue(HelperEntry, sourceHelp, helper);
            }

            return(helper);
        }
コード例 #7
0
        private List <List <UnitWithStat> > GetPlayerOneAndTwo(List <string> codesToRequest)
        {
            List <UnitWithStat> PlayerOne;
            List <UnitWithStat> PlayerTwo;

            string PlayerOneCode = codesToRequest[0];
            string PlayerTwoCode = codesToRequest[1];

            //Check if PlayerOne is in the cache
            if (GetCacheValue(PlayerOneCode, sourceCrinolo, out PlayerOne))
            {
                codesToRequest.Remove(PlayerOneCode);
            }

            //Check if PlayerTwo is in the cache
            if (GetCacheValue(PlayerTwoCode, sourceCrinolo, out PlayerTwo))
            {
                codesToRequest.Remove(PlayerTwoCode);
            }

            if (codesToRequest.Count > 0)
            {
                foreach (var code in codesToRequest)
                {
                    if (PlayerOne == null)
                    {
                        PlayerOne = SwgohHelper.fetchListOfUnitsForPlayerFromCrinolo(code.ToString());
                        SetCacheValue(code, sourceCrinolo, PlayerOne);
                    }
                    else if (PlayerTwo == null)
                    {
                        PlayerTwo = SwgohHelper.fetchListOfUnitsForPlayerFromCrinolo(code.ToString());
                        SetCacheValue(code, sourceCrinolo, PlayerTwo);
                    }
                }
            }
            return(new List <List <UnitWithStat> >()
            {
                PlayerOne, PlayerTwo
            });
        }
コード例 #8
0
        private async void AuthenticateAsync()
        {
            SwgohHelper helper;

            if (_cache.TryGetValue(HelperEntry, out helper))
            {
                return;
            }
            else
            {
                await Task.Run(() =>
                {
                    helper = new SwgohHelper(new UserSettings()
                    {
                        Username = _testUsername, Password = _testPassword, Debug = "true"
                    });
                    helper.Login();
                    SetCacheValue(HelperEntry, sourceHelp, helper);
                }
                               );
            }
        }
コード例 #9
0
        public void FetchListOfAllPlayerDataFromCrinolo()
        {
            var units = SwgohHelper.fetchListOfUnitsForPlayerFromCrinolo("999531726");

            Assert.AreEqual(units[0].NameKey, "Magmatrooper");
        }
コード例 #10
0
ファイル: GGTests.cs プロジェクト: Rhialto74/swgoh-dotnet-api
        public void fetchAllAbilitiesFromGgAndDeSerializeThem()
        {
            var abilities = JsonConvert.DeserializeObject <List <Ability> >(SwgohHelper.fetchAllAbilitiesFromSwgohGGApi());

            Assert.AreEqual(abilities[0].CharacterBaseId, "GRIEVOUS");
        }
コード例 #11
0
ファイル: GGTests.cs プロジェクト: Rhialto74/swgoh-dotnet-api
        public void fetchSpecificGearFromGgAndDeSerializeIt()
        {
            var gear = JsonConvert.DeserializeObject <Gear>(SwgohHelper.fetchSpecificGearFromSwgohGGApi("126"));

            Assert.AreEqual(gear.Cost, 4350);
        }
コード例 #12
0
 public List <Ability> GetAllAbilities()
 {
     return(JsonConvert.DeserializeObject <List <Ability> >(SwgohHelper.fetchAllAbilitiesFromSwgohGGApi()));
 }
コード例 #13
0
 public List <Gear> GetAllGear()
 {
     return(JsonConvert.DeserializeObject <List <Gear> >(SwgohHelper.fetchAllGearFromSwgohGGApi()));
 }
コード例 #14
0
 public Gear GetSpecificGear(string code)
 {
     return(JsonConvert.DeserializeObject <Gear>(SwgohHelper.fetchSpecificGearFromSwgohGGApi(code)));
 }