Exemple #1
0
        public async Task <Equipment> GetEquipment(Equipment.EquipmentStatic equipmentStatic)
        {
            var version = GlobalSettings.FileVersions.Equipment;

            if (string.IsNullOrWhiteSpace(version))
            {
                version = GlobalSettings.DefaultVersion;
            }

            var data = await WebClient.GetString(new Uri(GHStatic + version + EquipmentPath));

            if (data == null)
            {
                return(null);
            }

            var      dataCSV      = CsvReader.ReadFromText(data);
            ICsvLine equipmentRow = dataCSV.SingleOrDefault(r => r[0] == equipmentStatic.Id);

            if (equipmentRow == null)
            {
                return(null);
            }

            var image = await GetImage(equipmentStatic.ImageUrl);

            return(BuildEquipment(equipmentRow, equipmentStatic, image, version));
        }
Exemple #2
0
        private Equipment BuildEquipment(ICsvLine serverData, Equipment.EquipmentStatic staticData, Bitmap image, string version)
        {
            Enum.TryParse(serverData[1], out EquipmentClass eClass);
            Enum.TryParse(serverData[2], out BonusType bonusType);
            Enum.TryParse(serverData[3], out EquipmentRarity rarity);
            double.TryParse(serverData[4], out double bonusBase);
            double.TryParse(serverData[5], out double bonusIncrease);
            Enum.TryParse(serverData[6], out EquipmentSource source);

            return(staticData.Build(eClass, bonusType, rarity, bonusBase, bonusIncrease, source, image ?? new Bitmap(1, 1), version));
        }