48 lines
1.4 KiB
C#
48 lines
1.4 KiB
C#
|
|
|
|
// read contents of input folder
|
|
using AssortGenerator.Common.Helpers;
|
|
using DumpCleaner;
|
|
using QuestValidator.Common;
|
|
using QuestValidator.Common.Helpers;
|
|
using QuestValidator.Helpers;
|
|
using System.Text.Json;
|
|
|
|
var inputPath = DiskHelpers.CreateWorkingFolders();
|
|
InputFileHelper.SetInputFiles(inputPath);
|
|
|
|
var filePaths = InputFileHelper.GetInputFilePaths();
|
|
|
|
//create list of paths
|
|
foreach (var path in filePaths)
|
|
{
|
|
var filename = Path.GetFileNameWithoutExtension(path);
|
|
var names = DumpFiles.filenames.FirstOrDefault(x=> filename.StartsWith(x.InputName));
|
|
|
|
if (names == null)
|
|
{
|
|
LoggingHelpers.LogToConsole($"No mapping found for file: {filename} Skipping", ConsoleColor.Yellow);
|
|
continue;
|
|
}
|
|
|
|
var questDataJson = File.ReadAllText(path);
|
|
var dumpFile = JsonSerializer.Deserialize<Dump>(questDataJson);
|
|
|
|
if (dumpFile.data == null)
|
|
{
|
|
LoggingHelpers.LogWarning($"file: {filename} had no data in it, skipping");
|
|
continue;
|
|
}
|
|
|
|
JsonWriter.WriteJson(dumpFile.data, names.OutputFolder, Directory.GetCurrentDirectory(), names.OutputName);
|
|
LoggingHelpers.LogToConsole($"Found file: {filename} wrote file to output folder");
|
|
}
|
|
|
|
|
|
// iterate over paths
|
|
|
|
// check if filename matches a file in a list of files we want
|
|
// it matches: clean up file and output to 'output'
|
|
// get data object from it, save this into new file
|
|
|
|
// doesnt match: ignore it with warning |