Skip to content

Commit bfad21b

Browse files
committed
some OCS refactoring
1 parent 9e86119 commit bfad21b

2 files changed

Lines changed: 11 additions & 9 deletions

File tree

FlashpointSecurePlayer/OldCPUSimulator.cs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,7 @@ public bool TestRunningWithOldCPUSimulator() {
4343
}
4444

4545
if (parentProcessFileName != null) {
46-
if (parentProcessFileName.Equals(OLD_CPU_SIMULATOR_PARENT_PROCESS_FILE_NAME, StringComparison.OrdinalIgnoreCase)) {
47-
return true;
48-
}
46+
return parentProcessFileName.Equals(OLD_CPU_SIMULATOR_PARENT_PROCESS_FILE_NAME, StringComparison.OrdinalIgnoreCase);
4947
}
5048
return false;
5149
}
@@ -141,8 +139,8 @@ public void Activate(string templateName, ref ProcessStartInfo softwareProcessSt
141139
case ModeElement.NAME.SOFTWARE:
142140
// USB the HDMI to .exe the database
143141
string commandLineExpanded = Environment.ExpandEnvironmentVariables(modeElement.CommandLine);
144-
StringBuilder oldCPUSimulatorSoftware = new StringBuilder();
145142
string workingDirectory = null;
143+
StringBuilder software = new StringBuilder();
146144

147145
// the problem we're dealing with here
148146
// is that we need to get the full path to
@@ -159,14 +157,15 @@ public void Activate(string templateName, ref ProcessStartInfo softwareProcessSt
159157

160158
string fullPath = Path.GetFullPath(argv[0]);
161159
workingDirectory = Path.GetDirectoryName(fullPath);
162-
oldCPUSimulatorSoftware.Append(GetValidArgument(fullPath, true));
160+
software.Append(GetValidArgument(fullPath, true));
163161
} catch (Exception ex) {
164162
LogExceptionToLauncher(ex);
165163
throw new InvalidOldCPUSimulatorException("The command line is invalid.");
166164
}
167165

168-
oldCPUSimulatorSoftware.Append(" ");
169-
oldCPUSimulatorSoftware.Append(GetArgumentSliceFromCommandLine(commandLineExpanded, 1));
166+
software.Append(" ");
167+
software.Append(GetArgumentSliceFromCommandLine(commandLineExpanded, 1));
168+
170169
// this becomes effectively the new thing passed as --software
171170
// the shared function is used both here and GUI side for restarts
172171
//modeElement.CommandLine = OLD_CPU_SIMULATOR_PATH + " " + GetOldCPUSimulatorProcessStartInfoArguments(oldCPUSimulatorElement, oldCPUSimulatorSoftware.ToString());
@@ -177,7 +176,7 @@ public void Activate(string templateName, ref ProcessStartInfo softwareProcessSt
177176
}
178177

179178
softwareProcessStartInfo.FileName = OLD_CPU_SIMULATOR_PATH;
180-
softwareProcessStartInfo.Arguments = GetOldCPUSimulatorProcessStartInfoArguments(oldCPUSimulatorElement, oldCPUSimulatorSoftware).ToString();
179+
softwareProcessStartInfo.Arguments = GetOldCPUSimulatorProcessStartInfoArguments(oldCPUSimulatorElement, software).ToString();
181180
//softwareProcessStartInfo.RedirectStandardError = true;
182181
softwareProcessStartInfo.RedirectStandardError = false;
183182
softwareProcessStartInfo.RedirectStandardOutput = false;

FlashpointSecurePlayer/Shared.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3051,7 +3051,10 @@ public static string GetArgumentSliceFromCommandLine(string commandLine, int beg
30513051
return argumentSlice;
30523052
}
30533053

3054-
public static StringBuilder GetOldCPUSimulatorProcessStartInfoArguments(FlashpointSecurePlayerSection.TemplatesElementCollection.TemplateElement.ModificationsElement.OldCPUSimulatorElement oldCPUSimulatorElement, StringBuilder software) {
3054+
public static StringBuilder GetOldCPUSimulatorProcessStartInfoArguments(
3055+
FlashpointSecurePlayerSection.TemplatesElementCollection.TemplateElement.ModificationsElement.OldCPUSimulatorElement oldCPUSimulatorElement,
3056+
StringBuilder software
3057+
) {
30553058
StringBuilder oldCPUSimulatorProcessStartInfoArguments = new StringBuilder("-t ");
30563059

30573060
if (!int.TryParse(Environment.ExpandEnvironmentVariables(oldCPUSimulatorElement.TargetRate), out int targetRate)) {

0 commit comments

Comments
 (0)