public Relation(double compatibility, double LiquidPrecipiationPercent, double RelativeHumidityPercent, double TemperaturePercent, double WindSpeedPercent, Area Area, Farming Farming) { this.compatibility = compatibility; this.RelativeHumidityPercent = RelativeHumidityPercent; this.LiquidPrecipiationPercent = LiquidPrecipiationPercent; this.TemperaturePercent = TemperaturePercent; this.WindSpeedPercent = WindSpeedPercent; this.Area = Area; this.Farming = Farming; }
/** * This method loads the farmings saved on a textfile */ private void loadFarming(String path) { using (System.IO.StreamReader file = new System.IO.StreamReader(path)) { String line = file.ReadLine(); line = file.ReadLine(); while (line != null) { Console.WriteLine(line); String[] infor = line.Split(';'); String Name = infor[0]; double LiquidPrecipitation = 0; double WindSpeed = 0; double MinTemperature = 0; double MaxTemperature = 0; double[] RelativeHumidity = new double[2]; if (!infor[1].Equals(Farming.noregister)) { LiquidPrecipitation = Convert.ToDouble(infor[1]); } if (!infor[2].Equals(Farming.noregister)) { WindSpeed = Convert.ToDouble(infor[2]); } if (!infor[3].Equals(Farming.noregister)) { MinTemperature = Convert.ToDouble(infor[3]); } if (!infor[4].Equals(Farming.noregister)) { MaxTemperature = Convert.ToDouble(infor[4]); } if (!infor[5].Equals(Farming.noregister)) { String[] partialinfor = infor[5].Split('-'); RelativeHumidity[0] = Convert.ToDouble(partialinfor[0]); RelativeHumidity[1] = Convert.ToDouble(partialinfor[1]); } Farming farming = new Farming(Name, LiquidPrecipitation, RelativeHumidity, WindSpeed, MinTemperature, MaxTemperature); farmings.Add(farming); line = file.ReadLine(); } } }