private static void ReadAndAppend(LockedCollection <string> collection, string filePath, bool includeComments, bool trim) { ReadFileLineByLine(filePath, includeComments, trim, (lineNumber, line) => { collection.AppendItem(line); }); }
private static void ReadAndDeserialize <T>(LockedCollection <T> collection, string filePath, ThreadSafeUI ui, bool includeComments, bool trim) where T : IStringSerializeable, new() { ReadFileLineByLine(filePath, includeComments, trim, (lineNumber, line) => { // Десериализуем объект из строки var item = new T(); if (item.DeserializeFromString(line)) { collection.AppendItem(item); } else { ui?.Log($"Skipped {typeof(T).Name} because invalid format. Line #{lineNumber}: {line}"); } }); }