修复明显的错误,仍然存在bug

除导出type1外其他测试通过
This commit is contained in:
Chenx221 2024-10-19 00:15:39 +08:00
parent 206999c456
commit 4ad356f145
3 changed files with 73 additions and 44 deletions

View File

@ -52,45 +52,64 @@
//}
//Batch Unpack Script(Full, Text, Mess)
if (Directory.Exists(args[0]))
{
string[] files = Directory.GetFiles(args[0], "*.bin");
foreach (string file in files)
{
ScriptManager smr = new();
if (smr.LoadScriptFile(file))
{
Console.WriteLine($"Load {file} Success");
}
else
{
Console.WriteLine($"Load {file} Failed");
return;
}
if (smr.ExportDatabase(Path.GetDirectoryName(args[0])))
Console.WriteLine("Export Script Success");
else
{
Console.WriteLine("Export Script Failed");
return;
}
if (smr.ExportTextDatabase(Path.GetDirectoryName(args[0])))
Console.WriteLine("Export Text Success");
else
{
Console.WriteLine("Export Text Failed");
return;
}
if (smr.ExportMessDatabase(Path.GetDirectoryName(args[0])))
Console.WriteLine("Export Mess Success");
else
{
Console.WriteLine("Export Mess Failed");
return;
}
}
}
////Batch Unpack Script(Full, Text, Mess)
//if (Directory.Exists(args[0]))
//{
// string[] files = Directory.GetFiles(args[0], "*.bin");
// foreach (string file in files)
// {
// ScriptManager smr = new();
// if (smr.LoadScriptFile(file))
// {
// Console.WriteLine($"Load {file} Success");
// }
// else
// {
// Console.WriteLine($"Load {file} Failed");
// return;
// }
// if (smr.ExportDatabase(Path.GetDirectoryName(args[0])))
// Console.WriteLine("Export Script Success");
// else
// {
// Console.WriteLine("Export Script Failed");
// return;
// }
// if (smr.ExportTextDatabase(Path.GetDirectoryName(args[0])))
// Console.WriteLine("Export Text Success");
// else
// {
// Console.WriteLine("Export Text Failed");
// return;
// }
// if (smr.ExportMessDatabase(Path.GetDirectoryName(args[0])))
// Console.WriteLine("Export Mess Success");
// else
// {
// Console.WriteLine("Export Mess Failed");
// return;
// }
// }
//}
////Export Script Type 1
//if (File.Exists(args[0])) //fail //lost 1 //something diff
//{
// ScriptManager.Repackv1(args[0], true);
//}
////Export Script Type 2
//if (File.Exists(args[0])) //pass
//{
// ScriptManager.Repackv2(args[0], true);
//}
////Export Script Type 3
//if (File.Exists(args[0])) //pass
//{
// ScriptManager.Repackv3(args[0]);
//}
//ScriptManager smr = new();

View File

@ -2,7 +2,7 @@
"profiles": {
"EscudeTools": {
"commandName": "Project",
"commandLineArgs": "G:\\x221.local\\lab\\test1\\script"
"commandLineArgs": "\"G:\\x221.local\\lab\\test1\\type3\\script_text.db\""
}
}
}

View File

@ -321,9 +321,9 @@ namespace EscudeTools
foreach (string ts in sf.TextString)
{
insertCmd.Parameters.Clear();
insertCmd.Parameters.AddWithValue("@Text", ts ?? "");
insertCmd.ExecuteNonQuery();
insertCmdSub.Parameters.Clear();
insertCmdSub.Parameters.AddWithValue("@Text", ts ?? "");
insertCmdSub.ExecuteNonQuery();
}
transaction.Commit();
@ -427,6 +427,9 @@ namespace EscudeTools
Encoding? shiftJis = provider.GetEncoding("shift-jis");
foreach (var tableName in tableNames)
{
string folder = Path.Combine(Path.GetDirectoryName(sqlitePath), "repack");
if (!Directory.Exists(folder))
Directory.CreateDirectory(folder);
string outputPath = Path.Combine(Path.GetDirectoryName(sqlitePath), "repack", tableName + ".bin");
using FileStream fs = new(outputPath, FileMode.Create);
using BinaryWriter bw = new(fs);
@ -436,6 +439,7 @@ namespace EscudeTools
TextCount = 0,
TextSize = 0,
MessCount = 0,
Commands = []
};
uint Offset = 0;
List<uint> messOffset = new();
@ -603,6 +607,9 @@ namespace EscudeTools
Encoding? shiftJis = provider.GetEncoding("shift-jis");
foreach (var tableName in tableNames)
{
string folder = Path.Combine(Path.GetDirectoryName(sqlitePath), "repack");
if (!Directory.Exists(folder))
Directory.CreateDirectory(folder);
string outputPath = Path.Combine(Path.GetDirectoryName(sqlitePath), "repack", tableName + ".001");
using FileStream fs = new(outputPath, FileMode.Create);
using BinaryWriter bw = new(fs);
@ -694,7 +701,7 @@ namespace EscudeTools
return true;
}
public static bool Repackv3(string sqlitePath, bool scramble = true)
public static bool Repackv3(string sqlitePath)
{
if (!File.Exists(sqlitePath))
return false;
@ -714,6 +721,9 @@ namespace EscudeTools
Encoding? shiftJis = provider.GetEncoding("shift-jis");
foreach (var tableName in tableNames)
{
string folder = Path.Combine(Path.GetDirectoryName(sqlitePath), "repack");
if (!Directory.Exists(folder))
Directory.CreateDirectory(folder);
string outputPath = Path.Combine(Path.GetDirectoryName(sqlitePath), "repack", tableName + ".bin");
using FileStream fs = new(outputPath, FileMode.Create);
using BinaryWriter bw = new(fs);