private static void TestValidityOfWordListFile(string file) { string text = "Assets/StreamingAssets/" + file; bool flag = false; bool flag2 = true; StreamReader streamReader = File.OpenText(text); Stream baseStream = streamReader.BaseStream; int i = 0; while (i < 7) { int num = baseStream.ReadByte(); if (num != (int)"UTF-8\n\n"[i]) { if (i == 0 && num == 239 && baseStream.ReadByte() == 187 && baseStream.ReadByte() == 191) { Debug.LogWarning("Only UTF-8 documents without BOM are supported."); flag2 = false; flag = true; break; } if (i == 5 && num == 13) { Debug.LogWarning("Only UTF-8 documents without CARRIAGE RETURN are supported."); flag2 = false; flag = true; break; } Debug.LogWarning("Not a valid UTF-8 encoded file. It needs to start with the header \"UTF-8\" followed by an empty line."); flag2 = false; break; } else { i++; } } int num2 = 0; while (flag2 && !streamReader.EndOfStream) { string text2 = streamReader.ReadLine(); if (text2.Length == 0) { Debug.LogWarning("There is an empty line in your word list."); flag2 = false; } else if (text2.Length < 2) { Debug.LogWarning("The word " + text2 + " is too short for Text-Reco."); flag2 = false; } else if (text2.Length > 45) { Debug.LogWarning("The word " + text2 + " is too long for Text-Reco."); flag2 = false; } else { string text3 = text2; for (int j = 0; j < text3.Length; j++) { char c = text3[j]; if ((c < 'A' || c > 'Z') && (c < 'a' || c > 'z') && c != '-' && c != '\'' && c != ' ') { Debug.LogWarning("The word " + text2 + " is not supported because of character " + c.ToString()); flag2 = false; } } } num2++; if (num2 > 10000) { Debug.LogWarning("The maximum number of words is " + 10000 + "."); flag2 = false; } } streamReader.Close(); if (!flag2 & flag) { TextRecoEditor.ConvertEOLAndEncodingIfUserWantsTo(text); } }