diff --git a/FRBDK/Glue/NpcWpfLib/Managers/ProjectCreationHelper.cs b/FRBDK/Glue/NpcWpfLib/Managers/ProjectCreationHelper.cs index 35c6019d4..5afa4f021 100644 --- a/FRBDK/Glue/NpcWpfLib/Managers/ProjectCreationHelper.cs +++ b/FRBDK/Glue/NpcWpfLib/Managers/ProjectCreationHelper.cs @@ -200,8 +200,7 @@ public static void RenameProject(string newProjectName, string oldProjectName, s newNamespace = newNamespace ?? newProjectName; if(oldProjectName != newNamespace) { - UpdateNamespaces(projectRootDirectory, oldProjectName, - newNamespace); + UpdateNamespaces(projectRootDirectory, oldProjectName, newNamespace); } } @@ -431,6 +430,9 @@ private static void RenameFiles(string unpackDirectory, string stringToReplace, filesToReplace.AddRange(FileManager.GetAllFilesInDirectory( unpackDirectory, "pfx")); + filesToReplace.AddRange(FileManager.GetAllFilesInDirectory( + unpackDirectory, "mgcb")); + foreach (string fileName in filesToReplace) { @@ -619,6 +621,10 @@ private static void UpdateNamespaces(string unpackDirectory, string stringToRepl string newProjectReference = $@""; contents = contents.Replace(originalProjectReference, newProjectReference); + string originalMgcb = $@""; + string newMgcb = $@""; + contents = contents.Replace(originalMgcb, newMgcb); + System.IO.File.WriteAllText(fileName, contents, Encoding.UTF8); } @@ -700,8 +706,38 @@ private static void UpdateNamespaces(string unpackDirectory, string stringToRepl contents = contents.Replace(whatToSearchFor, replacement); + if(contents.Contains($"{stringToReplace}")) + { + whatToSearchFor = $"{stringToReplace}"; + replacement = $"{stringToReplaceWith}"; + + contents = contents.Replace(whatToSearchFor, replacement); + } + + FileManager.SaveText(contents, fileName); + } + #endregion + + #region launchSettings.json + + filesToFix.Clear(); + filesToFix.AddRange(FileManager.GetAllFilesInDirectory(unpackDirectory, "json")); + foreach(var fileName in filesToFix) + { + if (fileName.ToLowerInvariant().EndsWith("launchsettings.json") == false) + { + continue; + } + + string contents = FileManager.FromFileText(fileName); + string whatToSearchFor = "\"" + stringToReplace + "\": {"; + string replacement = "\"" + stringToReplaceWith + "\": {"; + + contents = contents.Replace(whatToSearchFor, replacement); + FileManager.SaveText(contents, fileName); } + #endregion }