-
Notifications
You must be signed in to change notification settings - Fork 122
Open
Description
I stumbled across this project from the Louis Rossmann video and decided to check it out for the hell of it. I noticed some of the code would be hard to modify as-is and would benefit from a bit of cleaning, but wanted to ask for permission before making a pull request.
My current plan is to put both projects under the same solution and simplify some complex or highly nested code, such as ParseErrors in UART-CL:
PS5NorModifier/UART-CL By TheCod3r/UART-CL By TheCod3r/Program.cs
Lines 90 to 153 in 3064e07
| static string ParseErrors(string errorCode) | |
| { | |
| string results = ""; | |
| try | |
| { | |
| // Check if the XML file exists | |
| if (File.Exists("errorDB.xml")) | |
| { | |
| // Load the XML file | |
| XmlDocument xmlDoc = new XmlDocument(); | |
| xmlDoc.Load("errorDB.xml"); | |
| // Get the root node | |
| XmlNode root = xmlDoc.DocumentElement; | |
| // Check if the root node is <errorCodes> | |
| if (root.Name == "errorCodes") | |
| { | |
| // No error was found in the database | |
| if (root.ChildNodes.Count == 0) | |
| { | |
| results = "No result found for error code " + errorCode; | |
| } | |
| else | |
| { | |
| // Loop through each errorCode node | |
| foreach (XmlNode errorCodeNode in root.ChildNodes) | |
| { | |
| // Check if the node is <errorCode> | |
| if (errorCodeNode.Name == "errorCode") | |
| { | |
| // Get ErrorCode and Description | |
| string errorCodeValue = errorCodeNode.SelectSingleNode("ErrorCode").InnerText; | |
| string description = errorCodeNode.SelectSingleNode("Description").InnerText; | |
| // Check if the current error code matches the requested error code | |
| if (errorCodeValue == errorCode) | |
| { | |
| // Output the results | |
| results = "Error code: " + errorCodeValue + Environment.NewLine + "Description: " + description; | |
| break; // Exit the loop after finding the matching error code | |
| } | |
| } | |
| } | |
| } | |
| } | |
| else | |
| { | |
| results = "Error: Invalid XML database file. Please reconfigure the application, redownload the offline database, or uncheck the option to use the offline database."; | |
| } | |
| } | |
| else | |
| { | |
| results = "Error: Local XML file not found."; | |
| } | |
| } | |
| catch (Exception ex) | |
| { | |
| results = "Error: " + ex.Message; | |
| } | |
| return results; | |
| } |
Because both projects accomplish the same goals, some code could also be extracted to a common core library.
Please let me know what you think :)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels