public async Task skal_hente_ned_vikinglotto_resultater() { LottoData resultatdata = (LottoData)await WebDataSource.GetGroupAsync("vikinglotto", false); Assert.IsNotNull(resultatdata); string[] vinnertallArray = resultatdata.Vinnertall.Split(','); Assert.AreEqual(6, vinnertallArray.Length); }
/// <summary> /// I screwed up when planning the bonus numbers for the 649 lottery. /// Decided having the number as the last part of each number array was a bad idea /// and would throw off calculations. This script is designed to go back through the json /// and grab the bonus numbers, then output them to their own json object. /// Probably inefficient and terrible but I was annoyed and this worked. /// </summary> /// <param name="args"></param> public static void BonusAdjustment() { string json; using (var sr = new StreamReader(@"E:\Misc\Lotto649Bonus.json")) { json = sr.ReadToEnd(); } LottoData lottoData = JsonConvert.DeserializeObject <LottoData>(json); var bonus = new List <int>(); for (var i = 0; i < lottoData.Lotto649.Count; i++) { var bonusNum = lottoData.Lotto649[i].Numbers[6]; bonus.Add(bonusNum); } var regexPattern = @"]"; var reg = new Regex(regexPattern); var lottoFile = File.ReadAllLines(@"E:\Misc\Lotto649Bonus.json"); var sb = new StringBuilder(); var y = 0; for (var x = 0; x < lottoFile.Length; x++) { if (Regex.IsMatch(lottoFile[x], regexPattern)) { y = (x / 12) - 1; // Using notepad++ I determined that there would be a consistent 12 index gap between matches starting at line 13. // The equation for this is y = 12x+1. Solve for x is (y-1)/12. Subbed normal index variables (i, y, etc) for math logic. // Because programming index starts at 0, the adjusted equation is (x/12)-1. var str = $"],\n \"Bonus\" : {bonus[y] }"; sb.Append(reg.Replace(lottoFile[x], str)); } else { sb.Append(lottoFile[x]); } } using (var sw = new StreamWriter(@"E:\Misc\Test.json")) { sw.WriteLine(sb.ToString()); } }
private async System.Threading.Tasks.Task SelectedAndTellLotto(int selectedIndex, string gruppenavn) { pivot.SelectedIndex = selectedIndex; { using (var speech = new SpeechSynthesizer()) { LottoData sampleDataGroup = (LottoData)await WebDataSource.GetGroupAsync(gruppenavn, true); var voiceStream = await speech.SynthesizeTextToStreamAsync("Winning numbers are " + sampleDataGroup.Vinnertall + ". Additional numbers are " + sampleDataGroup.Tilleggstall); player.SetSource(voiceStream, voiceStream.ContentType); player.Play(); } } }
private void normal_Checked(object sender, RoutedEventArgs e) { if (Lotto == null) return; Lotto.ClearAll(); Lotto = new LottoData(); countAuto.Text = "100"; Lotto.PlayJustDay = false; Lotto.Initialize(1); Lotto.Main = this; DataContext = Lotto; Lotto.DateSelect = new Date(DateTime.Today); calendar.SelectedDate = Lotto.LastDay; comboBox.SelectedIndex = Lotto.LastDay.Month - 1; Update_DigitsPosition(); //if (Lotto != null) //{ // Lotto.PlayJustDay = false; // Lotto.Combinations = Lotto.CombinationsAll; // Lotto.UpdateAfterChangeNND(); // ComboBox_SelectionChanged(sender, null); //} }
private void solodia_Checked(object sender, RoutedEventArgs e) { countAuto.Text = "100"; Lotto.ClearAll(); Lotto = new LottoData(); Lotto.PlayJustDay = true; Lotto.Initialize(2); Lotto.Main = this; DataContext = Lotto; Lotto.DateSelect = new Date(DateTime.Today); calendar.SelectedDate = Lotto.LastDay; //Lotto.PlayJustDay = true; //Lotto.Combinations = Lotto.CombinationsDay; //Lotto.UpdateAfterChangeNND(); //Lotto.DoFrecuencyForDay(); ComboBox_SelectionChanged(sender, null); Update_DigitsPosition(); }
public MainWindow() { InitializeComponent(); //Para que los tooltips no se quiten ToolTipService.ShowDurationProperty.OverrideMetadata( typeof (DependencyObject), new FrameworkPropertyMetadata(Int32.MaxValue)); DateDesde = Util.DoDateTime(desdeDate.Text, true); DateHasta = Util.DoDateTime(hastaDate.Text, false); TextCopied = ""; var start = new Start(); start.Show(); Lotto = new LottoData(); Lotto.Initialize(1); Update_DigitsPosition(); Algorithm = Lotto.DefaultAlgorithm; Lotto.LoadFileColumn(); textBoxWrite1.Text = Lotto.DataColumn1; textBoxWrite2.Text = Lotto.DataColumn2; //#region Tabulaciones Estadística //DataSet ds = new DataSet(); //var tabla = ConvertListToDataTable(Lotto.FrecuencyNumber); //ds.Tables.Add(tabla); //DataDatagrid.ItemsSource = ds.Tables[0].DefaultView; //var listProm = Lotto.DoPromedio(); //var listMed = Lotto.DoMediana(); //var listMod = Lotto.DoModa(); //tabla.Columns.Add("Promedio"); //tabla.Columns.Add("Mediana"); //tabla.Columns.Add("Moda"); //tabla.Columns.Add("Números"); //for (int i = 0; i < 100; i++) //{ // tabla.Rows[i]["Promedio"] = listProm[i]; // tabla.Rows[i]["Mediana"] = listMed[i]; // tabla.Rows[i]["Moda"] = listMod[i]; // tabla.Rows[i]["Números"] = i.ToString(); //} //#endregion computerData = new ComputerData(); var temp = new List<string>(); foreach (var n in Lotto.L()) { temp.Add(n.Corrido1); } computerData.L = temp; Verify(); Lotto.Main = this; DataContext = Lotto; Lotto.DateSelect = new Date(DateTime.Today); calendar.SelectedDate = Lotto.LastDay; comboBox.SelectedIndex = Lotto.LastDay.Month - 1; moveIndex = 0; //_timer = new Timer(); //_timer.Elapsed += new ElapsedEventHandler(ThreadMove); //_timer.Interval = 15000; //_timer.Enabled = true; //_timer.AutoReset = true; //_timer.Start(); //Desactivar la copia desde los textbox DataObject.AddCopyingHandler(textBoxWrite1, OnCancelCommand); DataObject.AddCopyingHandler(textBoxWrite2, OnCancelCommand); //#region Extras //ComboBoxsLoaded(); //Search3(); //#endregion //#region Fantasy5 //var tempdate = Lotto.LastDayF5.AddDays(1); //entryF5.Text = tempdate.Day > 9 ? tempdate.Day.ToString() : ("0" + tempdate.Day.ToString()) + "/"; //entryF5.Text += tempdate.Month > 9 // ? tempdate.Month.ToString() // : ("0" + tempdate.Month.ToString()) + "/" + tempdate.Year.ToString() + // "/"; //#endregion start.Close(); }