示例#1
0
        private Comms EnrichComms(GsmArenaModel gsmModel)
        {
            double.TryParse(gsmModel.Comms.Usb[0].SplitAndTrim(",")[0], out var usbResult);
            double.TryParse(Regex.Match(gsmModel.Comms.Bluetooth[0].SplitAndTrim(",")[0], @"\d+(\.?)\d*").Value, out var blueResult);

            return new Comms
            {
                Bluetooth = double.Parse(blueResult.ToString(CultureInfo.InvariantCulture)),
                Gps = gsmModel.Comms.Gps is null
                    ? new List<string>()
                    : gsmModel.Comms.Gps[0].SplitAndTrim(",").Skip(1).ToList().Select(x => x.SplitAndTrim(" ")[^1]).ToList(),
示例#2
0
        private TechSpec EnrichTechnologyBands(GsmArenaModel gsmModel)
        {
            var technology = new TechSpec()
            {
                Techs = new List<string>(),
                TotalTechs = 0
            };


            if (gsmModel.Network.Technology != null)
            {
                foreach (var value in gsmModel.Network.Technology[0].Split("/").ToListTrim())
                {
                    technology.Techs.Add(value);
                    technology.TotalTechs += 1;
                }
            }

            return technology;
        }
示例#3
0
 public Mobile(GsmArenaModel gsmModel, string phoneUrl)
 {
     Id = gsmModel.Name.Main[0].BuildGuid();
     DataLinks = new DataLink()
     {
         Image = gsmModel.Photo,
         Link = new Uri(phoneUrl)
     };
     Status = new Status
     {
         Announced = gsmModel.Launch.Announced[0].ToLower(),
         Year = int.Parse(gsmModel.Launch.Announced[0].SplitAndTrim(",").First()),
         Launch = gsmModel.Launch.Status[0].ToLower()
     };
     Name = new Name
     {
         Brand = gsmModel.Name.Main[0].SplitAndTrim(" ")[0].ToLower(),
         Main = gsmModel.Name.Main[0].SplitAndTrim("(")[0].ToLower()
     };
     Network = new Network
     {
         Band = EnrichNetworkBands(gsmModel.Network),
         Speed = gsmModel.Network.Speed is null ? new List<string>() : gsmModel.Network.Speed[0].Split(",").ToListTrim(),
         Technology = EnrichTechnologyBands(gsmModel)
     };
     Body = EnrichBody(gsmModel);
     Platform = EnrichPlatform(gsmModel);
     Memory = EnrichMemory(gsmModel.Memory);
     Display = EnrichDisplay(gsmModel.Display);
     Camera = EnrichCamera(gsmModel);
     Sound = EnrichSound(gsmModel);
     Comms = EnrichComms(gsmModel);
     Battery = EnrichBattery(gsmModel.Battery);
     Price = EnrichPrice(gsmModel);
     Colors = gsmModel.Misc.Colors[0].SplitAndTrim(",").ToListTrim();
     Features = EnrichFeatures(gsmModel);
 }
示例#4
0
        private Sound EnrichSound(GsmArenaModel gsmModel)
        {
            bool hasJack = false;
            bool hasSpeaker = false;
            bool isStereo = false;

            if (gsmModel.Sound.The35MmJack != null)
            {
                hasJack = gsmModel.Sound.The35MmJack[0].ToLower().Contains("yes");
            }

            if (gsmModel.Sound.Loudspeaker != null)
            {
                hasSpeaker = gsmModel.Sound.Loudspeaker[0].ToLower().Contains("yes");
                isStereo = gsmModel.Sound.Loudspeaker[0].ToLower().Contains("stereo");
            }

            return new Sound
            {
                Jack = hasJack,
                Loudspeaker = hasSpeaker,
                Stereo = isStereo
            };
        }