public static void 프린트(PrintLotto 데이터) { Console.WriteLine("최다노출"); 데이터.PrintMax(); Console.WriteLine("최다노출"); 데이터.PrintMin(); }
public static void 당첨자_추가(Dictionary <string, string> 맵, PrintLotto 데이터) { var 당첨수 = int.Parse(맵["firstPrzwnerCo"]); 당첨수 = 당첨수 == 0 ? 1 : 당첨수; Observable.Range(1, 6) .Subscribe(_ => 데이터.NumbersCnt[int.Parse(맵["drwtNo" + _])] += 당첨수); 데이터.NumbersCnt[int.Parse(맵["bnusNo"])] += 당첨수; }
public static void Main() { var network = new GetLottoData(); var 데이터 = new PrintLotto(); //api 옵저버블 생성 var pub = new Subject <Dictionary <string, string> >(); pub.Subscribe(맵 => 당첨자_추가(맵, 데이터), () => 프린트(데이터)); Observable.Range(1, 1000) .SubscribeOn(ThreadPoolScheduler.Instance) .ObserveOn(ThreadPoolScheduler.Instance) .TakeWhile(_ => network.ResponseLottoJson(_, pub.OnNext)) .Subscribe(); Console.ReadLine(); }