public void CountryParseSimple() { CountryParser countries = new CountryParser(@"C:\Users\mike\Documents\GitHub\NM20\NM2O_Spot_Analyzer\NM2O_Spot_Analyzer\bin\Debug\N1MM_CountryList.dat"); ICountryZone a = countries.CheckCall("BY8A1"); Assert.AreEqual(false, true); }
public void CountryParse_CasesFromJapan_Pass(string call) { CountryParser countries = new CountryParser(@"C:\Users\mike\Documents\GitHub\NM20\NM2O_Spot_Analyzer\NM2O_Spot_Analyzer\bin\Debug\N1MM_CountryList.dat"); ICountryZone a = countries.CheckCall(call); Assert.AreEqual("Japan", a.Country); }
static void RunCountryZoneAnalysis() { List <string> callAnalysis = File.ReadAllLines(@"C:\Users\mike\Documents\GitHub\NM20\NM2O_Spot_Analyzer\NM2O_Spot_Analyzer\Call_Analysis.csv").ToList(); CountryParser parser = new CountryParser(@"C:\Users\mike\Documents\GitHub\NM20\NM2O_Spot_Analyzer\NM2O_Spot_Analyzer\bin\Debug\N1MM_CountryList.dat"); List <CountryZoneAnalysis> analyses = new List <CountryZoneAnalysis>(); foreach (var call in callAnalysis) { string[] callinfo = call.Split(','); try { var parsed = parser.CheckCall(callinfo[0]); if (!analyses.Exists(x => x.Label == parsed.Country)) { analyses.Add(new CountryZoneAnalysis(parsed.Country, call, CountryZoneAnalysis.Type.Country)); } else { //var a = analyses.Where(x => x.Label == parsed.Country); analyses.Where(x => x.Label == parsed.Country).First().Add(call); } if (!analyses.Exists(x => x.Label == parsed.CQZone.ToString())) { analyses.Add(new CountryZoneAnalysis(parsed.CQZone.ToString(), call, CountryZoneAnalysis.Type.Zone)); } else { analyses.Where(x => x.Label == parsed.CQZone.ToString()).First().Add(call); } //Console.WriteLine($"{callinfo[0]} from {parsed.Country} zone {parsed.CQZone}"); } catch (Exception) { Console.WriteLine($"Unable to parse {callinfo[0]}"); } } var o = analyses.GroupBy(x => x.CZType) .Select(t => new { CZType = t.Key, TotalHours = t.Sum(x => x.TotalHours), OnePointEightMHz = t.Sum(x => x.OnePointEightMHz), ThreePointFiveMHz = t.Sum(x => x.ThreePointFiveMHz), SevenMHz = t.Sum(x => x.SevenMHz), FourteenMHz = t.Sum(x => x.FourteenMHz), TwentyOneMHz = t.Sum(x => x.TwentyOneMHz), TwentyEightMHz = t.Sum(x => x.TwentyEightMHz), None = t.Sum(x => x.None), }) .First(); //We only need one, because they will always be equal. List <string> filecontents = new List <string>() { "CZType,Label,TotalHours,OnePointEightMHz,ThreePointFiveMHz,SevenMHz,FourteenMHz,TwentyOneMHz,TwentyEightMHz,None" }; filecontents.Add($"Totals,Totals,{o.TotalHours},{o.OnePointEightMHz},{o.ThreePointFiveMHz},{o.SevenMHz},{o.FourteenMHz},{o.TwentyOneMHz},{o.TwentyEightMHz},{o.None}"); foreach (var item in analyses.OrderBy(x => x.ToString())) { filecontents.Add(item.ToString()); } File.WriteAllLines(@"C:\Users\mike\Documents\GitHub\NM20\NM2O_Spot_Analyzer\NM2O_Spot_Analyzer\CountryZone_Analysis.csv", filecontents.ToArray()); }