From b30f3c7666c4251b42099829927d1cfc6bb0f97c Mon Sep 17 00:00:00 2001 From: ikpil Date: Sat, 29 Apr 2023 12:30:51 +0900 Subject: [PATCH] test --- DotRecast.sln | 9 ++++ tools/ConvertVector/ConvertVector.csproj | 10 ++++ tools/ConvertVector/Program.cs | 65 ++++++++++++++++++++++++ 3 files changed, 84 insertions(+) create mode 100644 tools/ConvertVector/ConvertVector.csproj create mode 100644 tools/ConvertVector/Program.cs diff --git a/DotRecast.sln b/DotRecast.sln index e07d120..7c242b7 100644 --- a/DotRecast.sln +++ b/DotRecast.sln @@ -35,6 +35,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DotRecast.Detour.TileCache. EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DotRecast.Recast.Demo", "src\DotRecast.Recast.Demo\DotRecast.Recast.Demo.csproj", "{023E1E6A-4895-4573-89AE-3D5D8E0B39C8}" EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tools", "tools", "{65754308-3C9B-4544-9D7B-F2C16A4E2486}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConvertVector", "tools\ConvertVector\ConvertVector.csproj", "{2E7E2C58-BCA3-4590-BA9D-0872DE546DBD}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -100,6 +104,10 @@ Global {023E1E6A-4895-4573-89AE-3D5D8E0B39C8}.Debug|Any CPU.Build.0 = Debug|Any CPU {023E1E6A-4895-4573-89AE-3D5D8E0B39C8}.Release|Any CPU.ActiveCfg = Release|Any CPU {023E1E6A-4895-4573-89AE-3D5D8E0B39C8}.Release|Any CPU.Build.0 = Release|Any CPU + {2E7E2C58-BCA3-4590-BA9D-0872DE546DBD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {2E7E2C58-BCA3-4590-BA9D-0872DE546DBD}.Debug|Any CPU.Build.0 = Debug|Any CPU + {2E7E2C58-BCA3-4590-BA9D-0872DE546DBD}.Release|Any CPU.ActiveCfg = Release|Any CPU + {2E7E2C58-BCA3-4590-BA9D-0872DE546DBD}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(NestedProjects) = preSolution {FFE40BBF-843B-41FA-8504-F4ABD166762E} = {8ED75CF7-A3D6-423D-8499-9316DD413DAD} @@ -116,5 +124,6 @@ Global {DEB16B90-CCD4-497E-A2E9-4CC66FD7EF47} = {8ED75CF7-A3D6-423D-8499-9316DD413DAD} {3CAA7306-088E-4373-A406-99755CC2B605} = {A7CB8D8B-70DA-4567-8316-0659FCAE1C73} {023E1E6A-4895-4573-89AE-3D5D8E0B39C8} = {8ED75CF7-A3D6-423D-8499-9316DD413DAD} + {2E7E2C58-BCA3-4590-BA9D-0872DE546DBD} = {65754308-3C9B-4544-9D7B-F2C16A4E2486} EndGlobalSection EndGlobal diff --git a/tools/ConvertVector/ConvertVector.csproj b/tools/ConvertVector/ConvertVector.csproj new file mode 100644 index 0000000..f02677b --- /dev/null +++ b/tools/ConvertVector/ConvertVector.csproj @@ -0,0 +1,10 @@ + + + + Exe + net7.0 + enable + enable + + + diff --git a/tools/ConvertVector/Program.cs b/tools/ConvertVector/Program.cs new file mode 100644 index 0000000..f0a46c8 --- /dev/null +++ b/tools/ConvertVector/Program.cs @@ -0,0 +1,65 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text.RegularExpressions; + +public static class Program +{ + private static List CreateLocations(string path) + { + List list = ((IEnumerable) File.ReadAllLines(path)).Where((Func) (line => line.Contains("error CS1061: "))).ToList(); + List locations = new List(); + foreach (string input in list) + { + string pattern = "([A-Za-z]:\\\\[^\\\\]+\\\\[^\\\\]+(?:\\\\[^\\\\]+)*\\\\[^\\\\]+\\.cs)\\((\\d+),(\\d+)\\)"; + Match match = Regex.Match(input, pattern); + if (match.Success) + { + string str1 = match.Groups[1].Value; + string s1 = match.Groups[2].Value; + string s2 = match.Groups[3].Value; + string str2 = ""; + if (input.Contains("'x'에 대한")) + str2 = "x"; + if (input.Contains("'y'에 대한")) + str2 = "y"; + if (input.Contains("'z'에 대한")) + str2 = "z"; + FileLocation fileLocation = new FileLocation() + { + Path = str1, + Line = int.Parse(s1), + Column = int.Parse(s2), + Letter = str2 + }; + locations.Add(fileLocation); + } + } + return locations; + } + + private static void Change(FileLocation location) + { + string[] contents = File.ReadAllLines(location.Path); + List list = ((IEnumerable) contents[location.Line - 1].ToCharArray()).Select((Func) (x => x.ToString() ?? "")).ToList(); + list[location.Column - 2] = "["; + if (location.Letter == "x") + list[location.Column - 1] = "0]"; + else if (location.Letter == "y") + list[location.Column - 1] = "1]"; + else if (location.Letter == "z") + list[location.Column - 1] = "2]"; + string str = string.Join("", (IEnumerable) list); + contents[location.Line - 1] = str; + //File.WriteAllLines(location.Path, contents); + } + + public static void Main(string[] args) + { + var locations = Program.CreateLocations("../../../../../error.log"); + foreach (FileLocation location in locations) + Program.Change(location); + } +} + \ No newline at end of file