- WIP Asset Browser.
- fix for some modes without textures [`SR`] - AssetMap new mode (Minimal/Full).
This commit is contained in:
37
AssetStudio/ResourceMap.cs
Normal file
37
AssetStudio/ResourceMap.cs
Normal file
@@ -0,0 +1,37 @@
|
||||
using MessagePack;
|
||||
using System;
|
||||
using System.IO;
|
||||
|
||||
namespace AssetStudio
|
||||
{
|
||||
public static class ResourceMap
|
||||
{
|
||||
private static AssetMap Instance;
|
||||
public static AssetEntry[] GetEntries() => Instance.AssetEntries;
|
||||
public static void FromFile(string path)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(path))
|
||||
{
|
||||
Logger.Info(string.Format("Parsing...."));
|
||||
try
|
||||
{
|
||||
using var stream = File.OpenRead(path);
|
||||
Instance = MessagePackSerializer.Deserialize<AssetMap>(stream, MessagePackSerializerOptions.Standard.WithCompression(MessagePackCompression.Lz4BlockArray));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Logger.Error("AssetMap was not loaded");
|
||||
Console.WriteLine(e.ToString());
|
||||
return;
|
||||
}
|
||||
Logger.Info("Loaded !!");
|
||||
}
|
||||
}
|
||||
|
||||
public static void Clear()
|
||||
{
|
||||
Instance.GameType = GameType.Normal;
|
||||
Instance.AssetEntries = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user