Код: Выделить всё
using (StreamReader reader = new StreamReader(saveLocation, System.Text.Encoding.UTF8))
{
string line;
while ((line = reader.ReadLine()) != null)
{
...
}
}
Мой файл записывается так:
Код: Выделить всё
private static void WriteIndexFile(
string saveLocation,
SortedDictionary filesToWrite)
{
using (StreamWriter writer = new StreamWriter(saveLocation, false, System.Text.Encoding.UTF8))
{
writer.WriteLine("cross_ref");
foreach (KeyValuePair kvp in filesToWrite)
{
writer.WriteLine($" file_start \"{kvp.Key}\"");
writer.WriteLine($" filename \"{kvp.Value}\"");
writer.WriteLine($" #modified {File.GetLastWriteTime(kvp.Value).ToString()}");
writer.WriteLine($" file_end");
}
writer.WriteLine("end_cross_ref");
}
}
Подробнее здесь: https://stackoverflow.com/questions/788 ... for-a-line