public string[] IdentifyTracks(int[] a1) { string[] tracks = new string[5]; for (int i = 0; i < 5; i++) { string name = "unknown"; int length = NotePad.GetInfoFileLength(trackDirectory + (i + 1) + "\\info.txt"); string[,] theTable = NotePad.ReadInfoFromTXT(trackDirectory + (i + 1) + "\\info.txt"); for (int l = 0; l < length; l++) { if (a1[i] == Convert.ToInt32(theTable[l, 0])) { name = theTable[l, 1]; tracks[i] = name; break; } } if (name == "unknown") { NotePad.DoErrorLog("Неизвестная трасса позиция " + (i + 1)); tracks[i] = "Неизвестная трасса"; } } return(tracks); }
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); }
public string[] IdentifyGround(int[] b1) { string[] grounds = new string[5]; for (int i = 0; i < 5; i++) { string name = "unknown"; int length = NotePad.GetInfoFileLength(groundDirectory + (i + 1) + "\\info.txt"); string[,] theTable = NotePad.ReadInfoFromTXT(groundDirectory + (i + 1) + "\\info.txt"); for (int l = 0; l < length; l++) { if (b1[i] == Convert.ToInt32(theTable[l, 0])) { name = theTable[l, 1]; grounds[i] = name; break; } } if (name == "unknown") { NotePad.DoErrorLog("Неизвестное покрытие позиция " + (i + 1)); grounds[i] = "Неизвестная покрытие"; } } bool asphalt = false; bool mud = false; foreach (string x in grounds) { if (x == "Асфальт") { asphalt = true; } else { mud = true; } } if (asphalt) { Condition.coverage = "Асфальт"; if (mud) { Condition.coverage = "Смешанное"; } } else { Condition.coverage = "Бездорожье"; } NotePad.LastCoverage(Condition.coverage); return(grounds); }
public string ConvertPictureToCond(int picture, int cond) { string name = "unknown"; int length = NotePad.GetInfoFileLength(@"C:\Bot\Condition" + cond + @"\info.txt"); string[,] theTable = NotePad.ReadInfoFromTXT(@"C:\Bot\Condition" + cond + @"\info.txt"); for (int i = 0; i < length; i++) { if (picture == Convert.ToInt32(theTable[i, 0])) { name = theTable[i, 1]; NotePad.DoLog(cond + " условие: " + name); break; } } if (name == "unknown") { NotePad.DoErrorLog("Неизвестное условие"); } return(name); }