示例#1
0
        public string[] IdentifyWeather(int[] c1)
        {
            string[] weathers = new string[5];
            for (int i = 0; i < 5; i++)
            {
                string name   = "unknown";
                int    length = NotePad.GetInfoFileLength(weatherDirectory + (i + 1) + "\\info.txt");
                string[,] theTable = NotePad.ReadInfoFromTXT(weatherDirectory + (i + 1) + "\\info.txt");
                for (int l = 0; l < length; l++)
                {
                    if (c1[i] == Convert.ToInt32(theTable[l, 0]))
                    {
                        name        = theTable[l, 1];
                        weathers[i] = name;
                        break;
                    }
                }
                if (name == "unknown")
                {
                    NotePad.DoErrorLog("Неизвестная погода позиция " + (i + 1));
                    weathers[i] = "Неизвестная погода";
                }
            }

            bool dry = false;
            bool wet = false;

            foreach (string x in weathers)
            {
                if (x == "Дождь")
                {
                    wet = true;
                }

                if (x == "Солнечно")
                {
                    dry = true;
                }
            }

            Condition.weather = "ясно";
            if (wet)
            {
                if (dry)
                {
                    Condition.weather = "с прояснением";
                }
                else
                {
                    Condition.weather = "дождь";
                }
            }
            NotePad.LastWeather(Condition.weather);

            return(weathers);
        }