/// <summary> /// Loads and decompiles the CST scene script entry and returns the human readable 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 human readable script.</returns> /// /// <exception cref="ArgumentNullException"> /// <paramref name="entry"/> or <paramref name="kifintStream"/> is null. /// </exception> public static string HumanReadableScene(this KifintEntry entry, KifintStream kifintStream) { if (entry == null) { throw new ArgumentNullException(nameof(entry)); } using (var stream = entry.ExtractToStream(kifintStream)) return(CstScene.HumanReadable(stream, entry.FileName)); }
/// <summary> /// Extracts the CST scene script from the entry. /// </summary> /// <param name="entry">The entry to extract from.</param> /// <returns>The extracted scene script.</returns> /// /// <exception cref="ArgumentNullException"> /// <paramref name="entry"/> is null. /// </exception> public static CstScene ExtractScene(this KifintEntry entry) { if (entry == null) { throw new ArgumentNullException(nameof(entry)); } using (var stream = entry.ExtractToStream()) return(CstScene.Extract(stream, entry.FileName)); }
/// <summary> /// Loads and decompiles the CST scene script entry and outputs it to the specified human readable stream. /// </summary> /// <param name="entry">The entry to extract from.</param> /// <param name="outStream">The output stream to write the human readable script to.</param> /// /// <exception cref="ArgumentNullException"> /// <paramref name="entry"/> or <paramref name="outStream"/> is null. /// </exception> public static void HumanReadableSceneToStream(this KifintEntry entry, Stream outStream) { if (entry == null) { throw new ArgumentNullException(nameof(entry)); } using (var stream = entry.ExtractToStream()) CstScene.HumanReadableToStream(stream, entry.FileName, outStream); }
/// <summary> /// Loads and decompiles the CST scene 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 DecompileSceneToStream(this KifintEntry entry, Stream outStream, Encoding encoding = null) { if (entry == null) { throw new ArgumentNullException(nameof(entry)); } using (var stream = entry.ExtractToStream()) CstScene.DecompileToStream(stream, entry.FileName, outStream, encoding); }