31 lines
847 B
C#
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);
|
|
}
|
|
}
|
|
|