/// <summary> /// Loads and decompiles the FES screen script entry and outputs it to the specified stream. /// </summary> /// <param name="entry">The entry to extract from.</param> /// <param name="outStream">The output stream to write the decompiled script to.</param> /// <param name="encoding">The output encoding, <see cref="CatUtils.ShiftJIS"/> if null.</param> /// /// <exception cref="ArgumentNullException"> /// <paramref name="entry"/> or <paramref name="outStream"/> is null. /// </exception> public static void DecompileScreenToStream(this KifintEntry entry, Stream outStream, Encoding encoding = null) { if (entry == null) { throw new ArgumentNullException(nameof(entry)); } using (var stream = entry.ExtractToStream()) FesScreen.DecompileToStream(stream, entry.FileName, outStream, encoding); }
/// <summary> /// Loads and decompiles the FES screen script entry and returns the script as a string. /// </summary> /// <param name="entry">The entry to extract from.</param> /// <param name="kifintStream">The stream to the open KIFINT archive.</param> /// <returns>The decompiled script.</returns> /// /// <exception cref="ArgumentNullException"> /// <paramref name="entry"/> or <paramref name="kifintStream"/> is null. /// </exception> public static string DecompileScreen(this KifintEntry entry, KifintStream kifintStream) { if (entry == null) { throw new ArgumentNullException(nameof(entry)); } using (var stream = entry.ExtractToStream(kifintStream)) return(FesScreen.Decompile(stream, entry.FileName)); }
/// <summary> /// Extracts the FES screen script from the entry. /// </summary> /// <param name="entry">The entry to extract from.</param> /// <returns>The extracted screen script.</returns> /// /// <exception cref="ArgumentNullException"> /// <paramref name="entry"/> is null. /// </exception> public static FesScreen ExtractScreen(this KifintEntry entry) { if (entry == null) { throw new ArgumentNullException(nameof(entry)); } using (var stream = entry.ExtractToStream()) return(FesScreen.Extract(stream, entry.FileName)); }