Exemple #1
0
        public static void GenerateGraph()
        {
            if (Settings.ReadSettings("graph.xml"))
            {
                //string currentDir = System.IO.Directory.GetCurrentDirectory();
                string outdir = Settings.GraphOutputDirectory;
                System.IO.Directory.CreateDirectory(outdir);

                DirectoryInfo dir = new DirectoryInfo(Settings.TSVInputDirectory);

                try
                {
                    for (int i = 0; i < dir.GetFiles("*results_race_extended.tsv").Length; i++)
                    {
                        string tsvfile = dir.GetFiles("*results_race_extended.tsv")[i].Name;
                        string picfile = "";

                        FileInfo fitsv = new FileInfo(Settings.TSVInputDirectory + tsvfile);

                        if (fitsv.Length > 20)
                        {
                            picfile = tsvfile.Substring(0, tsvfile.Length - 26);

                            string   outfilename = outdir + picfile + "_lbl.png";
                            FileInfo fi          = new FileInfo(outfilename);

                            if (!fi.Exists || fi.Length == 0)
                            {
                                lblData = new LblData(Settings.TSVInputDirectory + tsvfile);
                                lblData.Draw();
                                lblData.Save(outfilename, Settings.graphWidth, Settings.graphHeight);
                            }

                            //                            System.Console.WriteLine(Settings.TSVInputDirectory + tsvfile);
                        }
                    }
                }
                catch (System.Exception e)                 // assume the directory path error
                {
                    System.Console.WriteLine(e.Message);
                    //					System.Console.WriteLine("Path "+Settings.TSVInputDirectory+" not found");
                    return;
                }

                for (int i = 0; i < dir.GetFiles("*results_race_extended.tsv").Length; i++)
                {
                    string tsvfile = dir.GetFiles("*results_race_extended.tsv")[i].Name;

                    string picfile = "";

                    FileInfo fitsv = new FileInfo(Settings.TSVInputDirectory + tsvfile);

                    if (fitsv.Length > 20)
                    {
                        picfile = tsvfile.Substring(0, tsvfile.Length - 26);

                        string   outfilename = outdir + picfile + "_rpr.png";
                        FileInfo fi          = new FileInfo(outfilename);

                        if (!fi.Exists || fi.Length == 0)
                        {
                            rprData = new RprData(Settings.TSVInputDirectory + tsvfile);
                            rprData.Draw();
                            rprData.Save(outfilename, Settings.graphWidth, Settings.graphHeight);
                        }
                    }
                }

                if (Settings.OutputLapTimes)
                {
                    for (int i = 0; i < dir.GetFiles("*results_race_extended.tsv").Length; i++)
                    {
                        string tsvfile = dir.GetFiles("*results_race_extended.tsv")[i].Name;

                        lapData = new LapData(Settings.TSVInputDirectory + tsvfile);

                        for (int player = 0; player < lapData.players.Count; ++player)
                        {
                            string picfile = "";

                            FileInfo fitsv = new FileInfo(Settings.TSVInputDirectory + tsvfile);

                            if (fitsv.Length > 20)
                            {
                                picfile = tsvfile.Substring(0, tsvfile.Length - 26);

                                string   outfilename = outdir + picfile + "_lap_" + System.Convert.ToString(player + 1) + ".png";
                                FileInfo fi          = new FileInfo(outfilename);

                                if (!fi.Exists || fi.Length == 0)
                                {
                                    lapData.player = player;
                                    lapData.Stats();
                                    lapData.Draw();
                                    lapData.Save(outfilename, Settings.graphWidth, Settings.graphHeight);
                                }
                            }
                        }
                    }
                }
            }
        }
Exemple #2
0
        public static void GenerateGraph()
        {
            if (Settings.ReadSettings("graph.xml"))
            {
                //string currentDir = System.IO.Directory.GetCurrentDirectory();
                string outdir = Settings.GraphOutputDirectory;
                System.IO.Directory.CreateDirectory(outdir);

                DirectoryInfo dir = new DirectoryInfo(Settings.TSVInputDirectory);

                try
                {
                    for (int i = 0; i < dir.GetFiles("*results_race_extended.tsv").Length; i++)
                    {
                        string tsvfile = dir.GetFiles("*results_race_extended.tsv")[i].Name;
                        string picfile = "";

                        FileInfo fitsv = new FileInfo(Settings.TSVInputDirectory + tsvfile);

                        if (fitsv.Length > 20)
                        {
                            picfile = tsvfile.Substring(0, tsvfile.Length - 26);

                            string outfilename = outdir + picfile + "_lbl.png";
                            FileInfo fi = new FileInfo(outfilename);

                            if (!fi.Exists || fi.Length == 0)
                            {
                                lblData = new LblData(Settings.TSVInputDirectory + tsvfile);
                                lblData.Draw();
                                lblData.Save(outfilename, Settings.graphWidth, Settings.graphHeight);
                            }

                            //                            System.Console.WriteLine(Settings.TSVInputDirectory + tsvfile);
                        }
                    }
                }
                catch (System.Exception e) // assume the directory path error
                {
                    System.Console.WriteLine(e.Message);
                    //					System.Console.WriteLine("Path "+Settings.TSVInputDirectory+" not found");
                    return;
                }

                for (int i = 0; i < dir.GetFiles("*results_race_extended.tsv").Length; i++)
                {
                    string tsvfile = dir.GetFiles("*results_race_extended.tsv")[i].Name;

                    string picfile = "";

                    FileInfo fitsv = new FileInfo(Settings.TSVInputDirectory + tsvfile);

                    if (fitsv.Length > 20)
                    {
                        picfile = tsvfile.Substring(0, tsvfile.Length - 26);

                        string outfilename = outdir + picfile + "_rpr.png";
                        FileInfo fi = new FileInfo(outfilename);

                        if (!fi.Exists || fi.Length == 0)
                        {
                            rprData = new RprData(Settings.TSVInputDirectory + tsvfile);
                            rprData.Draw();
                            rprData.Save(outfilename, Settings.graphWidth, Settings.graphHeight);
                        }
                    }

                }

                if (Settings.OutputLapTimes)
                    for (int i = 0; i < dir.GetFiles("*results_race_extended.tsv").Length; i++)
                    {
                        string tsvfile = dir.GetFiles("*results_race_extended.tsv")[i].Name;

                        lapData = new LapData(Settings.TSVInputDirectory + tsvfile);

                        for (int player = 0; player < lapData.players.Count; ++player)
                        {
                            string picfile = "";

                            FileInfo fitsv = new FileInfo(Settings.TSVInputDirectory + tsvfile);

                            if (fitsv.Length > 20)
                            {
                                picfile = tsvfile.Substring(0, tsvfile.Length - 26);

                                string outfilename = outdir + picfile + "_lap_" + System.Convert.ToString(player + 1) + ".png";
                                FileInfo fi = new FileInfo(outfilename);

                                if (!fi.Exists || fi.Length == 0)
                                {
                                    lapData.player = player;
                                    lapData.Stats();
                                    lapData.Draw();
                                    lapData.Save(outfilename, Settings.graphWidth, Settings.graphHeight);
                                }
                            }
                        }

                    }

            }
        }