public void ReadLine(string path, OnReadLineHandler handler) { if (!Directory.Exists(path) && !File.Exists(path)) { UnityEngine.Debug.Log("ReadLine, path is not exist:" + path); return; } string[] allLine = System.IO.File.ReadAllLines(path, GetEncoding(path)); int currentLine = 0; foreach (string item in allLine) { if (handler != null) { if (digOutAnnotation(item)) { } else if (handler(currentLine, item)) { } else { break;//返回false代表不读了 } currentLine++; } } }
public void ReadConfigLine(string configName, OnReadLineHandler handler) { ReadLine(editorConfigPath + configName, handler); }