public void AddMonthDataFile() // зчитування з файлу даних до кожного дня місяця { string pathWeather = @"E:\university\ооп\task7_enum\bin\Debug\netcoreapp3.1\WeatherData.txt"; try { StreamReader readData = new StreamReader(pathWeather); int fileLength = CountLength(pathWeather); if (fileLength != 30) { Console.WriteLine("\nError. File must contain data for exactly 30 days. Make changes and start the program again."); } else { for (int i = 0; i < fileLength; i++) { WeatherParametersDay day = new WeatherParametersDay(); monthData[i] = day; day.SetParametersFromFile(readData); } } } catch (FileNotFoundException) { Console.WriteLine("\nFile not found. Make changes and start the program again."); } }
public void AddMonthData() // ввід даних вручну за кожен день місяця { for (int i = 0; i < 30; i++) { WeatherParametersDay day = new WeatherParametersDay(); monthData[i] = day; day.SetParameters(); } }