에러 수정

This commit is contained in:
ikpil 2023-04-29 12:49:13 +09:00
parent abf52d1ec3
commit 096cfec536
1 changed files with 8 additions and 2 deletions

View File

@ -17,7 +17,10 @@ public static class Program
{ {
private static List<FileLocation> CreateLocations(string path) private static List<FileLocation> CreateLocations(string path)
{ {
List<string> list = ((IEnumerable<string>)File.ReadAllLines(path)).Where<string>((Func<string, bool>)(line => line.Contains("error CS1061: "))).ToList<string>(); List<string> list = File.ReadAllLines(path)
.Where(line => line.Contains("error CS1061: "))
.ToList();
List<FileLocation> locations = new List<FileLocation>(); List<FileLocation> locations = new List<FileLocation>();
foreach (string input in list) foreach (string input in list)
{ {
@ -62,7 +65,7 @@ public static class Program
list[location.Column - 1] = "2]"; list[location.Column - 1] = "2]";
string str = string.Join("", (IEnumerable<string>)list); string str = string.Join("", (IEnumerable<string>)list);
contents[location.Line - 1] = str; contents[location.Line - 1] = str;
File.WriteAllLines(location.Path, contents); File.WriteAllLines(location.Path, contents);
} }
@ -70,6 +73,9 @@ public static class Program
{ {
var locations = Program.CreateLocations("../../../../../error.log"); var locations = Program.CreateLocations("../../../../../error.log");
foreach (FileLocation location in locations.DistinctBy(x => x.Path + x.Line)) foreach (FileLocation location in locations.DistinctBy(x => x.Path + x.Line))
{
Change(location); Change(location);
Console.WriteLine($"{location.Path}({location.Line}:{location.Column})");
}
} }
} }