public Weather(int MinTemp, int MaxTemp, int Pressure, int day, int month, int year, int hours, int minutes, OvercastStatus overcast, WindStatus wind, PrecipitationStatus precipitation) { this.MinTemp = MinTemp; this.MaxTemp = MaxTemp; this.Pressure = Pressure; this.day = day; if (day < 1 || day > 31) { Console.WriteLine("Input day once more please"); } this.month = month; if (month < 1 || month > 12) { Console.WriteLine("Input month once more please"); } this.year = year; if (year < 2000 || year > 2100) { Console.WriteLine("Input year once more please"); } this.hours = hours; if (hours < 1 || hours > 24) { Console.WriteLine("Input hours once more please"); } this.minutes = minutes; if (minutes < 1 || minutes > 60) { Console.WriteLine("Input minutes once more please"); } this.status_of_overcast = overcast; this.status_of_wind = wind; this.status_of_precipitation = precipitation; }
public void GetSnowInfo(out bool isSnowy, out WindStatus windStatus) { isSnowy = _currentMap.IsSnowy; windStatus = _currentMap.WindStatusVar; }
public void Get_text_from_file(string fileName) { int TheMinTemp = 0, TheMaxTemp = 0, ThePressure = 0, TheDay = 0, TheMonth = 0, TheYear = 0, TheHours = 0, TheMinute = 0; OvercastStatus TheStatus_of_overcast = OvercastStatus.nothing; WindStatus TheStatus_of_wind = WindStatus.nothing; PrecipitationStatus TheStatus_of_precipitation = PrecipitationStatus.nothing; FileStream file = new FileStream(fileName, FileMode.Open); StreamReader readFile = new StreamReader(file); while (!readFile.EndOfStream) { string newString = readFile.ReadLine(); string[] fromFile = newString.Split(' '); for (int i = 0; i < fromFile.Length; i++) { if (i == 0) { TheMinTemp = Convert.ToInt32(fromFile[i]); } if (i == 1) { TheMaxTemp = Convert.ToInt32(fromFile[i]); } if (i == 2) { ThePressure = Convert.ToInt32(fromFile[i]); } if (i == 3) { TheDay = Convert.ToInt32(fromFile[i]); } if (i == 4) { TheMonth = Convert.ToInt32(fromFile[i]); } if (i == 5) { TheYear = Convert.ToInt32(fromFile[i]); } if (i == 6) { TheHours = Convert.ToInt32(fromFile[i]); } if (i == 7) { TheMinute = Convert.ToInt32(fromFile[i]); } if (i == 8) { switch (Convert.ToInt32(fromFile[i])) { case 1: TheStatus_of_overcast = OvercastStatus.clear; break; case 2: TheStatus_of_overcast = OvercastStatus.cloudy; break; case 3: TheStatus_of_overcast = OvercastStatus.nothing; break; case 4: TheStatus_of_overcast = OvercastStatus.overcast; break; default: TheStatus_of_overcast = OvercastStatus.nothing; break; } } if (i == 9) { switch (Convert.ToInt32(fromFile[i])) { case 1: TheStatus_of_wind = WindStatus.East; break; case 2: TheStatus_of_wind = WindStatus.North; break; case 3: TheStatus_of_wind = WindStatus.nothing; break; case 4: TheStatus_of_wind = WindStatus.South; break; case 5: TheStatus_of_wind = WindStatus.West; break; default: TheStatus_of_wind = WindStatus.nothing; break; } } if (i == 10) { switch (Convert.ToInt32(fromFile[i])) { case 1: TheStatus_of_precipitation = PrecipitationStatus.dew; break; case 2: TheStatus_of_precipitation = PrecipitationStatus.fog; break; case 3: TheStatus_of_precipitation = PrecipitationStatus.hail; break; case 4: TheStatus_of_precipitation = PrecipitationStatus.nothing; break; case 5: TheStatus_of_precipitation = PrecipitationStatus.rain; break; case 6: TheStatus_of_precipitation = PrecipitationStatus.snow; break; default: TheStatus_of_precipitation = PrecipitationStatus.nothing; break; } } } Weathers.Add(new Weather(TheMinTemp, TheMaxTemp, ThePressure, TheDay, TheMonth, TheYear, TheHours, TheMinute, TheStatus_of_overcast, TheStatus_of_wind, TheStatus_of_precipitation)); } readFile.Close(); }