public async Task <(string convertedFile, string?configFile)> ConvertToTarget( FileType fileType, string sourceFile, IPackFileInfo?fileInfo ) { if (!File.Exists(sourceFile)) { throw new FileNotFoundException("File not found", sourceFile); } string targetFile = _sessionHelper.GenerateNonExistentFilePath(); IOUtils.EnsureParentDirExists(targetFile); // config string?configFile = null; if (fileInfo != null) { configFile = _sessionHelper.GenerateNonExistentFilePath(); await File.WriteAllTextAsync( configFile, fileType switch { FileType.Texture => SerializeFileInfo((TextureFileInfo)fileInfo), FileType.Map => SerializeFileInfo((MapFileInfo)fileInfo), FileType.Character => SerializeFileInfo((CharacterFileInfo)fileInfo), FileType.Gui => SerializeFileInfo((GuiFileInfo)fileInfo), FileType.Translation => SerializeFileInfo((TranslationFileInfo)fileInfo), FileType.Font => SerializeFileInfo((FontFileInfo)fileInfo), FileType.Audio => SerializeFileInfo((AudioFileInfo)fileInfo), _ => throw new ArgumentOutOfRangeException(nameof(fileType), fileType, null) }