Compare commits

..

2 Commits

Author SHA1 Message Date
19abc3db90
初步支持旧作 廃村少女 ~妖し惑ひの籠の郷~ 2024-10-26 23:21:52 +08:00
390a4614b3
update 2024-10-26 22:58:01 +08:00
2 changed files with 261 additions and 261 deletions

View File

@ -6,142 +6,142 @@ 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(6), id = (uint)reader.GetInt32(5),
// loc = (uint)reader.GetInt32(7), loc = (uint)reader.GetInt32(6),
// order = reader.GetInt32(8), order = reader.GetInt32(7),
// link = (uint)reader.GetInt32(9) link = (uint)reader.GetInt32(8)
// }); });
// } }
// } }
// 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();
// while (reader.Read()) // while (reader.Read())
// { // {
@ -161,9 +161,9 @@ namespace EscudeTools
// link = (uint)reader.GetInt32(9) // link = (uint)reader.GetInt32(9)
// }); // });
// } // }
// } //}
// using (var command = new SqliteCommand($"SELECT * FROM {foundTN[2]};", connection)) //using (var command = new SqliteCommand($"SELECT * FROM {foundTN[2]};", connection))
// { //{
// using var reader = command.ExecuteReader(); // using var reader = command.ExecuteReader();
// while (reader.Read()) // while (reader.Read())
// { // {
@ -177,27 +177,27 @@ namespace EscudeTools
// faces[i].faceOptions.Add(reader.GetString(1)); // faces[i].faceOptions.Add(reader.GetString(1));
// } // }
// } // }
// } //}
// 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; //continue;
// string targetFilename = Path.Combine(outputDir, evt.name + ".png"); //最后保存可用的文件名 string targetFilename = Path.Combine(outputDir, evt.name + ".png"); //最后保存可用的文件名
// LsfData lsfData = lm.FindLsfDataByName(evt.file) ?? throw new Exception("Something Wrong"); LsfData lsfData = lm.FindLsfDataByName(evt.file) ?? throw new Exception("Something Wrong");
// List<int> pendingList = []; List<int> pendingList = [];
// List<string> pendingListFn = []; List<string> pendingListFn = [];
// foreach (string o in evt.option) foreach (string o in evt.option)
// { {
// List<int> t = TableManagercs.ParseOptions(lsfData, o); List<int> t = TableManagercs.ParseOptions(lsfData, o);
// if (t.Count == 0) if (t.Count == 0)
// continue; continue;
// pendingList.AddRange(t); pendingList.AddRange(t);
// foreach (int i in t) foreach (int i in t)
// { {
// pendingListFn.Add(lsfData.lli[i].nameStr); pendingListFn.Add(lsfData.lli[i].nameStr);
// } }
// } }
// pendingList = TableManagercs.OrderLayer(pendingList, pendingListFn); pendingList = TableManagercs.OrderLayer(pendingList, pendingListFn);
// if (pendingList[0] != 0) if (pendingList[0] != 0)
// pendingList.Insert(0, 0); pendingList.Insert(0, 0);
// if (!ImageManager.Process(lsfData, [.. pendingList], targetFilename)) if (!ImageManager.Process(lsfData, [.. pendingList], targetFilename))
// throw new Exception("Process Fail"); throw new Exception("Process Fail");
// else else
// Console.WriteLine($"Export {evt.name} Success"); Console.WriteLine($"Export {evt.name} Success");
// }); });
// //}
//} //}
}

View File

@ -2,7 +2,7 @@
"profiles": { "profiles": {
"EscudeTools": { "EscudeTools": {
"commandName": "Project", "commandName": "Project",
"commandLineArgs": "G:\\x221.local\\lab3\\Haison\\output\\data" "commandLineArgs": "G:\\x221.local\\lab3\\Haison\\output\\ev\\1\r\n\"G:\\x221.local\\lab3\\Haison\\output\\ev\\db_graphics.db\""
} }
} }
} }