public void Download(FileInfo[] files)
        {
            tournaments.Clear();

            foreach (FileInfo file in files)
            {
                if (!file.Name.Contains("Summary"))
                {
                    try
                    {
                        FileInfo summary = files.FirstOrDefault(f => f.Name == file.Name + " - Summary.txt");

                        if (summary == null)
                        {
                            Tournament tournament = Tournament.From888PokerFile(file);
                            tournaments.Add(tournament);
                        }
                        else
                        {
                            Tournament tournament = Tournament.From888PokerFiles(file, summary, false);

                            if (tournament.Started >= dateTimePicker.Value)
                            {
                                tournaments.Add(tournament);
                            }
                        }
                    }
                    catch
                    {
                        continue;
                    }
                }
            }
        }
Exemplo n.º 2
0
        private void DownloadFromPoker888(FileInfo[] files)
        {
            FileInfo errorsFile = new FileInfo("errors2.txt");

            using (StreamWriter writer = new StreamWriter(errorsFile.Open(FileMode.Create)))
            {
                foreach (FileInfo file in files)
                {
                    if (!file.Name.Contains("Summary"))
                    {
                        string message = "Can not find summary file.";
                        try
                        {
                            FileInfo summary = files.First(f => f.Name == file.Name + " - Summary.txt");

                            message = null;
                            Tournament tournament = Tournament.From888PokerFiles(file, summary, false);

                            message = "Something is bad.";
                            if (allTournaments.FirstOrDefault(t => t.Id == tournament.Id) != null)
                            {
                                continue;
                            }

                            allTournaments.Add(tournament);
                        }
                        catch (Exception exc)
                        {
                            if (message == null)
                            {
                                message = exc.Message;
                            }

                            writer.WriteLine(file.Name + " : ");
                            writer.WriteLine(message);
                            writer.WriteLine();
                            continue;
                        }
                    }
                }
            }
        }