mirror of
https://github.com/crskycode/GARbro.git
synced 2026-06-27 14:18:06 +08:00
Add scheme tool
This commit is contained in:
49
SchemeTool/Program.cs
Normal file
49
SchemeTool/Program.cs
Normal file
@@ -0,0 +1,49 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace SchemeTool
|
||||
{
|
||||
class Program
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
// Load database
|
||||
using (Stream stream = File.OpenRead(".\\GameData\\Formats.dat"))
|
||||
{
|
||||
GameRes.FormatCatalog.Instance.DeserializeScheme(stream);
|
||||
}
|
||||
|
||||
GameRes.Formats.KiriKiri.Xp3Opener format = GameRes.FormatCatalog.Instance.ArcFormats
|
||||
.FirstOrDefault(a => a is GameRes.Formats.KiriKiri.Xp3Opener) as GameRes.Formats.KiriKiri.Xp3Opener;
|
||||
|
||||
if (format != null)
|
||||
{
|
||||
GameRes.Formats.KiriKiri.Xp3Scheme scheme = format.Scheme as GameRes.Formats.KiriKiri.Xp3Scheme;
|
||||
|
||||
// Add scheme information here
|
||||
GameRes.Formats.KiriKiri.ICrypt crypt = new GameRes.Formats.KiriKiri.XorCrypt(0x00);
|
||||
|
||||
scheme.KnownSchemes.Add("game title", crypt);
|
||||
}
|
||||
|
||||
var gameMap = typeof(GameRes.FormatCatalog).GetField("m_game_map", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic)
|
||||
.GetValue(GameRes.FormatCatalog.Instance) as Dictionary<string, string>;
|
||||
|
||||
if (gameMap != null)
|
||||
{
|
||||
// Add file name here
|
||||
gameMap.Add("file.exe", "game title");
|
||||
}
|
||||
|
||||
// Save database
|
||||
using (Stream stream = File.Create(".\\GameData\\Formats.dat"))
|
||||
{
|
||||
GameRes.FormatCatalog.Instance.SerializeScheme(stream);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user