Beispiel #1
0
        public static TemperatureArchive Load(string way)
        {
            TemperatureArchive TMP = new TemperatureArchive();

            using (StreamReader Reader = File.OpenText(way))
            {
                double value;
                string line;


                while ((line = Reader.ReadLine()) != null)
                {
                    List <double> Temperatures = new List <double>(); //vytvori List teplot

                    line = line.Replace(" ", "");                     // smaze mezery

                    List <string> values = line.Split(':', ';').ToList();

                    for (int i = 1; i < values.Count; i++)
                    {
                        value = Convert.ToDouble(values[i]);

                        Temperatures.Add(value);
                    }
                    TMP.AddYearData(new AnnualTemperature(Convert.ToInt32(values[0]), Temperatures));
                }
            }
            return(TMP);
        }
Beispiel #2
0
        static void Main(string[] args)
        {
            TemperatureArchive archive = TemperatureArchive.Load("D:\\Archive.txt");

            archive.Calibration(-5);

            archive.Search(2010);

            archive.PrintAnnualTemperatures();

            archive.PrintMonthlyTemperatures();

            archive.PrintTemperatures();

            archive.Save("D:\\Archive.txt");


            Console.ReadLine();
        }