PinkConnection2/rshw2sst/RSHWFile.cs
Persephone Bubblegum-Holiday 284cf95265 Add Software
2025-03-31 18:26:04 -07:00

31 lines
847 B
C#

using System.IO;
using System.Reflection;
using System.Runtime.Serialization.Formatters.Binary;
sealed class AntiUnityBinder : System.Runtime.Serialization.SerializationBinder
{
public override Type BindToType(string assemblyName, string typeName)
{
return Type.GetType(String.Format("RSHWFile, " + Assembly.GetExecutingAssembly().FullName));
}
}
[System.Serializable]
public class RSHWFile
{
public byte[]? audioData { get; set; }
public int[]? signalData { get; set; }
public byte[]? videoData { get; set; }
}
public class RSHWLoader
{
public static RSHWFile Load(string path)
{
BinaryFormatter formatter = new BinaryFormatter();
formatter.Binder = new AntiUnityBinder();
FileStream stream = File.OpenRead(path);
return (RSHWFile)formatter.Deserialize(stream);
}
}