Skip to content

Commit

Permalink
updated some method summaries
Browse files Browse the repository at this point in the history
forgot to change some of the ones I copypasted from bf
  • Loading branch information
Secre-C committed Dec 23, 2023
1 parent a811576 commit b2de507
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public interface ISpdEmulator
public bool TryCreateFromFileSlice(string sourcePath, long offset, string route, string destinationPath);

/// <summary>
/// Tries to create an emulated SPD file by compiling any applicable flow files using the input as the basee
/// Tries to create an emulated SPD file by merging any applicable sprite or texture files, using the input as the base
/// </summary>
/// <param name="sourcePath">Path to the SPD file to use as a base.</param>
/// <param name="route">The route of the emulated SPD file.</param>
Expand Down
6 changes: 3 additions & 3 deletions Emulator/SPD.File.Emulator/SpdEmulator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,10 @@ private void DumpFile(string filepath, MultiStream stream)
}

/// <summary>
/// Invalidates a BF file with a specified name.
/// Invalidates a SPD file with a specified name.
/// </summary>
/// <param name="bfPath">Full path to the file.</param>
public void UnregisterFile(string bfPath) => _pathToStream.Remove(bfPath, out _);
/// <param name="spdPath">Full path to the file.</param>
public void UnregisterFile(string spdPath) => _pathToStream.Remove(spdPath, out _);

public void RegisterFile(string destinationPath, Stream stream)
{
Expand Down
10 changes: 6 additions & 4 deletions Emulator/SPD.File.Emulator/SpdEmulatorApi.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
using FileEmulationFramework.Interfaces;
using FileEmulationFramework.Interfaces.Reference;
using FileEmulationFramework.Lib.Utilities;
using Microsoft.Win32.SafeHandles;
using SPD.File.Emulator.Interfaces;
using SPD.File.Emulator.Interfaces.Structures.IO;
using SPD.File.Emulator.Utilities;
using System.Runtime.InteropServices;

namespace SPD.File.Emulator;
Expand Down Expand Up @@ -96,10 +96,12 @@ public void RegisterSpd(string sourcePath, string destinationPath)

_ = Native.SetFilePointerEx(handle, 0, IntPtr.Zero, 0);

var fileStream = new FileStream(new SafeFileHandle(handle, false), FileAccess.Read);
var fileStream = new FileStream(sourcePath, FileMode.Open);
var stream = StreamUtils.CreateMemoryStream(fileStream.Length);
fileStream.CopyTo(stream);

var emulated = new EmulatedFile<Stream>(fileStream);
_spdEmulator.RegisterFile(destinationPath, fileStream);
var emulated = new EmulatedFile<Stream>(stream);
_spdEmulator.RegisterFile(destinationPath, stream);
_framework.RegisterVirtualFile(destinationPath, emulated);

_logger.Info("[SpdEmulatorApi] Registered spd {0} at {1}", sourcePath, destinationPath);
Expand Down

0 comments on commit b2de507

Please sign in to comment.