mirror of
https://github.com/SabreTools/MPF.git
synced 2026-07-02 17:24:48 +00:00
Attempt to write out all information
This commit is contained in:
@@ -209,6 +209,7 @@ namespace DICUI
|
||||
}
|
||||
|
||||
// Invoke the program with all 3 configurations
|
||||
// TODO: Use these outputs for PSX information
|
||||
Process psxt001z = new Process()
|
||||
{
|
||||
StartInfo = new ProcessStartInfo()
|
||||
@@ -244,8 +245,9 @@ namespace DICUI
|
||||
break;
|
||||
}
|
||||
|
||||
// TODO: UNUSED
|
||||
Dictionary<string, string> templateValues = Utilities.ExtractOutputInformation(outputDirectory, outputFilename, selected.Item2, selected.Item3);
|
||||
List<string> formattedValues = Utilities.FormatOutputData(templateValues, selected.Item2, selected.Item3);
|
||||
bool success = Utilities.WriteOutputData(formattedValues);
|
||||
|
||||
btn_Start.IsEnabled = true;
|
||||
}
|
||||
|
||||
33
Utilities.cs
33
Utilities.cs
@@ -1213,5 +1213,38 @@ namespace DICUI
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Write the data to the output folder
|
||||
/// </summary>
|
||||
/// <param name="outputDirectory">Base directory to use</param>
|
||||
/// <param name="outputFilename">Base filename to use</param>
|
||||
/// <param name="lines">Preformatted list of lines to write out to the file</param>
|
||||
/// <returns>True on success, false on error</returns>
|
||||
public static bool WriteOutputData(string outputDirectory, string outputFilename, List<string> lines)
|
||||
{
|
||||
// First, sanitized the output filename to strip off any potential extension
|
||||
outputFilename = Path.GetFileNameWithoutExtension(outputFilename);
|
||||
|
||||
// Now write out to a generic file
|
||||
string combinedBase = Path.Combine(outputDirectory, outputFilename);
|
||||
try
|
||||
{
|
||||
using (StreamWriter sw = new StreamWriter(File.OpenWrite(combinedBase + ".txt")))
|
||||
{
|
||||
foreach (string line in lines)
|
||||
{
|
||||
sw.WriteLine(line);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
// We don't care what the error is right now
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user