diff --git a/source/@MasterVersion.txt b/source/@MasterVersion.txt index d772b23b..7b829b21 100644 --- a/source/@MasterVersion.txt +++ b/source/@MasterVersion.txt @@ -1 +1 @@ -v11.0.8 +v11.1.0 diff --git a/source/ACT.Hojoring.Common/Version.cs b/source/ACT.Hojoring.Common/Version.cs index 4103e05f..75e6a486 100644 --- a/source/ACT.Hojoring.Common/Version.cs +++ b/source/ACT.Hojoring.Common/Version.cs @@ -1,4 +1,4 @@ using System.Reflection; -[assembly: AssemblyVersion("11.0.0.8")] -[assembly: AssemblyFileVersion("11.0.0.8")] +[assembly: AssemblyVersion("11.1.0.0")] +[assembly: AssemblyFileVersion("11.1.0.0")] diff --git a/source/ACT.Hojoring.Shared/AssemblyResolver.cs b/source/ACT.Hojoring.Shared/AssemblyResolver.cs index e4b399e8..dca90b7d 100644 --- a/source/ACT.Hojoring.Shared/AssemblyResolver.cs +++ b/source/ACT.Hojoring.Shared/AssemblyResolver.cs @@ -10,9 +10,15 @@ public static class AssemblyResolver private static bool isConflictChecked = false; private static readonly object ConflictLock = new object(); + // Costuraに埋め込まれているアセンブリ名のリスト + private static readonly HashSet EmbeddedAssemblies = new HashSet(StringComparer.OrdinalIgnoreCase); + public static void Initialize( Func directoryResolver) { + // 埋め込みアセンブリ名をスキャンして収集 + ScanEmbeddedAssemblies(); + DirectoryResolvers.Add(directoryResolver); AppDomain.CurrentDomain.AssemblyResolve += CustomAssemblyResolve; @@ -29,6 +35,63 @@ public static void Initialize( } } + private static void ScanEmbeddedAssemblies() + { + try + { + // 現在のAppDomainにロードされている全アセンブリを走査 + foreach (var asm in AppDomain.CurrentDomain.GetAssemblies()) + { + try + { + var name = asm.GetName().Name; + if (string.IsNullOrEmpty(name)) continue; + + // Hojoring関連アセンブリのみを走査対象にして無関係なスキャンを避ける + if (name.StartsWith("ACT.Hojoring", StringComparison.OrdinalIgnoreCase) || + name.StartsWith("FFXIV.Framework", StringComparison.OrdinalIgnoreCase) || + name.StartsWith("ACT.SpecialSpellTimer", StringComparison.OrdinalIgnoreCase) || + name.StartsWith("ACT.TTSYukkuri", StringComparison.OrdinalIgnoreCase) || + name.StartsWith("ACT.UltraScouter", StringComparison.OrdinalIgnoreCase) || + name.StartsWith("ACT.XIVLog", StringComparison.OrdinalIgnoreCase)) + { + var resourceNames = asm.GetManifestResourceNames(); + if (resourceNames == null) continue; + + foreach (var resName in resourceNames) + { + if (resName.StartsWith("costura.", StringComparison.OrdinalIgnoreCase)) + { + string cleanName = resName.Substring("costura.".Length); + if (cleanName.EndsWith(".dll.compressed", StringComparison.OrdinalIgnoreCase)) + { + cleanName = cleanName.Substring(0, cleanName.Length - ".dll.compressed".Length); + } + else if (cleanName.EndsWith(".dll", StringComparison.OrdinalIgnoreCase)) + { + cleanName = cleanName.Substring(0, cleanName.Length - ".dll".Length); + } + + if (!string.IsNullOrEmpty(cleanName)) + { + EmbeddedAssemblies.Add(cleanName); + } + } + } + } + } + catch + { + // 個別アセンブリのスキャン失敗は無視 + } + } + } + catch + { + // 全体的な例外は無視して安全性を確保 + } + } + private static void CheckConflicts(string baseDir) { try @@ -117,7 +180,7 @@ private static void ShowConflictWarning(List conflicts) $"■ 競合アセンブリの一覧:\n{details}\n\n" + $"【推奨する解決方法】\n" + $"1. ACTの「Plugins」➔「Plugin Listing」タブを開きます。\n" + - $"2. 「ACT.SpecialSpellTimer.dll」や「ACT.TTSYukkuri.dll」などのHojoringプラグインを、右側の『UP (⬆️)』ボタンでリストの最上部(FFXIV_ACT_Plugin.dllのすぐ下)に引き上げてください。\n" + + $"2. 「ACT.SpecialSpellTimer.dll」や「ACT.TTSYukkuri.dll」などのHojoringプラグインを, 右側の『UP (⬆️)』ボタンでリストの最上部(FFXIV_ACT_Plugin.dllのすぐ下)に引き上げてください。\n" + $"3. OverlayPluginやCactbotなどの併用プラグインをすべて最新版にアップデートしてください。\n" + $"4. ACTを再起動してください。"; @@ -149,6 +212,24 @@ private static void ShowConflictWarning(List conflicts) private static Assembly CustomAssemblyResolve(object sender, ResolveEventArgs e) { + try + { + var asmName = new AssemblyName(e.Name); + if (asmName != null && !string.IsNullOrEmpty(asmName.Name)) + { + // Costura埋め込み対象のアセンブリである場合、物理ファイルからのロードを回避する。 + // nullを返すことで.NET FrameworkはCostura自身のハンドラでアセンブリを解決する。 + if (EmbeddedAssemblies.Contains(asmName.Name)) + { + return null; + } + } + } + catch + { + // Ignore + } + var dirs = new List(); foreach (var directoryResolver in DirectoryResolvers) diff --git a/source/ACT.Hojoring.Updater/AtomicUpdater.cs b/source/ACT.Hojoring.Updater/AtomicUpdater.cs index 78121e4d..70865c6b 100644 --- a/source/ACT.Hojoring.Updater/AtomicUpdater.cs +++ b/source/ACT.Hojoring.Updater/AtomicUpdater.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; @@ -92,6 +92,8 @@ private static void ConfigureLogging() public const string OldFileSuffix = ".old"; private static bool executed = false; + + /// /// 現在のプラグインディレクトリから .new ファイルを探し、可能な限り即時置換します。 /// 置換できなかったファイルは自動的に ACT 終了後のバッチ処理に回されます。 @@ -108,7 +110,8 @@ public static void Apply() DeleteOldFiles(targetDir); var newFiles = Directory.GetFiles(targetDir, "*" + NewFileSuffix, SearchOption.AllDirectories); - if (newFiles.Length == 0) return; + var pendingDeletes = Directory.GetFiles(targetDir, "*.pending_delete", SearchOption.AllDirectories); + if (newFiles.Length == 0 && pendingDeletes.Length == 0) return; Log($"[AtomicUpdater] .new files detected. Starting replacement in {targetDir}"); @@ -143,7 +146,7 @@ public static void Apply() } } - if (lockedFiles.Count > 0) + if (lockedFiles.Count > 0 || pendingDeletes.Length > 0) { ScheduleExternalUpdate(lockedFiles); } @@ -167,9 +170,10 @@ public static void RequestExternalUpdate() if (string.IsNullOrEmpty(targetDir)) return; var newFiles = Directory.GetFiles(targetDir, "*" + NewFileSuffix, SearchOption.AllDirectories); - if (newFiles.Length == 0) return; + var pendingDeletes = Directory.GetFiles(targetDir, "*.pending_delete", SearchOption.AllDirectories); + if (newFiles.Length == 0 && pendingDeletes.Length == 0) return; - Log($"[AtomicUpdater] External update requested. {newFiles.Length} files scheduled."); + Log($"[AtomicUpdater] External update requested. {newFiles.Length} files scheduled, {pendingDeletes.Length} deletes scheduled."); ScheduleExternalUpdate(newFiles); } @@ -206,6 +210,9 @@ private static bool IsFileLocked(string filePath) private static void ScheduleExternalUpdate(IEnumerable newFiles) { + string targetDir = GetTargetDirectory(); + if (string.IsNullOrEmpty(targetDir)) return; + try { var batchPath = Path.Combine(Path.GetTempPath(), $"hojoring_atomic_swap_{Guid.NewGuid():N}.bat"); @@ -245,6 +252,27 @@ private static void ScheduleExternalUpdate(IEnumerable newFiles) sw.WriteLine($")"); } + // 不要となったDLL(保留削除)のクリーンアップを更新(移動)処理の後に実行する + try + { + var pendingDeletes = Directory.GetFiles(targetDir, "*.pending_delete", SearchOption.AllDirectories); + if (pendingDeletes.Length > 0) + { + sw.WriteLine("echo 不要なアセンブリをクリーンアップしています..."); + foreach (var pdFile in pendingDeletes) + { + string targetPath = pdFile.Substring(0, pdFile.Length - ".pending_delete".Length); + string fileName = Path.GetFileName(targetPath); + + sw.WriteLine($"echo クリーンアップ中: {fileName}"); + sw.WriteLine($"if exist \"{targetPath}\" attrib -r \"{targetPath}\" > nul"); + sw.WriteLine($"del /f /q \"{targetPath}\" > nul 2>&1"); + sw.WriteLine($"del /f /q \"{pdFile}\" > nul 2>&1"); + } + } + } + catch { } + sw.WriteLine($"echo %date% %time% [INFO ] [Batch] External update session completed. >> \"{logFile}\""); sw.WriteLine("echo すべての更新が完了しました。"); sw.WriteLine("pause"); diff --git a/source/ACT.SpecialSpellTimer/ACT.SpecialSpellTimer.Core/ACT.SpecialSpellTimer.Core.csproj b/source/ACT.SpecialSpellTimer/ACT.SpecialSpellTimer.Core/ACT.SpecialSpellTimer.Core.csproj index 4ad8519d..c925b7d8 100644 --- a/source/ACT.SpecialSpellTimer/ACT.SpecialSpellTimer.Core/ACT.SpecialSpellTimer.Core.csproj +++ b/source/ACT.SpecialSpellTimer/ACT.SpecialSpellTimer.Core/ACT.SpecialSpellTimer.Core.csproj @@ -1,4 +1,4 @@ - + @@ -367,6 +367,14 @@ 4.3.1 + + 6.9.3 + runtime; build; native; contentfiles; analyzers; buildtransitive + + + 6.0.0 + all + diff --git a/source/ACT.SpecialSpellTimer/ACT.SpecialSpellTimer.Core/FodyWeavers.xml b/source/ACT.SpecialSpellTimer/ACT.SpecialSpellTimer.Core/FodyWeavers.xml new file mode 100644 index 00000000..75dbdbdc --- /dev/null +++ b/source/ACT.SpecialSpellTimer/ACT.SpecialSpellTimer.Core/FodyWeavers.xml @@ -0,0 +1,89 @@ + + + + RazorLight + Microsoft.AspNetCore.Html.Abstractions + Microsoft.AspNetCore.Http.Abstractions + Microsoft.AspNetCore.Http.Features + Microsoft.AspNetCore.Mvc.Razor.Extensions + Microsoft.AspNetCore.Razor + Microsoft.AspNetCore.Razor.Language + Microsoft.AspNetCore.Razor.Runtime + Microsoft.CodeAnalysis.Razor + Microsoft.Extensions.Caching.Abstractions + Microsoft.Extensions.Caching.Memory + Microsoft.Extensions.Configuration.Abstractions + Microsoft.Extensions.DependencyInjection + Microsoft.Extensions.DependencyInjection.Abstractions + Microsoft.Extensions.FileProviders.Abstractions + Microsoft.Extensions.FileProviders.Physical + Microsoft.Extensions.FileSystemGlobbing + Microsoft.Extensions.Hosting.Abstractions + Microsoft.Extensions.Logging.Abstractions + Microsoft.Extensions.Options + Microsoft.Extensions.Primitives + Microsoft.IO.RecyclableMemoryStream + SixLabors.Fonts + SixLabors.ImageSharp + NPOI.Core + NPOI.OOXML + NPOI.OpenXml4Net + NPOI.OpenXmlFormats + ICSharpCode.SharpZipLib + Enums.NET + BouncyCastle.Cryptography + MathNet.Numerics + Xceed.Wpf.AvalonDock + Xceed.Wpf.AvalonDock.Themes.Aero + Xceed.Wpf.AvalonDock.Themes.Metro + Xceed.Wpf.AvalonDock.Themes.VS2010 + Xceed.Wpf.Toolkit + ICSharpCode.AvalonEdit + Markdig.Signed + Hjson + MahApps.Metro.IconPacks + MahApps.Metro.IconPacks.Core + MahApps.Metro.IconPacks.BootstrapIcons + MahApps.Metro.IconPacks.BoxIcons + MahApps.Metro.IconPacks.Codicons + MahApps.Metro.IconPacks.Coolicons + MahApps.Metro.IconPacks.Entypo + MahApps.Metro.IconPacks.EvaIcons + MahApps.Metro.IconPacks.FeatherIcons + MahApps.Metro.IconPacks.FileIcons + MahApps.Metro.IconPacks.Fontaudio + MahApps.Metro.IconPacks.FontAwesome + MahApps.Metro.IconPacks.Fontisto + MahApps.Metro.IconPacks.ForkAwesome + MahApps.Metro.IconPacks.Ionicons + MahApps.Metro.IconPacks.JamIcons + MahApps.Metro.IconPacks.Material + MahApps.Metro.IconPacks.MaterialDesign + MahApps.Metro.IconPacks.MaterialLight + MahApps.Metro.IconPacks.Microns + MahApps.Metro.IconPacks.Modern + MahApps.Metro.IconPacks.Octicons + MahApps.Metro.IconPacks.PicolIcons + MahApps.Metro.IconPacks.PixelartIcons + MahApps.Metro.IconPacks.RadixIcons + MahApps.Metro.IconPacks.RemixIcon + MahApps.Metro.IconPacks.RPGAwesome + MahApps.Metro.IconPacks.SimpleIcons + MahApps.Metro.IconPacks.Typicons + MahApps.Metro.IconPacks.Unicons + MahApps.Metro.IconPacks.VaadinIcons + MahApps.Metro.IconPacks.WeatherIcons + MahApps.Metro.IconPacks.Zondicons + Microsoft.CodeAnalysis + Microsoft.CodeAnalysis.CSharp + Microsoft.CodeAnalysis.CSharp.Scripting + Microsoft.CodeAnalysis.Scripting + System.Collections.Immutable + System.Reflection.Metadata + System.Text.Encoding.CodePages + System.Threading.Tasks.Extensions + FontAwesome.WPF + System.Text.Encodings.Web + + + diff --git a/source/ACT.SpecialSpellTimer/ACT.SpecialSpellTimer.Core/FodyWeavers.xsd b/source/ACT.SpecialSpellTimer/ACT.SpecialSpellTimer.Core/FodyWeavers.xsd new file mode 100644 index 00000000..f2dbece7 --- /dev/null +++ b/source/ACT.SpecialSpellTimer/ACT.SpecialSpellTimer.Core/FodyWeavers.xsd @@ -0,0 +1,176 @@ + + + + + + + + + + + + A list of assembly names to exclude from the default action of "embed all Copy Local references", delimited with line breaks + + + + + A list of assembly names to include from the default action of "embed all Copy Local references", delimited with line breaks. + + + + + A list of runtime assembly names to exclude from the default action of "embed all Copy Local references", delimited with line breaks + + + + + A list of runtime assembly names to include from the default action of "embed all Copy Local references", delimited with line breaks. + + + + + Obsolete, use UnmanagedWinX86Assemblies instead + + + + + A list of unmanaged X86 (32 bit) assembly names to include, delimited with line breaks. + + + + + Obsolete, use UnmanagedWinX64Assemblies instead. + + + + + A list of unmanaged X64 (64 bit) assembly names to include, delimited with line breaks. + + + + + A list of unmanaged Arm64 (64 bit) assembly names to include, delimited with line breaks. + + + + + The order of preloaded assemblies, delimited with line breaks. + + + + + + This will copy embedded files to disk before loading them into memory. This is helpful for some scenarios that expected an assembly to be loaded from a physical file. + + + + + Controls if .pdbs for reference assemblies are also embedded. + + + + + Controls if runtime assemblies are also embedded. + + + + + Controls whether the runtime assemblies are embedded with their full path or only with their assembly name. + + + + + Embedded assemblies are compressed by default, and uncompressed when they are loaded. You can turn compression off with this option. + + + + + As part of Costura, embedded assemblies are no longer included as part of the build. This cleanup can be turned off. + + + + + The attach method no longer subscribes to the `AppDomain.AssemblyResolve` (.NET 4.x) and `AssemblyLoadContext.Resolving` (.NET 6.0+) events. + + + + + Costura by default will load as part of the module initialization. This flag disables that behavior. Make sure you call CosturaUtility.Initialize() somewhere in your code. + + + + + Costura will by default use assemblies with a name like 'resources.dll' as a satellite resource and prepend the output path. This flag disables that behavior. + + + + + A list of assembly names to exclude from the default action of "embed all Copy Local references", delimited with | + + + + + A list of assembly names to include from the default action of "embed all Copy Local references", delimited with |. + + + + + A list of runtime assembly names to exclude from the default action of "embed all Copy Local references", delimited with | + + + + + A list of runtime assembly names to include from the default action of "embed all Copy Local references", delimited with |. + + + + + Obsolete, use UnmanagedWinX86Assemblies instead + + + + + A list of unmanaged X86 (32 bit) assembly names to include, delimited with |. + + + + + Obsolete, use UnmanagedWinX64Assemblies instead + + + + + A list of unmanaged X64 (64 bit) assembly names to include, delimited with |. + + + + + A list of unmanaged Arm64 (64 bit) assembly names to include, delimited with |. + + + + + The order of preloaded assemblies, delimited with |. + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/source/ACT.SpecialSpellTimer/ACT.SpecialSpellTimer.Core/RaidTimeline/TimelineModel.cs b/source/ACT.SpecialSpellTimer/ACT.SpecialSpellTimer.Core/RaidTimeline/TimelineModel.cs index 70c962cd..bc839d13 100644 --- a/source/ACT.SpecialSpellTimer/ACT.SpecialSpellTimer.Core/RaidTimeline/TimelineModel.cs +++ b/source/ACT.SpecialSpellTimer/ACT.SpecialSpellTimer.Core/RaidTimeline/TimelineModel.cs @@ -50,6 +50,28 @@ private static RazorLightEngine CreateTimelineEngine() .UseProject(new TimelineRazorProject(TimelineRazorModel.Instance.TimelineDirectory)) .UseMemoryCachingProvider(); + // Exclude dynamic or memory-loaded (e.g. Costura embedded) assemblies that lack a physical path + try + { + var toExclude = new List(); + foreach (var asm in AppDomain.CurrentDomain.GetAssemblies()) + { + if (asm.IsDynamic || string.IsNullOrWhiteSpace(asm.Location)) + { + var name = asm.GetName().Name; + if (!string.IsNullOrEmpty(name)) + { + toExclude.Add(name); + } + } + } + builder.ExcludeAssemblies(toExclude.ToArray()); + } + catch + { + // Ignore errors to guarantee plugin load + } + // Add Namespaces builder.AddDefaultNamespaces( "System.Runtime", @@ -65,18 +87,62 @@ private static RazorLightEngine CreateTimelineEngine() // Add References // Add Assemblies containing types used in Razor templates // RazorLight requires MetadataReference, not Assembly - builder.AddMetadataReferences( - MetadataReference.CreateFromFile(typeof(TimelineModel).Assembly.Location), - MetadataReference.CreateFromFile(typeof(TimelineRazorModel).Assembly.Location), - MetadataReference.CreateFromFile(typeof(FFXIV.Framework.Common.WPFHelper).Assembly.Location), - MetadataReference.CreateFromFile(typeof(System.Linq.Enumerable).Assembly.Location), - MetadataReference.CreateFromFile(typeof(System.Text.RegularExpressions.Regex).Assembly.Location), - MetadataReference.CreateFromFile(typeof(System.Xml.XmlDocument).Assembly.Location), - MetadataReference.CreateFromFile(typeof(Advanced_Combat_Tracker.ActGlobals).Assembly.Location), - MetadataReference.CreateFromFile(typeof(RazorLightEngine).Assembly.Location), - MetadataReference.CreateFromFile(Assembly.Load("netstandard").Location), - MetadataReference.CreateFromFile(Assembly.Load("Microsoft.CSharp").Location) - ); + var assemblies = new[] + { + typeof(TimelineModel).Assembly, + typeof(TimelineRazorModel).Assembly, + typeof(FFXIV.Framework.Common.WPFHelper).Assembly, + typeof(System.Linq.Enumerable).Assembly, + typeof(System.Text.RegularExpressions.Regex).Assembly, + typeof(System.Xml.XmlDocument).Assembly, + typeof(Advanced_Combat_Tracker.ActGlobals).Assembly, + typeof(RazorLightEngine).Assembly, + Assembly.Load("netstandard"), + Assembly.Load("Microsoft.CSharp"), + + // Add compiler/Razor assemblies to manually reference them + Assembly.Load("Microsoft.AspNetCore.Razor.Runtime"), + Assembly.Load("Microsoft.AspNetCore.Razor"), + Assembly.Load("Microsoft.AspNetCore.Html.Abstractions"), + Assembly.Load("Microsoft.AspNetCore.Razor.Language"), + Assembly.Load("Microsoft.AspNetCore.Mvc.Razor.Extensions"), + Assembly.Load("Microsoft.CodeAnalysis.Razor"), + Assembly.Load("Microsoft.CodeAnalysis"), + Assembly.Load("Microsoft.CodeAnalysis.CSharp"), + Assembly.Load("System.Text.Encodings.Web") + }; + + var binDir = Path.GetDirectoryName(typeof(TimelineModel).Assembly.Location); + var metadataReferences = new List(); + foreach (var asm in assemblies) + { + try + { + if (asm != null) + { + if (!string.IsNullOrWhiteSpace(asm.Location)) + { + metadataReferences.Add(MetadataReference.CreateFromFile(asm.Location)); + } + else + { + // Try to find the physical file in the plugin's bin directory + var name = asm.GetName().Name; + var path = Path.Combine(binDir, name + ".dll"); + if (File.Exists(path)) + { + metadataReferences.Add(MetadataReference.CreateFromFile(path)); + } + } + } + } + catch + { + // Ignore + } + } + + builder.AddMetadataReferences(metadataReferences.ToArray()); // Inject NullHtmlEncoder to disable HTML encoding InjectNullHtmlEncoder(builder); diff --git a/source/ACT.TTSYukkuri/ACT.TTSYukkuri/FodyWeavers.xml b/source/ACT.TTSYukkuri/ACT.TTSYukkuri/FodyWeavers.xml index 1291813d..ca583502 100644 --- a/source/ACT.TTSYukkuri/ACT.TTSYukkuri/FodyWeavers.xml +++ b/source/ACT.TTSYukkuri/ACT.TTSYukkuri/FodyWeavers.xml @@ -11,6 +11,17 @@ ACT.Hojoring.Activator CeVIO.* + RucheHome.Voiceroid + RucheHomeLib + VoiceTextWebAPI.Client + System.Reactive + System.Reactive.Linq + Grpc.Core + Grpc.Core.Api + Grpc.Net.Client + Grpc.Net.Common + Microsoft.Bcl.AsyncInterfaces + FontAwesome.WPF AqKanji2Koe @@ -18,6 +29,7 @@ AquesTalkDriver libsodium opus + grpc_csharp_ext AqKanji2Koe @@ -25,6 +37,7 @@ AquesTalkDriver libsodium opus + grpc_csharp_ext diff --git a/source/ACT.UltraScouter/ACT.UltraScouter.Core/ACT.UltraScouter.Core.csproj b/source/ACT.UltraScouter/ACT.UltraScouter.Core/ACT.UltraScouter.Core.csproj index 146838c9..0aa070bc 100644 --- a/source/ACT.UltraScouter/ACT.UltraScouter.Core/ACT.UltraScouter.Core.csproj +++ b/source/ACT.UltraScouter/ACT.UltraScouter.Core/ACT.UltraScouter.Core.csproj @@ -1,4 +1,4 @@ - + @@ -545,6 +545,14 @@ 4.3.1 + + 6.9.3 + runtime; build; native; contentfiles; analyzers; buildtransitive + + + 6.0.0 + all + diff --git a/source/ACT.UltraScouter/ACT.UltraScouter.Core/FodyWeavers.xml b/source/ACT.UltraScouter/ACT.UltraScouter.Core/FodyWeavers.xml new file mode 100644 index 00000000..130fd26a --- /dev/null +++ b/source/ACT.UltraScouter/ACT.UltraScouter.Core/FodyWeavers.xml @@ -0,0 +1,13 @@ + + + + Xceed.Wpf.Toolkit + FontAwesome.WPF + NLog + MahApps.Metro.IconPacks + MahApps.Metro.IconPacks.Core + MahApps.Metro.IconPacks.Material + MahApps.Metro.IconPacks.MaterialLight + + + diff --git a/source/ACT.UltraScouter/ACT.UltraScouter.Core/FodyWeavers.xsd b/source/ACT.UltraScouter/ACT.UltraScouter.Core/FodyWeavers.xsd new file mode 100644 index 00000000..f2dbece7 --- /dev/null +++ b/source/ACT.UltraScouter/ACT.UltraScouter.Core/FodyWeavers.xsd @@ -0,0 +1,176 @@ + + + + + + + + + + + + A list of assembly names to exclude from the default action of "embed all Copy Local references", delimited with line breaks + + + + + A list of assembly names to include from the default action of "embed all Copy Local references", delimited with line breaks. + + + + + A list of runtime assembly names to exclude from the default action of "embed all Copy Local references", delimited with line breaks + + + + + A list of runtime assembly names to include from the default action of "embed all Copy Local references", delimited with line breaks. + + + + + Obsolete, use UnmanagedWinX86Assemblies instead + + + + + A list of unmanaged X86 (32 bit) assembly names to include, delimited with line breaks. + + + + + Obsolete, use UnmanagedWinX64Assemblies instead. + + + + + A list of unmanaged X64 (64 bit) assembly names to include, delimited with line breaks. + + + + + A list of unmanaged Arm64 (64 bit) assembly names to include, delimited with line breaks. + + + + + The order of preloaded assemblies, delimited with line breaks. + + + + + + This will copy embedded files to disk before loading them into memory. This is helpful for some scenarios that expected an assembly to be loaded from a physical file. + + + + + Controls if .pdbs for reference assemblies are also embedded. + + + + + Controls if runtime assemblies are also embedded. + + + + + Controls whether the runtime assemblies are embedded with their full path or only with their assembly name. + + + + + Embedded assemblies are compressed by default, and uncompressed when they are loaded. You can turn compression off with this option. + + + + + As part of Costura, embedded assemblies are no longer included as part of the build. This cleanup can be turned off. + + + + + The attach method no longer subscribes to the `AppDomain.AssemblyResolve` (.NET 4.x) and `AssemblyLoadContext.Resolving` (.NET 6.0+) events. + + + + + Costura by default will load as part of the module initialization. This flag disables that behavior. Make sure you call CosturaUtility.Initialize() somewhere in your code. + + + + + Costura will by default use assemblies with a name like 'resources.dll' as a satellite resource and prepend the output path. This flag disables that behavior. + + + + + A list of assembly names to exclude from the default action of "embed all Copy Local references", delimited with | + + + + + A list of assembly names to include from the default action of "embed all Copy Local references", delimited with |. + + + + + A list of runtime assembly names to exclude from the default action of "embed all Copy Local references", delimited with | + + + + + A list of runtime assembly names to include from the default action of "embed all Copy Local references", delimited with |. + + + + + Obsolete, use UnmanagedWinX86Assemblies instead + + + + + A list of unmanaged X86 (32 bit) assembly names to include, delimited with |. + + + + + Obsolete, use UnmanagedWinX64Assemblies instead + + + + + A list of unmanaged X64 (64 bit) assembly names to include, delimited with |. + + + + + A list of unmanaged Arm64 (64 bit) assembly names to include, delimited with |. + + + + + The order of preloaded assemblies, delimited with |. + + + + + + + + 'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed. + + + + + A comma-separated list of error codes that can be safely ignored in assembly verification. + + + + + 'false' to turn off automatic generation of the XML Schema file. + + + + + \ No newline at end of file diff --git a/source/ACT.XIVLog/FodyWeavers.xml b/source/ACT.XIVLog/FodyWeavers.xml index fa6f89bb..d318516d 100644 --- a/source/ACT.XIVLog/FodyWeavers.xml +++ b/source/ACT.XIVLog/FodyWeavers.xml @@ -6,6 +6,8 @@ ACT.Hojoring.Activator + websocket-sharp + TagLibSharp diff --git a/source/FFXIV.Framework/FFXIV.Framework.csproj b/source/FFXIV.Framework/FFXIV.Framework.csproj index 641069c4..07c3dc3e 100644 --- a/source/FFXIV.Framework/FFXIV.Framework.csproj +++ b/source/FFXIV.Framework/FFXIV.Framework.csproj @@ -1,4 +1,4 @@ - + @@ -403,6 +403,10 @@ 6.9.3 runtime; build; native; contentfiles; analyzers; buildtransitive + + 6.0.0 + all + 4.7.0.9 diff --git a/source/FFXIV.Framework/FodyWeavers.xml b/source/FFXIV.Framework/FodyWeavers.xml index 675f7099..d9c2a384 100644 --- a/source/FFXIV.Framework/FodyWeavers.xml +++ b/source/FFXIV.Framework/FodyWeavers.xml @@ -1,3 +1,29 @@ + + + Sharlayan + Newtonsoft.Json + Newtonsoft.Json.Bson + System.Runtime.CompilerServices.Unsafe + System.Memory + System.Buffers + System.Numerics.Vectors + System.ValueTuple + WindowsInput + Prism + Prism.Wpf + CommonServiceLocator + Hjson + Markdig.Signed + NAudio + NAudio.Asio + NAudio.Core + NAudio.Midi + NAudio.Wasapi + NAudio.WinMM + Octokit + FontAwesome.WPF + + diff --git a/source/FFXIV.Framework/FodyWeavers.xsd b/source/FFXIV.Framework/FodyWeavers.xsd index 69dbe488..408a2127 100644 --- a/source/FFXIV.Framework/FodyWeavers.xsd +++ b/source/FFXIV.Framework/FodyWeavers.xsd @@ -53,6 +53,157 @@ + + + + + + A list of assembly names to exclude from the default action of "embed all Copy Local references", delimited with line breaks + + + + + A list of assembly names to include from the default action of "embed all Copy Local references", delimited with line breaks. + + + + + A list of runtime assembly names to exclude from the default action of "embed all Copy Local references", delimited with line breaks + + + + + A list of runtime assembly names to include from the default action of "embed all Copy Local references", delimited with line breaks. + + + + + Obsolete, use UnmanagedWinX86Assemblies instead + + + + + A list of unmanaged X86 (32 bit) assembly names to include, delimited with line breaks. + + + + + Obsolete, use UnmanagedWinX64Assemblies instead. + + + + + A list of unmanaged X64 (64 bit) assembly names to include, delimited with line breaks. + + + + + A list of unmanaged Arm64 (64 bit) assembly names to include, delimited with line breaks. + + + + + The order of preloaded assemblies, delimited with line breaks. + + + + + + This will copy embedded files to disk before loading them into memory. This is helpful for some scenarios that expected an assembly to be loaded from a physical file. + + + + + Controls if .pdbs for reference assemblies are also embedded. + + + + + Controls if runtime assemblies are also embedded. + + + + + Controls whether the runtime assemblies are embedded with their full path or only with their assembly name. + + + + + Embedded assemblies are compressed by default, and uncompressed when they are loaded. You can turn compression off with this option. + + + + + As part of Costura, embedded assemblies are no longer included as part of the build. This cleanup can be turned off. + + + + + The attach method no longer subscribes to the `AppDomain.AssemblyResolve` (.NET 4.x) and `AssemblyLoadContext.Resolving` (.NET 6.0+) events. + + + + + Costura by default will load as part of the module initialization. This flag disables that behavior. Make sure you call CosturaUtility.Initialize() somewhere in your code. + + + + + Costura will by default use assemblies with a name like 'resources.dll' as a satellite resource and prepend the output path. This flag disables that behavior. + + + + + A list of assembly names to exclude from the default action of "embed all Copy Local references", delimited with | + + + + + A list of assembly names to include from the default action of "embed all Copy Local references", delimited with |. + + + + + A list of runtime assembly names to exclude from the default action of "embed all Copy Local references", delimited with | + + + + + A list of runtime assembly names to include from the default action of "embed all Copy Local references", delimited with |. + + + + + Obsolete, use UnmanagedWinX86Assemblies instead + + + + + A list of unmanaged X86 (32 bit) assembly names to include, delimited with |. + + + + + Obsolete, use UnmanagedWinX64Assemblies instead + + + + + A list of unmanaged X64 (64 bit) assembly names to include, delimited with |. + + + + + A list of unmanaged Arm64 (64 bit) assembly names to include, delimited with |. + + + + + The order of preloaded assemblies, delimited with |. + + + + diff --git a/source/FFXIV.Framework/Updater/Updater.cs b/source/FFXIV.Framework/Updater/Updater.cs index f4220210..842d625a 100644 --- a/source/FFXIV.Framework/Updater/Updater.cs +++ b/source/FFXIV.Framework/Updater/Updater.cs @@ -1,4 +1,4 @@ -using Advanced_Combat_Tracker; +using Advanced_Combat_Tracker; using FFXIV.Framework.Common; using Markdig; using Newtonsoft.Json; @@ -494,14 +494,32 @@ public async Task CheckAndDoUpdate(UpdateTarget target, bool usePreRelease CreateBackup(_destDir, dialog); dialog.WriteLog("クリーンアップ中..."); - CleanupOldAssets(_destDir, ignoreList, dialog); + CleanupOldAssets(_destDir, installSrc, ignoreList, dialog); dialog.WriteLog("マイグレーション中..."); MigrateDirectories(_destDir, dialog); dialog.WriteLog("ファイルを配置中..."); this.OnBeforeUpdate?.Invoke(); - return await Task.Run(() => Install(installSrc, _destDir, ignoreList, dialog)); + + var installResult = await Task.Run(() => Install(installSrc, _destDir, ignoreList, dialog)); + + // 保留削除マークファイルが存在する場合、失敗リスト(保留リスト)に追加して外部アップデート(バッチ)を誘発させる + try + { + var pendingDeletes = Directory.GetFiles(_destDir, "*.pending_delete", SearchOption.AllDirectories); + foreach (var pd in pendingDeletes) + { + string relative = pd.Substring(_destDir.Length).TrimStart('\\', '/'); + if (!installResult.failedFiles.Contains(relative)) + { + installResult.failedFiles.Add(relative); + } + } + } + catch { } + + return installResult; } catch (Exception ex) { @@ -556,7 +574,7 @@ private void CreateBackup(string dest, IUpdaterUI dialog) } } - private void CleanupOldAssets(string dest, List ignoreList, IUpdaterUI dialog) + private void CleanupOldAssets(string dest, string src, List ignoreList, IUpdaterUI dialog) { string[] dirsToClean = { "references", "openJTalk", "yukkuri", "tools" }; foreach (var d in dirsToClean) @@ -584,11 +602,30 @@ private void CleanupOldAssets(string dest, List ignoreList, IUpdaterUI d { continue; } - try + + // 新パッケージ(src)にこのファイルが存在しないかチェックする + string srcPath = Path.Combine(src, fileName); + if (!File.Exists(srcPath)) { - File.Delete(dll); + try + { + File.Delete(dll); + dialog.WriteLog($"クリーンアップ: {fileName}"); + } + catch + { + try + { + string pendingDeletePath = dll + ".pending_delete"; + if (!File.Exists(pendingDeletePath)) + { + File.WriteAllText(pendingDeletePath, string.Empty); + } + } + catch { } + dialog.WriteLog($"保留クリーンアップ (ロック中): {fileName}"); + } } - catch { } } string binPath = Path.Combine(dest, "bin"); @@ -604,11 +641,30 @@ private void CleanupOldAssets(string dest, List ignoreList, IUpdaterUI d { continue; } - try + + // 新パッケージ(src)にこのファイルが存在しないかチェックする + string srcPath = Path.Combine(src, relativePath); + if (!File.Exists(srcPath)) { - File.Delete(f); + try + { + File.Delete(f); + dialog.WriteLog($"クリーンアップ: {relativePath}"); + } + catch + { + try + { + string pendingDeletePath = f + ".pending_delete"; + if (!File.Exists(pendingDeletePath)) + { + File.WriteAllText(pendingDeletePath, string.Empty); + } + } + catch { } + dialog.WriteLog($"保留クリーンアップ (ロック中): {relativePath}"); + } } - catch { } } } } diff --git a/source/make.ps1 b/source/make.ps1 index 3f8c21c6..3869c955 100644 --- a/source/make.ps1 +++ b/source/make.ps1 @@ -1,4 +1,4 @@ -# 現在のディレクトリを取得する (PS7+ compliant) +# 現在のディレクトリを取得する (PS7+ compliant) $cd = $PSScriptRoot Set-Location $cd @@ -148,6 +148,61 @@ if (Test-Path .\ACT.Hojoring\bin\x64\Release) { } '●不要なファイルを削除する' + # Costura.Fodyで埋め込まれたため不要となったサードパーティDLLを削除 + $embedded_dlls = @( + # FFXIV.Framework 埋め込み + "Sharlayan.dll", + "Newtonsoft.Json.dll", "Newtonsoft.Json.Bson.dll", + "System.Reactive.dll", "System.Reactive.Linq.dll", + "Microsoft.CodeAnalysis.CSharp.Scripting.dll", "Microsoft.CodeAnalysis.Scripting.dll", + "System.Runtime.CompilerServices.Unsafe.dll", "System.Memory.dll", "System.Buffers.dll", "System.Numerics.Vectors.dll", + "System.Collections.Immutable.dll", "System.Threading.Tasks.Extensions.dll", "System.ValueTuple.dll", "System.Reflection.Metadata.dll", + "System.Text.Encoding.CodePages.dll", "Microsoft.Bcl.AsyncInterfaces.dll", + "websocket-sharp.dll", "WindowsInput.dll", + "Grpc.Core.dll", "Grpc.Core.Api.dll", "Grpc.Net.Client.dll", "Grpc.Net.Common.dll", + "TagLibSharp.dll", "Prism.dll", "Prism.Wpf.dll", "CommonServiceLocator.dll", + + # ACT.SpecialSpellTimer 埋め込み + "Microsoft.AspNetCore.Http.Abstractions.dll", "Microsoft.AspNetCore.Http.Features.dll", + "Microsoft.Extensions.Caching.Abstractions.dll", "Microsoft.Extensions.Caching.Memory.dll", "Microsoft.Extensions.Configuration.Abstractions.dll", + "Microsoft.Extensions.DependencyInjection.dll", "Microsoft.Extensions.DependencyInjection.Abstractions.dll", "Microsoft.Extensions.FileProviders.Abstractions.dll", + "Microsoft.Extensions.FileProviders.Physical.dll", "Microsoft.Extensions.FileSystemGlobbing.dll", "Microsoft.Extensions.Hosting.Abstractions.dll", + "Microsoft.Extensions.Logging.Abstractions.dll", "Microsoft.Extensions.Options.dll", "Microsoft.Extensions.Primitives.dll", + "Microsoft.IO.RecyclableMemoryStream.dll", + "SixLabors.Fonts.dll", "SixLabors.ImageSharp.dll", + "NPOI.Core.dll", "NPOI.OOXML.dll", "NPOI.OpenXml4Net.dll", "NPOI.OpenXmlFormats.dll", + "ICSharpCode.SharpZipLib.dll", "Enums.NET.dll", "BouncyCastle.Cryptography.dll", "MathNet.Numerics.dll", + "ICSharpCode.AvalonEdit.dll", "Markdig.Signed.dll", "Hjson.dll", + + # ACT.TTSYukkuri 埋め込み + "RucheHome.Voiceroid.dll", "RucheHomeLib.dll", "VoiceTextWebAPI.Client.dll", + + # ACT.UltraScouter 埋め込み + "Extended.Wpf.Toolkit.dll", "Xceed.Wpf.Toolkit.dll", + "FontAwesome.WPF.dll", "NLog.dll", + "MahApps.Metro.IconPacks.dll", "MahApps.Metro.IconPacks.Core.dll", + "MahApps.Metro.IconPacks.Material.dll", "MahApps.Metro.IconPacks.MaterialLight.dll", + "MahApps.Metro.IconPacks.BootstrapIcons.dll", "MahApps.Metro.IconPacks.BoxIcons.dll", + "MahApps.Metro.IconPacks.Codicons.dll", "MahApps.Metro.IconPacks.Coolicons.dll", + "MahApps.Metro.IconPacks.Entypo.dll", "MahApps.Metro.IconPacks.EvaIcons.dll", + "MahApps.Metro.IconPacks.FeatherIcons.dll", "MahApps.Metro.IconPacks.FileIcons.dll", + "MahApps.Metro.IconPacks.Fontaudio.dll", "MahApps.Metro.IconPacks.FontAwesome.dll", + "MahApps.Metro.IconPacks.Fontisto.dll", "MahApps.Metro.IconPacks.ForkAwesome.dll", + "MahApps.Metro.IconPacks.Ionicons.dll", "MahApps.Metro.IconPacks.JamIcons.dll", + "MahApps.Metro.IconPacks.MaterialDesign.dll", "MahApps.Metro.IconPacks.MaterialLight.dll", + "MahApps.Metro.IconPacks.Microns.dll", "MahApps.Metro.IconPacks.Modern.dll", + "MahApps.Metro.IconPacks.Octicons.dll", "MahApps.Metro.IconPacks.PicolIcons.dll", + "MahApps.Metro.IconPacks.PixelartIcons.dll", "MahApps.Metro.IconPacks.RadixIcons.dll", + "MahApps.Metro.IconPacks.RemixIcon.dll", "MahApps.Metro.IconPacks.RPGAwesome.dll", + "MahApps.Metro.IconPacks.SimpleIcons.dll", "MahApps.Metro.IconPacks.Typicons.dll", + "MahApps.Metro.IconPacks.Unicons.dll", "MahApps.Metro.IconPacks.VaadinIcons.dll", + "MahApps.Metro.IconPacks.WeatherIcons.dll", "MahApps.Metro.IconPacks.Zondicons.dll" + ) + foreach ($dll in $embedded_dlls) { + Remove-Item -Force $dll -ErrorAction SilentlyContinue + Remove-Item -Force "bin\$dll" -ErrorAction SilentlyContinue + } + $garbage = @( "*.pdb", "*.xml", "*.exe.config", "libgrpc_csharp_ext.*.so", "libgrpc_csharp_ext.*.dylib"