This commit is contained in:
ikpil 2023-04-29 13:00:34 +09:00
parent d108c56a29
commit b714e5b0f7
1 changed files with 18 additions and 4 deletions

View File

@ -20,7 +20,7 @@ public static class Program
List<string> list = File.ReadAllLines(path) List<string> list = File.ReadAllLines(path)
.Where(line => line.Contains("error CS1061: ")) .Where(line => line.Contains("error CS1061: "))
.ToList(); .ToList();
List<FileLocation> locations = new List<FileLocation>(); List<FileLocation> locations = new List<FileLocation>();
foreach (string input in list) foreach (string input in list)
{ {
@ -55,7 +55,15 @@ public static class Program
private static void Change(FileLocation location) private static void Change(FileLocation location)
{ {
string[] contents = File.ReadAllLines(location.Path); string[] contents = File.ReadAllLines(location.Path);
List<string> list = ((IEnumerable<char>)contents[location.Line - 1].ToCharArray()).Select<char, string>((Func<char, string>)(x => x.ToString() ?? "")).ToList<string>(); var line = contents[location.Line - 1];
List<string> list = line.ToCharArray()
.Select((x => x.ToString() ?? ""))
.ToList();
// 다르면 하지 말것
if ("." != list[location.Column - 2] || location.Letter != list[location.Column - 1])
return;
list[location.Column - 2] = "["; list[location.Column - 2] = "[";
if (location.Letter == "x") if (location.Letter == "x")
list[location.Column - 1] = "0]"; list[location.Column - 1] = "0]";
@ -71,8 +79,14 @@ public static class Program
public static void Main(string[] args) public static void Main(string[] args)
{ {
var locations = Program.CreateLocations("../../../../../error.log"); var locations = CreateLocations("../../../../../error.log");
foreach (FileLocation location in locations.DistinctBy(x => x.Path + x.Line)) var distinctLocations = locations.DistinctBy(x => x.Path + x.Line).ToList();
if (0 >= distinctLocations.Count)
{
return;
}
foreach (FileLocation location in distinctLocations)
{ {
Change(location); Change(location);
Console.WriteLine($"{location.Path}({location.Line}:{location.Column})"); Console.WriteLine($"{location.Path}({location.Line}:{location.Column})");