Compare commits
No commits in common. "19abc3db90f570eed2fc89e1007ed416c0a44a3a" and "12a544b6df5f638e26b5f18831d055dd8b261621" have entirely different histories.
19abc3db90
...
12a544b6df
@ -6,140 +6,140 @@ namespace EscudeTools
|
|||||||
{
|
{
|
||||||
static void Main(string[] args)
|
static void Main(string[] args)
|
||||||
{
|
{
|
||||||
//批量处理EV/ST
|
////批量处理EV/ST
|
||||||
if (Directory.Exists(args[0]) && File.Exists(args[1]))
|
//if (Directory.Exists(args[0]) && File.Exists(args[1]))
|
||||||
//if (File.Exists(args[0]))
|
////if (File.Exists(args[0]))
|
||||||
{
|
//{
|
||||||
string graphicsDBPath = args[1];
|
// string graphicsDBPath = args[1];
|
||||||
using SqliteConnection connection = new($"Data Source={graphicsDBPath};");
|
// using SqliteConnection connection = new($"Data Source={graphicsDBPath};");
|
||||||
connection.Open();
|
// connection.Open();
|
||||||
List<string> tableNames = [];
|
// List<string> tableNames = [];
|
||||||
string[] foundTN = new string[3];
|
// string[] foundTN = new string[3];
|
||||||
List<int> tableIds = [];
|
// List<int> tableIds = [];
|
||||||
bool found1 = false, found2 = false, found3 = false;
|
// bool found1 = false, found2 = false, found3 = false;
|
||||||
using (var command = new SqliteCommand("SELECT name FROM sqlite_master WHERE type='table';", connection))
|
// using (var command = new SqliteCommand("SELECT name FROM sqlite_master WHERE type='table';", connection))
|
||||||
using (var reader = command.ExecuteReader())
|
// using (var reader = command.ExecuteReader())
|
||||||
{
|
// {
|
||||||
int id = 0;
|
// int id = 0;
|
||||||
while (reader.Read())
|
// while (reader.Read())
|
||||||
{
|
// {
|
||||||
string tableName = reader.GetString(0);
|
// string tableName = reader.GetString(0);
|
||||||
if (tableName.StartsWith("イベント"))
|
// if (tableName.StartsWith("イベント"))
|
||||||
{
|
// {
|
||||||
foundTN[0] = tableName;
|
// foundTN[0] = tableName;
|
||||||
found1 = true;
|
// found1 = true;
|
||||||
}
|
// }
|
||||||
else if (tableName.StartsWith("立ち"))
|
// else if (tableName.StartsWith("立ち"))
|
||||||
{
|
// {
|
||||||
foundTN[1] = tableName;
|
// foundTN[1] = tableName;
|
||||||
found2 = true;
|
// found2 = true;
|
||||||
}
|
// }
|
||||||
else if (tableName.StartsWith("表情"))
|
// else if (tableName.StartsWith("表情"))
|
||||||
{
|
// {
|
||||||
foundTN[2] = tableName;
|
// foundTN[2] = tableName;
|
||||||
found3 = true;
|
// found3 = true;
|
||||||
}
|
// }
|
||||||
tableNames.Add(tableName);
|
// tableNames.Add(tableName);
|
||||||
tableIds.Add(id++);
|
// tableIds.Add(id++);
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
if (!(found1 && found2 && found3)) //这里的代码未经测试
|
// if (!(found1 && found2 && found3)) //这里的代码未经测试
|
||||||
{
|
// {
|
||||||
for (int i = 0; i < tableNames.Count; i++)
|
// for (int i = 0; i < tableNames.Count; i++)
|
||||||
Console.WriteLine($"{tableIds[i]}: {tableNames[i]}");
|
// Console.WriteLine($"{tableIds[i]}: {tableNames[i]}");
|
||||||
if (!found1)
|
// if (!found1)
|
||||||
{
|
// {
|
||||||
Console.WriteLine("自动识别失败,请选择存放CG信息的数据表ID: ");
|
// Console.WriteLine("自动识别失败,请选择存放CG信息的数据表ID: ");
|
||||||
string? input = Console.ReadLine();
|
// string? input = Console.ReadLine();
|
||||||
if (int.TryParse(input, out int userInputId))
|
// if (int.TryParse(input, out int userInputId))
|
||||||
{
|
// {
|
||||||
if (userInputId >= 0 && userInputId < tableIds.Count)
|
// if (userInputId >= 0 && userInputId < tableIds.Count)
|
||||||
{
|
// {
|
||||||
foundTN[0] = tableNames[userInputId];
|
// foundTN[0] = tableNames[userInputId];
|
||||||
}
|
// }
|
||||||
else
|
// else
|
||||||
{
|
// {
|
||||||
Console.WriteLine("Invalid ID.");
|
// Console.WriteLine("Invalid ID.");
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
else
|
// else
|
||||||
{
|
// {
|
||||||
Console.WriteLine("Invalid input. Please enter a valid number.");
|
// Console.WriteLine("Invalid input. Please enter a valid number.");
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
if (!found2)
|
// if (!found2)
|
||||||
{
|
// {
|
||||||
Console.WriteLine("自动识别失败,请选择存放立绘信息的数据表ID: ");
|
// Console.WriteLine("自动识别失败,请选择存放立绘信息的数据表ID: ");
|
||||||
string? input = Console.ReadLine();
|
// string? input = Console.ReadLine();
|
||||||
if (int.TryParse(input, out int userInputId))
|
// if (int.TryParse(input, out int userInputId))
|
||||||
{
|
// {
|
||||||
if (userInputId >= 0 && userInputId < tableIds.Count)
|
// if (userInputId >= 0 && userInputId < tableIds.Count)
|
||||||
{
|
// {
|
||||||
foundTN[1] = tableNames[userInputId];
|
// foundTN[1] = tableNames[userInputId];
|
||||||
}
|
// }
|
||||||
else
|
// else
|
||||||
{
|
// {
|
||||||
Console.WriteLine("Invalid ID.");
|
// Console.WriteLine("Invalid ID.");
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
else
|
// else
|
||||||
{
|
// {
|
||||||
Console.WriteLine("Invalid input. Please enter a valid number.");
|
// Console.WriteLine("Invalid input. Please enter a valid number.");
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
if (!found3)
|
// if (!found3)
|
||||||
{
|
// {
|
||||||
Console.WriteLine("自动识别失败,请选择存放表情信息的数据表ID: ");
|
// Console.WriteLine("自动识别失败,请选择存放表情信息的数据表ID: ");
|
||||||
string? input = Console.ReadLine();
|
// string? input = Console.ReadLine();
|
||||||
if (int.TryParse(input, out int userInputId))
|
// if (int.TryParse(input, out int userInputId))
|
||||||
{
|
// {
|
||||||
if (userInputId >= 0 && userInputId < tableIds.Count)
|
// if (userInputId >= 0 && userInputId < tableIds.Count)
|
||||||
{
|
// {
|
||||||
foundTN[2] = tableNames[userInputId];
|
// foundTN[2] = tableNames[userInputId];
|
||||||
}
|
// }
|
||||||
else
|
// else
|
||||||
{
|
// {
|
||||||
Console.WriteLine("Invalid ID.");
|
// Console.WriteLine("Invalid ID.");
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
else
|
// else
|
||||||
{
|
// {
|
||||||
Console.WriteLine("Invalid input. Please enter a valid number.");
|
// Console.WriteLine("Invalid input. Please enter a valid number.");
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
}
|
// }
|
||||||
List<EvTable> evts = [];
|
// List<EvTable> evts = [];
|
||||||
// List<StTable> stts = [];
|
// List<StTable> stts = [];
|
||||||
Face[] faces = new Face[32];
|
// Face[] faces = new Face[32];
|
||||||
using (var command = new SqliteCommand($"SELECT * FROM {foundTN[0]};", connection))
|
// using (var command = new SqliteCommand($"SELECT * FROM {foundTN[0]};", connection))
|
||||||
{
|
// {
|
||||||
using var reader = command.ExecuteReader();
|
// using var reader = command.ExecuteReader();
|
||||||
while (reader.Read())
|
// while (reader.Read())
|
||||||
{
|
// {
|
||||||
if (reader.IsDBNull(0) || string.IsNullOrEmpty(reader.GetString(0)))
|
// if (reader.IsDBNull(0) || string.IsNullOrEmpty(reader.GetString(0)))
|
||||||
continue;
|
// continue;
|
||||||
evts.Add(new EvTable
|
// evts.Add(new EvTable
|
||||||
{
|
// {
|
||||||
name = reader.GetString(0),
|
// name = reader.GetString(0),
|
||||||
file = reader.GetString(1),
|
// file = reader.GetString(1),
|
||||||
option = reader.GetString(2).Split(' '),
|
// option = reader.GetString(2).Split(' '),
|
||||||
coverd = (uint)reader.GetInt32(3),
|
// coverd = (uint)reader.GetInt32(3),
|
||||||
filter = (uint)reader.GetInt32(4),
|
// filter = (uint)reader.GetInt32(4),
|
||||||
// color = (uint)reader.GetInt32(5),
|
// color = (uint)reader.GetInt32(5),
|
||||||
id = (uint)reader.GetInt32(5),
|
// id = (uint)reader.GetInt32(6),
|
||||||
loc = (uint)reader.GetInt32(6),
|
// loc = (uint)reader.GetInt32(7),
|
||||||
order = reader.GetInt32(7),
|
// order = reader.GetInt32(8),
|
||||||
link = (uint)reader.GetInt32(8)
|
// link = (uint)reader.GetInt32(9)
|
||||||
});
|
// });
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
// using (var command = new SqliteCommand($"SELECT * FROM {foundTN[1]};", connection))
|
// using (var command = new SqliteCommand($"SELECT * FROM {foundTN[1]};", connection))
|
||||||
// {
|
// {
|
||||||
// using var reader = command.ExecuteReader();
|
// using var reader = command.ExecuteReader();
|
||||||
@ -179,25 +179,25 @@ namespace EscudeTools
|
|||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
|
||||||
string[] files = Directory.GetFiles(args[0], "*.lsf", SearchOption.AllDirectories);
|
// string[] files = Directory.GetFiles(args[0], "*.lsf", SearchOption.AllDirectories);
|
||||||
LsfManager lm = new();
|
// LsfManager lm = new();
|
||||||
foreach (string file in files)
|
// foreach (string file in files)
|
||||||
{
|
// {
|
||||||
if (lm.LoadLsf(file, true))
|
// if (lm.LoadLsf(file, true))
|
||||||
Console.WriteLine($"Load {file} Success");
|
// Console.WriteLine($"Load {file} Success");
|
||||||
else
|
// else
|
||||||
{
|
// {
|
||||||
Console.WriteLine($"Load {file} Failed");
|
// Console.WriteLine($"Load {file} Failed");
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
connection.Close();
|
// connection.Close();
|
||||||
string outputDir = Path.Combine(Path.GetDirectoryName(args[0]), "Output");
|
// string outputDir = Path.Combine(Path.GetDirectoryName(args[0]), "Output");
|
||||||
if (!Directory.Exists(outputDir))
|
// if (!Directory.Exists(outputDir))
|
||||||
Directory.CreateDirectory(outputDir);
|
// Directory.CreateDirectory(outputDir);
|
||||||
var parallelOptions = new ParallelOptions
|
// var parallelOptions = new ParallelOptions
|
||||||
{
|
// {
|
||||||
MaxDegreeOfParallelism = 6 // 设置最大并行线程数
|
// MaxDegreeOfParallelism = 6 // 设置最大并行线程数
|
||||||
};
|
// };
|
||||||
|
|
||||||
// //ST //表情还要另取?
|
// //ST //表情还要另取?
|
||||||
// Parallel.ForEach(stts, parallelOptions, stt =>
|
// Parallel.ForEach(stts, parallelOptions, stt =>
|
||||||
@ -238,38 +238,38 @@ namespace EscudeTools
|
|||||||
// });
|
// });
|
||||||
////}
|
////}
|
||||||
|
|
||||||
//EV
|
// //EV
|
||||||
Parallel.ForEach(evts, parallelOptions, evt =>
|
// Parallel.ForEach(evts, parallelOptions, evt =>
|
||||||
//foreach (EvTable evt in evts)
|
// //foreach (EvTable evt in evts)
|
||||||
{
|
// {
|
||||||
if (evt.order == 0) //仅提取鉴赏中有的CG
|
// if (evt.order == 0) //仅提取鉴赏中有的CG
|
||||||
return;
|
// return;
|
||||||
|
// //continue;
|
||||||
|
// string targetFilename = Path.Combine(outputDir, evt.name + ".png"); //最后保存可用的文件名
|
||||||
|
// LsfData lsfData = lm.FindLsfDataByName(evt.file) ?? throw new Exception("Something Wrong");
|
||||||
|
// List<int> pendingList = [];
|
||||||
|
// List<string> pendingListFn = [];
|
||||||
|
// foreach (string o in evt.option)
|
||||||
|
// {
|
||||||
|
// List<int> t = TableManagercs.ParseOptions(lsfData, o);
|
||||||
|
// if (t.Count == 0)
|
||||||
// continue;
|
// continue;
|
||||||
string targetFilename = Path.Combine(outputDir, evt.name + ".png"); //最后保存可用的文件名
|
// pendingList.AddRange(t);
|
||||||
LsfData lsfData = lm.FindLsfDataByName(evt.file) ?? throw new Exception("Something Wrong");
|
// foreach (int i in t)
|
||||||
List<int> pendingList = [];
|
// {
|
||||||
List<string> pendingListFn = [];
|
// pendingListFn.Add(lsfData.lli[i].nameStr);
|
||||||
foreach (string o in evt.option)
|
// }
|
||||||
{
|
// }
|
||||||
List<int> t = TableManagercs.ParseOptions(lsfData, o);
|
// pendingList = TableManagercs.OrderLayer(pendingList, pendingListFn);
|
||||||
if (t.Count == 0)
|
// if (pendingList[0] != 0)
|
||||||
continue;
|
// pendingList.Insert(0, 0);
|
||||||
pendingList.AddRange(t);
|
// if (!ImageManager.Process(lsfData, [.. pendingList], targetFilename))
|
||||||
foreach (int i in t)
|
// throw new Exception("Process Fail");
|
||||||
{
|
// else
|
||||||
pendingListFn.Add(lsfData.lli[i].nameStr);
|
// Console.WriteLine($"Export {evt.name} Success");
|
||||||
}
|
// });
|
||||||
}
|
// //}
|
||||||
pendingList = TableManagercs.OrderLayer(pendingList, pendingListFn);
|
|
||||||
if (pendingList[0] != 0)
|
|
||||||
pendingList.Insert(0, 0);
|
|
||||||
if (!ImageManager.Process(lsfData, [.. pendingList], targetFilename))
|
|
||||||
throw new Exception("Process Fail");
|
|
||||||
else
|
|
||||||
Console.WriteLine($"Export {evt.name} Success");
|
|
||||||
});
|
|
||||||
//}
|
//}
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
"profiles": {
|
"profiles": {
|
||||||
"EscudeTools": {
|
"EscudeTools": {
|
||||||
"commandName": "Project",
|
"commandName": "Project",
|
||||||
"commandLineArgs": "G:\\x221.local\\lab3\\Haison\\output\\ev\\1\r\n\"G:\\x221.local\\lab3\\Haison\\output\\ev\\db_graphics.db\""
|
"commandLineArgs": "G:\\x221.local\\lab3\\Haison\\output\\data"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user