This commit is contained in:
Chenx221 2024-10-27 16:48:55 +08:00
parent ea52c2128b
commit c7c17002dd
Signed by: chenx221
GPG Key ID: D7A9EC07024C3021
6 changed files with 74 additions and 28 deletions

View File

@ -3,18 +3,24 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17 # Visual Studio Version 17
VisualStudioVersion = 17.11.35312.102 VisualStudioVersion = 17.11.35312.102
MinimumVisualStudioVersion = 10.0.40219.1 MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EscudeTools", "EscudeTools\EscudeTools.csproj", "{3DD9B6A4-5DD0-43FA-92EF-33DED4622A2B}" Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EscudeTools", "EscudeTools\EscudeTools.csproj", "{3DD9B6A4-5DD0-43FA-92EF-33DED4622A2B}"
EndProject EndProject
Global Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU Debug|Any CPU = Debug|Any CPU
Debug|x64 = Debug|x64
Release|Any CPU = Release|Any CPU Release|Any CPU = Release|Any CPU
Release|x64 = Release|x64
EndGlobalSection EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution GlobalSection(ProjectConfigurationPlatforms) = postSolution
{3DD9B6A4-5DD0-43FA-92EF-33DED4622A2B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {3DD9B6A4-5DD0-43FA-92EF-33DED4622A2B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{3DD9B6A4-5DD0-43FA-92EF-33DED4622A2B}.Debug|Any CPU.Build.0 = Debug|Any CPU {3DD9B6A4-5DD0-43FA-92EF-33DED4622A2B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{3DD9B6A4-5DD0-43FA-92EF-33DED4622A2B}.Debug|x64.ActiveCfg = Debug|x64
{3DD9B6A4-5DD0-43FA-92EF-33DED4622A2B}.Debug|x64.Build.0 = Debug|x64
{3DD9B6A4-5DD0-43FA-92EF-33DED4622A2B}.Release|Any CPU.ActiveCfg = Release|Any CPU {3DD9B6A4-5DD0-43FA-92EF-33DED4622A2B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3DD9B6A4-5DD0-43FA-92EF-33DED4622A2B}.Release|Any CPU.Build.0 = Release|Any CPU {3DD9B6A4-5DD0-43FA-92EF-33DED4622A2B}.Release|Any CPU.Build.0 = Release|Any CPU
{3DD9B6A4-5DD0-43FA-92EF-33DED4622A2B}.Release|x64.ActiveCfg = Release|x64
{3DD9B6A4-5DD0-43FA-92EF-33DED4622A2B}.Release|x64.Build.0 = Release|x64
EndGlobalSection EndGlobalSection
GlobalSection(SolutionProperties) = preSolution GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE HideSolutionNode = FALSE

View File

@ -5,6 +5,23 @@
<TargetFramework>net8.0</TargetFramework> <TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<Platforms>AnyCPU;x64</Platforms>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<DebugType>portable</DebugType>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<DebugType>portable</DebugType>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<DebugType>portable</DebugType>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<DebugType>portable</DebugType>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>

View File

@ -1,4 +1,5 @@
using Microsoft.Data.Sqlite; using Microsoft.Data.Sqlite;
using System.Data;
namespace EscudeTools namespace EscudeTools
{ {
@ -31,6 +32,9 @@ namespace EscudeTools
case "-f": case "-f":
RepackMdb(args[1]); RepackMdb(args[1]);
break; break;
//case "-s1": 这是一个坏主意
// StProcessS1(args[1]);
// break;
default: default:
InvalidArgument(); InvalidArgument();
break; break;
@ -118,6 +122,7 @@ namespace EscudeTools
} }
else else
InvalidArgument(); InvalidArgument();
Console.WriteLine("Press any key to exit.");
Console.ReadKey(); Console.ReadKey();
} }
private static void StProcess(string v1, string v2) private static void StProcess(string v1, string v2)
@ -204,7 +209,7 @@ namespace EscudeTools
} }
List<StTable> stts = []; List<StTable> stts = [];
Face[] faces = new Face[32]; Face[] faces = new Face[32];
using (var command = new SqliteCommand($"SELECT * FROM {foundTN[1]};", 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())
@ -213,20 +218,21 @@ namespace EscudeTools
continue; continue;
stts.Add(new StTable stts.Add(new StTable
{ {
name = reader.GetString(0), name = reader["ID_44"].ToString() ?? "",
file = reader.GetString(1), file = reader["ファイル_44"].ToString() ?? "",
option = reader.GetString(2).Split(' '), option = (reader["オプション_44"].ToString() ?? "").Split(' '),
coverd = (uint)reader.GetInt32(3), //coverd = (uint)reader.GetInt32(3),
filter = (uint)reader.GetInt32(4), //filter = (uint)reader.GetInt32(4),
face = (uint)reader.GetInt32(5), face = (uint)reader.GetInt32("表情_14"),
id = (uint)reader.GetInt32(6), //id = (uint)reader.GetInt32(6),
loc = (uint)reader.GetInt32(7), //loc = (uint)reader.GetInt32(7),
order = reader.GetInt32(8), order = reader.GetInt32("CG鑑賞_14"),
link = (uint)reader.GetInt32(9) //link = (uint)reader.GetInt32(9)
}); });
} }
} }
using (var command = new SqliteCommand($"SELECT * FROM {foundTN[2]};", connection)) List<string> fa = [];
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())
@ -242,7 +248,6 @@ namespace EscudeTools
} }
} }
} }
string[] files = Directory.GetFiles(v1, "*.lsf", SearchOption.AllDirectories); string[] files = Directory.GetFiles(v1, "*.lsf", SearchOption.AllDirectories);
LsfManager lm = new(); LsfManager lm = new();
foreach (string file in files) foreach (string file in files)
@ -258,6 +263,7 @@ namespace EscudeTools
string outputDir = Path.Combine(Path.GetDirectoryName(v1), "Output"); string outputDir = Path.Combine(Path.GetDirectoryName(v1), "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 // 设置最大并行线程数
@ -284,15 +290,21 @@ namespace EscudeTools
pendingListFn.Add(lsfData.lli[i].nameStr); pendingListFn.Add(lsfData.lli[i].nameStr);
} }
} }
pendingList = TableManagercs.OrderLayer(pendingList, pendingListFn); //pendingList = TableManagercs.OrderLayer(pendingList, pendingListFn);
int n = 0; int n = 0;
foreach (string o in faces[(int)stt.face].faceOptions) foreach (string o in faces[(int)stt.face].faceOptions)
{ {
List<int> pendingListCopy = new(pendingList); List<int> pendingListCopy = new(pendingList);
List<string> pendingListFnCopy = new(pendingListFn);
List<int> t = TableManagercs.ParseOptions(lsfData, o); List<int> t = TableManagercs.ParseOptions(lsfData, o);
if (t.Count == 0) if (t.Count == 0)
continue; continue;
foreach (int i in t)
{
pendingListFnCopy.Add(lsfData.lli[i].nameStr);
}
pendingListCopy.AddRange(t); pendingListCopy.AddRange(t);
pendingListCopy = TableManagercs.OrderLayer(pendingListCopy, pendingListFnCopy);
if (!ImageManager.Process(lsfData, [.. pendingListCopy], targetFilename + $"_{n++}.png")) if (!ImageManager.Process(lsfData, [.. pendingListCopy], targetFilename + $"_{n++}.png"))
throw new Exception("Process Fail"); throw new Exception("Process Fail");
else else
@ -368,16 +380,17 @@ namespace EscudeTools
continue; continue;
evts.Add(new EvTable evts.Add(new EvTable
{ {
name = reader.GetString(0), name = reader["ID_44"].ToString() ?? "",
file = reader.GetString(1), file = reader["ファイル_44"].ToString() ?? "",
option = reader.GetString(2).Split(' '), option = (reader["オプション_44"].ToString() ?? "").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(6),
loc = (uint)reader.GetInt32(7), //loc = (uint)reader.GetInt32(7),
order = reader.GetInt32(8), order = reader.GetInt32("CG鑑賞_14"),
link = (uint)reader.GetInt32(9) //link = (uint)reader.GetInt32(9)
//向后兼容,少读点
}); });
} }
} }
@ -655,6 +668,14 @@ namespace EscudeTools
Console.WriteLine("-f: repack SQLite to db_*.bin"); Console.WriteLine("-f: repack SQLite to db_*.bin");
Console.WriteLine("Restores all SQLite databases in the path to db_*.bin files."); Console.WriteLine("Restores all SQLite databases in the path to db_*.bin files.");
Console.WriteLine(); Console.WriteLine();
Console.WriteLine("EscudeTools.exe -c <EvPath> <db_graphics.db Path>");
Console.WriteLine("-c: compose EV image");
Console.WriteLine("Provide a set of EV images of the same size and the db_graphics.db to compose the images.");
Console.WriteLine();
Console.WriteLine("EscudeTools.exe -s <StPath> <db_graphics.db Path>");
Console.WriteLine("-s: compose ST image");
Console.WriteLine("Provide a set of ST images of the same size and the db_graphics.db to compose the images.");
Console.WriteLine();
Console.WriteLine("EscudeTools.exe -h"); Console.WriteLine("EscudeTools.exe -h");
Console.WriteLine("-h: print help info"); Console.WriteLine("-h: print help info");
} }
@ -662,3 +683,4 @@ namespace EscudeTools
} }
} }

View File

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

View File

@ -54,6 +54,8 @@ namespace EscudeTools
} }
} }
} }
if (results.Count == 0)
return [];
List<int> tmp = []; List<int> tmp = [];
List<string> tmpS = []; List<string> tmpS = [];
for (int i = 0; i < ld.lli.Length; i++) for (int i = 0; i < ld.lli.Length; i++)