com.wallstop-studios.dxmessaging 2.2.0 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +315 -67
- package/CHANGELOG.md.meta +7 -7
- package/Editor/Analyzers/BaseCallIlInspector.cs +277 -0
- package/Editor/Analyzers/BaseCallIlInspector.cs.meta +11 -0
- package/Editor/Analyzers/BaseCallLogMessageParser.cs +295 -0
- package/Editor/Analyzers/BaseCallLogMessageParser.cs.meta +11 -0
- package/Editor/Analyzers/BaseCallReportAggregator.cs +308 -0
- package/Editor/Analyzers/BaseCallReportAggregator.cs.meta +11 -0
- package/Editor/Analyzers/BaseCallTypeScanner.cs +110 -0
- package/Editor/Analyzers/BaseCallTypeScanner.cs.meta +11 -0
- package/Editor/Analyzers/BaseCallTypeScannerCore.cs +562 -0
- package/Editor/Analyzers/BaseCallTypeScannerCore.cs.meta +11 -0
- package/Editor/Analyzers/DxMessagingConsoleHarvester.cs +1129 -0
- package/Editor/Analyzers/DxMessagingConsoleHarvester.cs.meta +11 -0
- package/Editor/Analyzers/Microsoft.CodeAnalysis.CSharp.dll.meta +44 -44
- package/Editor/Analyzers/Microsoft.CodeAnalysis.dll.meta +44 -44
- package/Editor/Analyzers/System.Collections.Immutable.dll.meta +44 -44
- package/Editor/Analyzers/System.Reflection.Metadata.dll.meta +44 -44
- package/Editor/Analyzers/System.Runtime.CompilerServices.Unsafe.dll.meta +44 -44
- package/Editor/Analyzers/WallstopStudios.DxMessaging.Analyzer.dll +0 -0
- package/Editor/Analyzers/WallstopStudios.DxMessaging.Analyzer.dll.meta +46 -0
- package/Editor/Analyzers/WallstopStudios.DxMessaging.SourceGenerators.dll +0 -0
- package/Editor/Analyzers/WallstopStudios.DxMessaging.SourceGenerators.dll.meta +72 -72
- package/Editor/Analyzers.meta +8 -8
- package/Editor/AssemblyInfo.cs.meta +11 -3
- package/Editor/CustomEditors/MessageAwareComponentFallbackEditor.cs +81 -0
- package/Editor/CustomEditors/MessageAwareComponentFallbackEditor.cs.meta +11 -0
- package/Editor/CustomEditors/MessageAwareComponentInspectorOverlay.cs +429 -0
- package/Editor/CustomEditors/MessageAwareComponentInspectorOverlay.cs.meta +11 -0
- package/Editor/CustomEditors/MessagingComponentEditor.cs +1 -1
- package/Editor/CustomEditors/MessagingComponentEditor.cs.meta +11 -3
- package/Editor/CustomEditors.meta +2 -2
- package/Editor/DxMessagingEditorIdle.cs +62 -0
- package/Editor/DxMessagingEditorIdle.cs.meta +11 -0
- package/Editor/DxMessagingEditorInitializer.cs +112 -15
- package/Editor/DxMessagingEditorInitializer.cs.meta +11 -3
- package/Editor/DxMessagingEditorLog.cs +32 -0
- package/Editor/DxMessagingEditorLog.cs.meta +11 -0
- package/Editor/DxMessagingMenu.cs.meta +11 -11
- package/Editor/DxMessagingSceneBuildProcessor.cs.meta +11 -11
- package/Editor/Settings/DxMessagingBaseCallIgnoreSync.cs +313 -0
- package/Editor/Settings/DxMessagingBaseCallIgnoreSync.cs.meta +11 -0
- package/Editor/Settings/DxMessagingSettings.cs +261 -11
- package/Editor/Settings/DxMessagingSettings.cs.meta +11 -3
- package/Editor/Settings/DxMessagingSettingsProvider.cs +50 -33
- package/Editor/Settings/DxMessagingSettingsProvider.cs.meta +11 -3
- package/Editor/Settings.meta +2 -2
- package/Editor/SetupCscRsp.cs +406 -39
- package/Editor/SetupCscRsp.cs.meta +11 -3
- package/Editor/Testing/MessagingComponentEditorHarness.cs +2 -2
- package/Editor/Testing/MessagingComponentEditorHarness.cs.meta +11 -3
- package/Editor/Testing.meta +3 -3
- package/Editor/WallstopStudios.DxMessaging.Editor.asmdef +14 -14
- package/Editor/WallstopStudios.DxMessaging.Editor.asmdef.meta +7 -7
- package/Editor.meta +8 -8
- package/LICENSE.md +9 -9
- package/LICENSE.md.meta +7 -7
- package/README.md +940 -900
- package/README.md.meta +7 -7
- package/Runtime/AssemblyInfo.cs +4 -0
- package/Runtime/AssemblyInfo.cs.meta +11 -3
- package/Runtime/Core/Attributes/DxAutoConstructorAttribute.cs.meta +11 -3
- package/Runtime/Core/Attributes/DxBroadcastMessageAttribute.cs.meta +11 -3
- package/Runtime/Core/Attributes/DxIgnoreMissingBaseCallAttribute.cs +26 -0
- package/Runtime/Core/Attributes/DxIgnoreMissingBaseCallAttribute.cs.meta +11 -0
- package/Runtime/Core/Attributes/DxOptionalParameterAttribute.cs +2 -4
- package/Runtime/Core/Attributes/DxOptionalParameterAttribute.cs.meta +11 -3
- package/Runtime/Core/Attributes/DxTargetedMessageAttribute.cs.meta +11 -3
- package/Runtime/Core/Attributes/DxUntargetedMessageAttribute.cs.meta +11 -3
- package/Runtime/Core/Attributes/Il2CppSetOptionAttribute.cs +56 -0
- package/Runtime/Core/Attributes/Il2CppSetOptionAttribute.cs.meta +11 -0
- package/Runtime/Core/Attributes.meta +2 -2
- package/Runtime/Core/Configuration/DxMessagingRuntimeSettings.cs +195 -0
- package/Runtime/Core/Configuration/DxMessagingRuntimeSettings.cs.meta +11 -0
- package/Runtime/Core/Configuration/DxMessagingRuntimeSettingsProvider.cs +179 -0
- package/Runtime/Core/Configuration/DxMessagingRuntimeSettingsProvider.cs.meta +11 -0
- package/Runtime/Core/Configuration.meta +9 -0
- package/Runtime/Core/DataStructure/CyclicBuffer.cs +46 -28
- package/Runtime/Core/DataStructure/CyclicBuffer.cs.meta +11 -3
- package/Runtime/Core/DataStructure.meta +2 -2
- package/Runtime/Core/Diagnostics/MessageEmissionData.cs.meta +11 -3
- package/Runtime/Core/Diagnostics/MessageRegistrationData.cs.meta +11 -3
- package/Runtime/Core/Diagnostics/MessageRegistrationType.cs.meta +11 -3
- package/Runtime/Core/Diagnostics.meta +2 -2
- package/Runtime/Core/DxMessagingStaticState.cs +19 -0
- package/Runtime/Core/DxMessagingStaticState.cs.meta +11 -11
- package/Runtime/Core/Extensions/EnumExtensions.cs +6 -5
- package/Runtime/Core/Extensions/EnumExtensions.cs.meta +11 -3
- package/Runtime/Core/Extensions/IListExtensions.cs.meta +11 -3
- package/Runtime/Core/Extensions/MessageBusExtensions.cs.meta +12 -12
- package/Runtime/Core/Extensions/MessageExtensions.cs +0 -60
- package/Runtime/Core/Extensions/MessageExtensions.cs.meta +11 -11
- package/Runtime/Core/Extensions.meta +8 -8
- package/Runtime/Core/Helper/MessageCache.cs +32 -0
- package/Runtime/Core/Helper/MessageCache.cs.meta +11 -3
- package/Runtime/Core/Helper/MessageHelperIndexer.cs.meta +11 -3
- package/Runtime/Core/Helper.meta +2 -2
- package/Runtime/Core/IMessage.cs +3 -3
- package/Runtime/Core/IMessage.cs.meta +11 -11
- package/Runtime/Core/InstanceId.cs +25 -1
- package/Runtime/Core/InstanceId.cs.meta +11 -11
- package/Runtime/Core/Internal/DxUnsafe.cs +60 -0
- package/Runtime/Core/Internal/DxUnsafe.cs.meta +11 -0
- package/Runtime/Core/Internal/FlatDispatch.cs +198 -0
- package/Runtime/Core/Internal/FlatDispatch.cs.meta +11 -0
- package/Runtime/Core/Internal/TypedGlobalSlotIndex.cs +38 -0
- package/Runtime/Core/Internal/TypedGlobalSlotIndex.cs.meta +11 -0
- package/Runtime/Core/Internal/TypedSlotIndex.cs +81 -0
- package/Runtime/Core/Internal/TypedSlotIndex.cs.meta +11 -0
- package/Runtime/Core/Internal/TypedSlots.cs +597 -0
- package/Runtime/Core/Internal/TypedSlots.cs.meta +11 -0
- package/Runtime/Core/Internal.meta +9 -0
- package/Runtime/Core/MessageBus/DiagnosticsTarget.cs.meta +11 -11
- package/Runtime/Core/MessageBus/GlobalMessageBusProvider.cs.meta +11 -11
- package/Runtime/Core/MessageBus/IMessageBus.cs +189 -15
- package/Runtime/Core/MessageBus/IMessageBus.cs.meta +11 -11
- package/Runtime/Core/MessageBus/IMessageBusProvider.cs.meta +11 -11
- package/Runtime/Core/MessageBus/IMessageRegistrationBuilder.cs +1 -0
- package/Runtime/Core/MessageBus/IMessageRegistrationBuilder.cs.meta +11 -11
- package/Runtime/Core/MessageBus/Internal/BusContextIndex.cs +16 -0
- package/Runtime/Core/MessageBus/Internal/BusContextIndex.cs.meta +11 -0
- package/Runtime/Core/MessageBus/Internal/BusSinkIndex.cs +40 -0
- package/Runtime/Core/MessageBus/Internal/BusSinkIndex.cs.meta +11 -0
- package/Runtime/Core/MessageBus/Internal/BusSlots.cs +719 -0
- package/Runtime/Core/MessageBus/Internal/BusSlots.cs.meta +11 -0
- package/Runtime/Core/MessageBus/Internal/DispatchKind.cs +38 -0
- package/Runtime/Core/MessageBus/Internal/DispatchKind.cs.meta +11 -0
- package/Runtime/Core/MessageBus/Internal/DispatchPhase.cs +20 -0
- package/Runtime/Core/MessageBus/Internal/DispatchPhase.cs.meta +11 -0
- package/Runtime/Core/MessageBus/Internal/DispatchVariant.cs +28 -0
- package/Runtime/Core/MessageBus/Internal/DispatchVariant.cs.meta +11 -0
- package/Runtime/Core/MessageBus/Internal/IEvictableSlot.cs +48 -0
- package/Runtime/Core/MessageBus/Internal/IEvictableSlot.cs.meta +11 -0
- package/Runtime/Core/MessageBus/Internal/ISweepable.cs +15 -0
- package/Runtime/Core/MessageBus/Internal/ISweepable.cs.meta +11 -0
- package/Runtime/Core/MessageBus/Internal/RegistrationMethodAxes.cs +222 -0
- package/Runtime/Core/MessageBus/Internal/RegistrationMethodAxes.cs.meta +11 -0
- package/Runtime/Core/MessageBus/Internal/SlotKey.cs +192 -0
- package/Runtime/Core/MessageBus/Internal/SlotKey.cs.meta +11 -0
- package/Runtime/Core/MessageBus/Internal.meta +9 -0
- package/Runtime/Core/MessageBus/MessageBus.cs +5366 -3838
- package/Runtime/Core/MessageBus/MessageBus.cs.meta +11 -11
- package/Runtime/Core/MessageBus/MessageBusRebindMode.cs.meta +11 -11
- package/Runtime/Core/MessageBus/MessageRegistrationBuilder.cs +187 -14
- package/Runtime/Core/MessageBus/MessageRegistrationBuilder.cs.meta +11 -11
- package/Runtime/Core/MessageBus/MessagingRegistration.cs.meta +11 -11
- package/Runtime/Core/MessageBus/RegistrationLog.cs.meta +11 -11
- package/Runtime/Core/MessageBus.meta +8 -8
- package/Runtime/Core/MessageHandler.cs +2399 -1042
- package/Runtime/Core/MessageHandler.cs.meta +11 -11
- package/Runtime/Core/MessageRegistrationHandle.cs.meta +11 -11
- package/Runtime/Core/MessageRegistrationToken.cs +429 -44
- package/Runtime/Core/MessageRegistrationToken.cs.meta +11 -11
- package/Runtime/Core/Messages/GlobalStringMessage.cs.meta +11 -3
- package/Runtime/Core/Messages/IBroadcastMessage.cs.meta +11 -11
- package/Runtime/Core/Messages/ITargetedMessage.cs.meta +11 -11
- package/Runtime/Core/Messages/IUntargetedMessage.cs.meta +11 -11
- package/Runtime/Core/Messages/ReflexiveMessage.cs.meta +11 -3
- package/Runtime/Core/Messages/SourcedStringMessage.cs.meta +11 -11
- package/Runtime/Core/Messages/StringMessage.cs.meta +11 -3
- package/Runtime/Core/Messages.meta +8 -8
- package/Runtime/Core/MessagingDebug.cs.meta +11 -11
- package/Runtime/Core/Pooling/CollectionPool.cs +266 -0
- package/Runtime/Core/Pooling/CollectionPool.cs.meta +11 -0
- package/Runtime/Core/Pooling/CollectionPoolDiagnostics.cs +30 -0
- package/Runtime/Core/Pooling/CollectionPoolDiagnostics.cs.meta +11 -0
- package/Runtime/Core/Pooling/DxPools.cs +157 -0
- package/Runtime/Core/Pooling/DxPools.cs.meta +11 -0
- package/Runtime/Core/Pooling/EvictionPlayerLoopHook.cs +106 -0
- package/Runtime/Core/Pooling/EvictionPlayerLoopHook.cs.meta +11 -0
- package/Runtime/Core/Pooling/IDxMessagingClock.cs +18 -0
- package/Runtime/Core/Pooling/IDxMessagingClock.cs.meta +11 -0
- package/Runtime/Core/Pooling/PoolDiagnosticsSnapshot.cs +55 -0
- package/Runtime/Core/Pooling/PoolDiagnosticsSnapshot.cs.meta +11 -0
- package/Runtime/Core/Pooling/StopwatchClock.cs +27 -0
- package/Runtime/Core/Pooling/StopwatchClock.cs.meta +11 -0
- package/Runtime/Core/Pooling/UnityRealtimeClock.cs +31 -0
- package/Runtime/Core/Pooling/UnityRealtimeClock.cs.meta +11 -0
- package/Runtime/Core/Pooling.meta +9 -0
- package/Runtime/Core.meta +8 -8
- package/Runtime/Unity/CurrentGlobalMessageBusProvider.cs.meta +12 -12
- package/Runtime/Unity/DxMessagingRuntimeInitializer.cs.meta +11 -11
- package/Runtime/Unity/InitialGlobalMessageBusProvider.cs.meta +12 -12
- package/Runtime/Unity/Integrations/Reflex/AssemblyInfo.cs.meta +11 -3
- package/Runtime/Unity/Integrations/Reflex/ReflexRegistrationInstaller.cs +73 -0
- package/Runtime/Unity/Integrations/Reflex/ReflexRegistrationInstaller.cs.meta +11 -11
- package/Runtime/Unity/Integrations/Reflex/WallstopStudios.DxMessaging.Reflex.asmdef +20 -20
- package/Runtime/Unity/Integrations/Reflex/WallstopStudios.DxMessaging.Reflex.asmdef.meta +7 -7
- package/Runtime/Unity/Integrations/Reflex.meta +8 -8
- package/Runtime/Unity/Integrations/VContainer/AssemblyInfo.cs.meta +11 -3
- package/Runtime/Unity/Integrations/VContainer/VContainerRegistrationExtensions.cs +109 -1
- package/Runtime/Unity/Integrations/VContainer/VContainerRegistrationExtensions.cs.meta +11 -11
- package/Runtime/Unity/Integrations/VContainer/WallstopStudios.DxMessaging.VContainer.asmdef +30 -30
- package/Runtime/Unity/Integrations/VContainer/WallstopStudios.DxMessaging.VContainer.asmdef.meta +7 -7
- package/Runtime/Unity/Integrations/VContainer.meta +8 -8
- package/Runtime/Unity/Integrations/Zenject/AssemblyInfo.cs.meta +11 -3
- package/Runtime/Unity/Integrations/Zenject/WallstopStudios.DxMessaging.Zenject.asmdef +30 -30
- package/Runtime/Unity/Integrations/Zenject/WallstopStudios.DxMessaging.Zenject.asmdef.meta +7 -7
- package/Runtime/Unity/Integrations/Zenject/ZenjectRegistrationInstaller.cs +79 -1
- package/Runtime/Unity/Integrations/Zenject/ZenjectRegistrationInstaller.cs.meta +11 -11
- package/Runtime/Unity/Integrations/Zenject.meta +8 -8
- package/Runtime/Unity/Integrations.meta +8 -8
- package/Runtime/Unity/MessageAwareComponent.cs +74 -0
- package/Runtime/Unity/MessageAwareComponent.cs.meta +11 -11
- package/Runtime/Unity/MessageBusProviderHandle.cs.meta +12 -12
- package/Runtime/Unity/MessagingComponent.cs +43 -10
- package/Runtime/Unity/MessagingComponent.cs.meta +11 -11
- package/Runtime/Unity/MessagingComponentInstaller.cs.meta +12 -12
- package/Runtime/Unity/ScriptableMessageBusProvider.cs.meta +12 -12
- package/Runtime/Unity.meta +8 -8
- package/Runtime/WallstopStudios.DxMessaging.asmdef +14 -14
- package/Runtime/WallstopStudios.DxMessaging.asmdef.meta +7 -7
- package/Runtime.meta +8 -8
- package/Samples~/DI/Prefabs/MessagingInstallerSample.prefab +98 -98
- package/Samples~/DI/Prefabs/MessagingInstallerSample.prefab.meta +7 -7
- package/Samples~/DI/Prefabs.meta +8 -8
- package/Samples~/DI/Providers/GlobalMessageBusProvider.asset +14 -14
- package/Samples~/DI/Providers/GlobalMessageBusProvider.asset.meta +8 -8
- package/Samples~/DI/Providers/InitialGlobalMessageBusProvider.asset +14 -14
- package/Samples~/DI/Providers/InitialGlobalMessageBusProvider.asset.meta +8 -8
- package/Samples~/DI/Providers.meta +8 -8
- package/Samples~/DI/README.md +51 -51
- package/Samples~/DI/README.md.meta +7 -7
- package/Samples~/DI/Reflex/SampleInstaller.cs +7 -0
- package/Samples~/DI/Reflex/SampleInstaller.cs.meta +11 -11
- package/Samples~/DI/Reflex.meta +8 -8
- package/Samples~/DI/VContainer/SampleLifetimeScope.cs +6 -1
- package/Samples~/DI/VContainer/SampleLifetimeScope.cs.meta +11 -11
- package/Samples~/DI/VContainer.meta +8 -8
- package/Samples~/DI/Zenject/SampleInstaller.cs +8 -0
- package/Samples~/DI/Zenject/SampleInstaller.cs.meta +11 -11
- package/Samples~/DI/Zenject.meta +8 -8
- package/Samples~/DI.meta +8 -8
- package/Samples~/Mini Combat/Boot.cs.meta +11 -11
- package/Samples~/Mini Combat/Enemy.cs.meta +11 -11
- package/Samples~/Mini Combat/Messages.cs.meta +11 -11
- package/Samples~/Mini Combat/Player.cs.meta +11 -11
- package/Samples~/Mini Combat/README.md +324 -323
- package/Samples~/Mini Combat/README.md.meta +7 -7
- package/Samples~/Mini Combat/UIOverlay.cs.meta +11 -11
- package/Samples~/Mini Combat/Walkthrough.md +430 -430
- package/Samples~/Mini Combat/Walkthrough.md.meta +7 -7
- package/Samples~/Mini Combat/WallstopStudios.DxMessaging.MiniCombat.Sample.asmdef +13 -13
- package/Samples~/Mini Combat/WallstopStudios.DxMessaging.MiniCombat.Sample.asmdef.meta +7 -7
- package/Samples~/Mini Combat.meta +8 -8
- package/Samples~/UI Buttons + Inspector/DiagnosticsEnabler.cs.meta +11 -11
- package/Samples~/UI Buttons + Inspector/Messages.cs.meta +11 -11
- package/Samples~/UI Buttons + Inspector/MessagingObserver.cs.meta +11 -11
- package/Samples~/UI Buttons + Inspector/README.md +210 -209
- package/Samples~/UI Buttons + Inspector/README.md.meta +7 -7
- package/Samples~/UI Buttons + Inspector/UIButtonEmitter.cs.meta +11 -11
- package/Samples~/UI Buttons + Inspector/WallstopStudios.DxMessaging.UIButtons.Sample.asmdef +13 -13
- package/Samples~/UI Buttons + Inspector/WallstopStudios.DxMessaging.UIButtons.Sample.asmdef.meta +7 -7
- package/Samples~/UI Buttons + Inspector.meta +8 -8
- package/SourceGenerators/Directory.Build.props +50 -3
- package/SourceGenerators/Directory.Build.props.meta +7 -7
- package/SourceGenerators/WallstopStudios.DxMessaging.SourceGenerators/DxAutoConstructorGenerator.cs +96 -63
- package/SourceGenerators/WallstopStudios.DxMessaging.SourceGenerators/DxAutoConstructorGenerator.cs.meta +11 -11
- package/SourceGenerators/WallstopStudios.DxMessaging.SourceGenerators/DxMessageIdGenerator.cs +745 -87
- package/SourceGenerators/WallstopStudios.DxMessaging.SourceGenerators/DxMessageIdGenerator.cs.meta +11 -3
- package/SourceGenerators/WallstopStudios.DxMessaging.SourceGenerators/WallstopStudios.DxMessaging.SourceGenerators.csproj +39 -46
- package/SourceGenerators/WallstopStudios.DxMessaging.SourceGenerators/WallstopStudios.DxMessaging.SourceGenerators.csproj.meta +7 -7
- package/SourceGenerators/WallstopStudios.DxMessaging.SourceGenerators.meta +8 -8
- package/SourceGenerators/global.json +7 -0
- package/SourceGenerators/global.json.meta +7 -0
- package/SourceGenerators.meta +8 -8
- package/Third Party Notices.md +3 -3
- package/Third Party Notices.md.meta +7 -7
- package/package.json +102 -92
- package/package.json.meta +7 -7
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
namespace DxMessaging.Editor
|
|
2
2
|
{
|
|
3
3
|
#if UNITY_EDITOR
|
|
4
|
+
using System;
|
|
4
5
|
using Core;
|
|
5
6
|
using Core.MessageBus;
|
|
6
7
|
using Settings;
|
|
@@ -13,13 +14,30 @@ namespace DxMessaging.Editor
|
|
|
13
14
|
[InitializeOnLoad]
|
|
14
15
|
public static class DxMessagingEditorInitializer
|
|
15
16
|
{
|
|
17
|
+
internal const string DomainReloadWarningMessage =
|
|
18
|
+
"[DxMessaging] Enter Play Mode Options are disabling domain reload. "
|
|
19
|
+
+ "DxMessaging resets its internal statics, but third-party static state will persist. "
|
|
20
|
+
+ "Audit integration code or re-enable domain reload if inconsistent behaviour occurs.";
|
|
21
|
+
|
|
16
22
|
private static bool s_playModeWarningIssued;
|
|
23
|
+
private static bool s_ensureSettingsAssetScheduled;
|
|
24
|
+
|
|
25
|
+
internal static Action StaticStateResetter { get; set; } = DxMessagingStaticState.Reset;
|
|
26
|
+
internal static Func<DxMessagingSettings> PassiveSettingsLoader { get; set; } =
|
|
27
|
+
DxMessagingSettings.LoadSettingsPassive;
|
|
28
|
+
internal static Func<DxMessagingSettings> SettingsAssetEnsurer { get; set; } =
|
|
29
|
+
DxMessagingSettings.GetOrCreateSettings;
|
|
30
|
+
internal static Action<Action> AssetDatabaseMutationScheduler { get; set; } =
|
|
31
|
+
DxMessagingEditorIdle.ScheduleAssetDatabaseMutation;
|
|
32
|
+
internal static Func<bool> DomainReloadDisabledDetector { get; set; } =
|
|
33
|
+
IsDomainReloadDisabled;
|
|
34
|
+
internal static Action<string> DomainReloadWarningLogger { get; set; } =
|
|
35
|
+
message => Debug.LogWarning(message);
|
|
17
36
|
|
|
18
37
|
static DxMessagingEditorInitializer()
|
|
19
38
|
{
|
|
20
39
|
EditorApplication.playModeStateChanged += OnPlayModeStateChanged;
|
|
21
40
|
ApplyEditorSettings();
|
|
22
|
-
WarnIfDomainReloadDisabled();
|
|
23
41
|
}
|
|
24
42
|
|
|
25
43
|
private static void OnPlayModeStateChanged(PlayModeStateChange stateChange)
|
|
@@ -30,7 +48,6 @@ namespace DxMessaging.Editor
|
|
|
30
48
|
)
|
|
31
49
|
{
|
|
32
50
|
ApplyEditorSettings();
|
|
33
|
-
WarnIfDomainReloadDisabled();
|
|
34
51
|
}
|
|
35
52
|
}
|
|
36
53
|
|
|
@@ -45,34 +62,114 @@ namespace DxMessaging.Editor
|
|
|
45
62
|
ApplyEditorSettings();
|
|
46
63
|
}
|
|
47
64
|
|
|
48
|
-
|
|
65
|
+
internal static void ApplyEditorSettings()
|
|
66
|
+
{
|
|
67
|
+
(StaticStateResetter ?? DxMessagingStaticState.Reset)();
|
|
68
|
+
|
|
69
|
+
// Issue #210: ApplyEditorSettings is reachable from the [InitializeOnLoad] static
|
|
70
|
+
// constructor during the domain-load asset-import window, where a synchronous
|
|
71
|
+
// AssetDatabase mutation -- the CreateAsset/SaveAssets/legacy-migration inside
|
|
72
|
+
// GetOrCreateSettings -- can re-enter the importer and hard-crash the native editor
|
|
73
|
+
// (GuidReservations::Reserve abort on Unity 6000.4+). Read current values via a
|
|
74
|
+
// mutation-free passive load now; ensure the asset exists/migrates on the next editor
|
|
75
|
+
// tick, off the import window.
|
|
76
|
+
Func<DxMessagingSettings> passiveSettingsLoader =
|
|
77
|
+
PassiveSettingsLoader ?? DxMessagingSettings.LoadSettingsPassive;
|
|
78
|
+
ApplySettingsAndDiagnostics(passiveSettingsLoader());
|
|
79
|
+
ScheduleEnsureSettingsAsset();
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
private static void ScheduleEnsureSettingsAsset()
|
|
83
|
+
{
|
|
84
|
+
// Debounce: ApplyEditorSettings runs from the cctor and on every play-mode transition,
|
|
85
|
+
// so coalesce to a single pending callback (mirrors the harvester's _rescanScheduled
|
|
86
|
+
// latch) instead of stacking redundant delayCall registrations.
|
|
87
|
+
if (s_ensureSettingsAssetScheduled)
|
|
88
|
+
{
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
s_ensureSettingsAssetScheduled = true;
|
|
92
|
+
Action<Action> scheduler =
|
|
93
|
+
AssetDatabaseMutationScheduler
|
|
94
|
+
?? DxMessagingEditorIdle.ScheduleAssetDatabaseMutation;
|
|
95
|
+
scheduler(EnsureSettingsAssetThenApplyGlobals);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
private static void EnsureSettingsAssetThenApplyGlobals()
|
|
49
99
|
{
|
|
50
|
-
|
|
51
|
-
|
|
100
|
+
// Clear the latch BEFORE the work so a throw still leaves the next ApplyEditorSettings
|
|
101
|
+
// free to reschedule (self-healing). GetOrCreateSettings touches the AssetDatabase, so
|
|
102
|
+
// this callback must only be scheduled through DxMessagingEditorIdle's idle gate. Guard
|
|
103
|
+
// defensively rather than letting an exception escape this editor callback.
|
|
104
|
+
s_ensureSettingsAssetScheduled = false;
|
|
105
|
+
try
|
|
106
|
+
{
|
|
107
|
+
Func<DxMessagingSettings> settingsAssetEnsurer =
|
|
108
|
+
SettingsAssetEnsurer ?? DxMessagingSettings.GetOrCreateSettings;
|
|
109
|
+
ApplySettingsAndDiagnostics(settingsAssetEnsurer());
|
|
110
|
+
}
|
|
111
|
+
catch (Exception ex)
|
|
112
|
+
{
|
|
113
|
+
DxMessagingEditorLog.LogWarning(
|
|
114
|
+
"Deferred settings initialization failed; will retry on the next editor settings refresh.",
|
|
115
|
+
ex
|
|
116
|
+
);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
private static void ApplySettingsAndDiagnostics(DxMessagingSettings settings)
|
|
121
|
+
{
|
|
122
|
+
ApplyGlobals(settings);
|
|
123
|
+
WarnIfDomainReloadDisabled(settings);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
private static void ApplyGlobals(DxMessagingSettings settings)
|
|
127
|
+
{
|
|
128
|
+
if (settings == null)
|
|
129
|
+
{
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
52
132
|
IMessageBus.GlobalDiagnosticsTargets = settings.DiagnosticsTargets;
|
|
53
133
|
IMessageBus.GlobalMessageBufferSize = settings.MessageBufferSize;
|
|
54
134
|
}
|
|
55
135
|
|
|
56
|
-
|
|
136
|
+
internal static void ResetTestSeams()
|
|
137
|
+
{
|
|
138
|
+
s_playModeWarningIssued = false;
|
|
139
|
+
s_ensureSettingsAssetScheduled = false;
|
|
140
|
+
StaticStateResetter = DxMessagingStaticState.Reset;
|
|
141
|
+
PassiveSettingsLoader = DxMessagingSettings.LoadSettingsPassive;
|
|
142
|
+
SettingsAssetEnsurer = DxMessagingSettings.GetOrCreateSettings;
|
|
143
|
+
AssetDatabaseMutationScheduler = DxMessagingEditorIdle.ScheduleAssetDatabaseMutation;
|
|
144
|
+
DomainReloadDisabledDetector = IsDomainReloadDisabled;
|
|
145
|
+
DomainReloadWarningLogger = message => Debug.LogWarning(message);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
private static void WarnIfDomainReloadDisabled(DxMessagingSettings settings)
|
|
57
149
|
{
|
|
58
|
-
|
|
150
|
+
// Missing settings cannot be created from the domain-load passive path. The deferred
|
|
151
|
+
// ensure callback re-enters this method with the realized asset, so an initial null
|
|
152
|
+
// never permanently suppresses an explicitly unsuppressed settings asset.
|
|
59
153
|
if (
|
|
60
154
|
s_playModeWarningIssued
|
|
155
|
+
|| settings == null
|
|
61
156
|
|| settings.SuppressDomainReloadWarning
|
|
62
|
-
|| !
|
|
63
|
-
|| (EditorSettings.enterPlayModeOptions & EnterPlayModeOptions.DisableDomainReload)
|
|
64
|
-
== 0
|
|
157
|
+
|| !(DomainReloadDisabledDetector ?? IsDomainReloadDisabled)()
|
|
65
158
|
)
|
|
66
159
|
{
|
|
67
160
|
return;
|
|
68
161
|
}
|
|
69
162
|
|
|
70
163
|
s_playModeWarningIssued = true;
|
|
71
|
-
Debug.LogWarning
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
164
|
+
Action<string> warningLogger = DomainReloadWarningLogger ?? Debug.LogWarning;
|
|
165
|
+
warningLogger(DomainReloadWarningMessage);
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
private static bool IsDomainReloadDisabled()
|
|
169
|
+
{
|
|
170
|
+
return EditorSettings.enterPlayModeOptionsEnabled
|
|
171
|
+
&& (EditorSettings.enterPlayModeOptions & EnterPlayModeOptions.DisableDomainReload)
|
|
172
|
+
!= 0;
|
|
76
173
|
}
|
|
77
174
|
}
|
|
78
175
|
#endif
|
|
@@ -1,3 +1,11 @@
|
|
|
1
|
-
fileFormatVersion: 2
|
|
2
|
-
guid: b5eeb11bcc9d4d70861d5dc7084daae5
|
|
3
|
-
|
|
1
|
+
fileFormatVersion: 2
|
|
2
|
+
guid: b5eeb11bcc9d4d70861d5dc7084daae5
|
|
3
|
+
MonoImporter:
|
|
4
|
+
externalObjects: {}
|
|
5
|
+
serializedVersion: 2
|
|
6
|
+
defaultReferences: []
|
|
7
|
+
executionOrder: 0
|
|
8
|
+
icon: {instanceID: 0}
|
|
9
|
+
userData:
|
|
10
|
+
assetBundleName:
|
|
11
|
+
assetBundleVariant:
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
namespace DxMessaging.Editor
|
|
2
|
+
{
|
|
3
|
+
#if UNITY_EDITOR
|
|
4
|
+
using System;
|
|
5
|
+
using UnityEngine;
|
|
6
|
+
|
|
7
|
+
internal static class DxMessagingEditorLog
|
|
8
|
+
{
|
|
9
|
+
internal static void LogWarning(string message, Exception exception)
|
|
10
|
+
{
|
|
11
|
+
if (exception == null)
|
|
12
|
+
{
|
|
13
|
+
Debug.LogWarning($"[DxMessaging] {message}");
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
Debug.LogWarning($"[DxMessaging] {message}{Environment.NewLine}{exception}");
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
internal static void LogError(string message, Exception exception)
|
|
21
|
+
{
|
|
22
|
+
if (exception == null)
|
|
23
|
+
{
|
|
24
|
+
Debug.LogError($"[DxMessaging] {message}");
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
Debug.LogError($"[DxMessaging] {message}{Environment.NewLine}{exception}");
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
#endif
|
|
32
|
+
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
fileFormatVersion: 2
|
|
2
|
-
guid: 517da34a8f694371b843ba34f89077d3
|
|
3
|
-
MonoImporter:
|
|
4
|
-
externalObjects: {}
|
|
5
|
-
serializedVersion: 2
|
|
6
|
-
defaultReferences: []
|
|
7
|
-
executionOrder: 0
|
|
8
|
-
icon: {instanceID: 0}
|
|
9
|
-
userData:
|
|
10
|
-
assetBundleName:
|
|
11
|
-
assetBundleVariant:
|
|
1
|
+
fileFormatVersion: 2
|
|
2
|
+
guid: 517da34a8f694371b843ba34f89077d3
|
|
3
|
+
MonoImporter:
|
|
4
|
+
externalObjects: {}
|
|
5
|
+
serializedVersion: 2
|
|
6
|
+
defaultReferences: []
|
|
7
|
+
executionOrder: 0
|
|
8
|
+
icon: {instanceID: 0}
|
|
9
|
+
userData:
|
|
10
|
+
assetBundleName:
|
|
11
|
+
assetBundleVariant:
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
fileFormatVersion: 2
|
|
2
|
-
guid: ec8789213f7f4c30a9353e90fb4345c8
|
|
3
|
-
MonoImporter:
|
|
4
|
-
externalObjects: {}
|
|
5
|
-
serializedVersion: 2
|
|
6
|
-
defaultReferences: []
|
|
7
|
-
executionOrder: 0
|
|
8
|
-
icon: {instanceID: 0}
|
|
9
|
-
userData:
|
|
10
|
-
assetBundleName:
|
|
11
|
-
assetBundleVariant:
|
|
1
|
+
fileFormatVersion: 2
|
|
2
|
+
guid: ec8789213f7f4c30a9353e90fb4345c8
|
|
3
|
+
MonoImporter:
|
|
4
|
+
externalObjects: {}
|
|
5
|
+
serializedVersion: 2
|
|
6
|
+
defaultReferences: []
|
|
7
|
+
executionOrder: 0
|
|
8
|
+
icon: {instanceID: 0}
|
|
9
|
+
userData:
|
|
10
|
+
assetBundleName:
|
|
11
|
+
assetBundleVariant:
|
|
@@ -0,0 +1,313 @@
|
|
|
1
|
+
namespace DxMessaging.Editor.Settings
|
|
2
|
+
{
|
|
3
|
+
#if UNITY_EDITOR
|
|
4
|
+
using System;
|
|
5
|
+
using System.Collections.Generic;
|
|
6
|
+
using System.IO;
|
|
7
|
+
using System.Linq;
|
|
8
|
+
using System.Text;
|
|
9
|
+
using UnityEditor;
|
|
10
|
+
using UnityEngine;
|
|
11
|
+
|
|
12
|
+
/// <summary>
|
|
13
|
+
/// Synchronizes the <see cref="DxMessagingSettings._baseCallIgnoredTypes"/> list to a sidecar
|
|
14
|
+
/// text file shipped to the Roslyn analyzer via <c>csc.rsp</c>'s <c>-additionalfile</c> switch.
|
|
15
|
+
/// </summary>
|
|
16
|
+
/// <remarks>
|
|
17
|
+
/// The sidecar is a build-derived view: never hand-edited, always regenerated from the
|
|
18
|
+
/// ScriptableObject. The analyzer reads it because it cannot parse Unity-serialized YAML.
|
|
19
|
+
/// </remarks>
|
|
20
|
+
public static class DxMessagingBaseCallIgnoreSync
|
|
21
|
+
{
|
|
22
|
+
/// <summary>
|
|
23
|
+
/// Project-relative path to the auto-generated sidecar file. Other Editor scripts
|
|
24
|
+
/// (e.g., <see cref="SetupCscRsp"/>) reference this constant when wiring
|
|
25
|
+
/// <c>-additionalfile</c> entries.
|
|
26
|
+
/// </summary>
|
|
27
|
+
public const string SidecarAssetPath = "Assets/Editor/DxMessaging.BaseCallIgnore.txt";
|
|
28
|
+
|
|
29
|
+
private const string HeaderComment =
|
|
30
|
+
"# Auto-generated from Assets/Editor/DxMessagingSettings.asset; edit there instead.";
|
|
31
|
+
private const string FormatComment =
|
|
32
|
+
"# One fully-qualified type name per line. Lines starting with # are comments.";
|
|
33
|
+
|
|
34
|
+
/// <summary>
|
|
35
|
+
/// Test seam controlling WHEN deferred regeneration runs. Production schedules the work on
|
|
36
|
+
/// the next editor tick via <see cref="EditorApplication.delayCall"/>; tests substitute a
|
|
37
|
+
/// capturing scheduler so they can assert no synchronous AssetDatabase import happens and
|
|
38
|
+
/// then drive the deferred work deterministically without touching the filesystem.
|
|
39
|
+
/// </summary>
|
|
40
|
+
internal static Action<Action> DeferralScheduler { get; set; } =
|
|
41
|
+
work => EditorApplication.delayCall += () => work();
|
|
42
|
+
|
|
43
|
+
/// <summary>
|
|
44
|
+
/// Test seam for Unity editor state. Production uses Unity's update/compile flags; tests
|
|
45
|
+
/// substitute a deterministic busy/idle predicate to prove deferred work requeues.
|
|
46
|
+
/// </summary>
|
|
47
|
+
internal static Func<bool> CanMutateAssetDatabase { get; set; } =
|
|
48
|
+
DxMessaging.Editor.DxMessagingEditorIdle.CanMutateAssetDatabase;
|
|
49
|
+
|
|
50
|
+
/// <summary>
|
|
51
|
+
/// Test seam controlling WHAT regeneration does. Production performs the real
|
|
52
|
+
/// write + <see cref="AssetDatabase.ImportAsset"/> via <see cref="RegenerateSidecarCore"/>;
|
|
53
|
+
/// tests substitute a recorder so they can observe whether the apply happens synchronously
|
|
54
|
+
/// or only after the deferred tick, without writing the on-disk sidecar.
|
|
55
|
+
/// </summary>
|
|
56
|
+
internal static Action<DxMessagingSettings> SidecarApplier { get; set; } =
|
|
57
|
+
RegenerateSidecarCore;
|
|
58
|
+
|
|
59
|
+
/// <summary>
|
|
60
|
+
/// Test seam for the follow-up <c>csc.rsp</c> sync. Production schedules the
|
|
61
|
+
/// <c>-additionalfile</c> normalization after sidecar regeneration, which covers deferred
|
|
62
|
+
/// <c>OnValidate</c> writes that finish after <see cref="SetupCscRsp"/>'s startup pass.
|
|
63
|
+
/// </summary>
|
|
64
|
+
internal static Action CscRspAdditionalFileSyncScheduler { get; set; } =
|
|
65
|
+
ScheduleDefaultCscRspAdditionalFileSync;
|
|
66
|
+
|
|
67
|
+
/// <summary>
|
|
68
|
+
/// Regenerates the sidecar text file from the supplied settings asset. Writes only when
|
|
69
|
+
/// the on-disk content differs from what would be written, matching the
|
|
70
|
+
/// <c>FilesDiffer</c>-style policy used elsewhere in this Editor assembly to avoid
|
|
71
|
+
/// AssetDatabase churn during domain reload.
|
|
72
|
+
/// </summary>
|
|
73
|
+
/// <param name="settings">The settings asset. May be <c>null</c> -- no-op in that case.</param>
|
|
74
|
+
/// <remarks>
|
|
75
|
+
/// This is the entry point for explicit, user-driven edits (the "Ignore this type" button,
|
|
76
|
+
/// settings asset Inspector edits) and for EditMode tests: when Unity is idle the regen runs
|
|
77
|
+
/// synchronously for immediate feedback, and when Unity is mid-compile or mid-asset-import
|
|
78
|
+
/// it falls back to <see cref="RegenerateSidecarDeferred"/>. It MUST NOT be called from a
|
|
79
|
+
/// deserialization callback such as <c>ScriptableObject.OnValidate</c> -- those callbacks
|
|
80
|
+
/// can fire during the domain-load asset-import-worker window where
|
|
81
|
+
/// <see cref="EditorApplication.isUpdating"/> and <see cref="EditorApplication.isCompiling"/>
|
|
82
|
+
/// are both <c>false</c>, so this method would import synchronously and crash the editor
|
|
83
|
+
/// (issue #210). Use <see cref="RegenerateSidecarDeferred"/> from those callbacks instead.
|
|
84
|
+
/// </remarks>
|
|
85
|
+
public static void RegenerateSidecar(DxMessagingSettings settings)
|
|
86
|
+
{
|
|
87
|
+
if (settings == null)
|
|
88
|
+
{
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
if (!CanCurrentlyMutateAssetDatabase())
|
|
93
|
+
{
|
|
94
|
+
RegenerateSidecarDeferred(settings);
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
ApplySidecarAndScheduleCscRspSync(settings);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/// <summary>
|
|
102
|
+
/// Schedules sidecar regeneration for the next editor tick, NEVER writing or importing
|
|
103
|
+
/// synchronously. This is the only safe entry point from
|
|
104
|
+
/// <see cref="ScriptableObject.OnValidate"/> and other asset-deserialization callbacks.
|
|
105
|
+
/// </summary>
|
|
106
|
+
/// <param name="settings">The settings asset. May be <c>null</c> -- no-op in that case.</param>
|
|
107
|
+
/// <remarks>
|
|
108
|
+
/// A synchronous <see cref="AssetDatabase.ImportAsset"/> issued from within asset
|
|
109
|
+
/// deserialization re-enters the asset importer and hard-crashes the native editor
|
|
110
|
+
/// (<c>GuidReservations::Reserve</c> abort, issue #210, observed on Unity 6000.4+). The
|
|
111
|
+
/// dangerous window includes the domain-load asset-import worker, during which
|
|
112
|
+
/// <see cref="EditorApplication.isUpdating"/> and <see cref="EditorApplication.isCompiling"/>
|
|
113
|
+
/// are both <c>false</c> -- so the flag-based guard in <see cref="RegenerateSidecar"/> is
|
|
114
|
+
/// not sufficient on its own and this method defers unconditionally. The captured
|
|
115
|
+
/// <paramref name="settings"/> reference is safe to hold: <see cref="EditorApplication.delayCall"/>
|
|
116
|
+
/// is cleared on domain reload, so the callback never outlives its domain, and the
|
|
117
|
+
/// lifetime-aware null check covers the asset being destroyed (deleted) within the domain.
|
|
118
|
+
/// Scheduling here cannot throw, and the deferred regeneration self-guards via
|
|
119
|
+
/// <see cref="RegenerateSidecarCore"/>'s internal try/catch, so callers such as
|
|
120
|
+
/// <c>OnValidate</c> need no surrounding exception guard.
|
|
121
|
+
/// </remarks>
|
|
122
|
+
internal static void RegenerateSidecarDeferred(DxMessagingSettings settings)
|
|
123
|
+
{
|
|
124
|
+
if (settings == null)
|
|
125
|
+
{
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
DxMessaging.Editor.DxMessagingEditorIdle.ScheduleAssetDatabaseMutation(
|
|
130
|
+
() =>
|
|
131
|
+
{
|
|
132
|
+
if (settings == null)
|
|
133
|
+
{
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
ApplySidecarAndScheduleCscRspSync(settings);
|
|
137
|
+
},
|
|
138
|
+
DeferralScheduler,
|
|
139
|
+
CanCurrentlyMutateAssetDatabase
|
|
140
|
+
);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
private static bool CanCurrentlyMutateAssetDatabase()
|
|
144
|
+
{
|
|
145
|
+
Func<bool> canMutateAssetDatabase =
|
|
146
|
+
CanMutateAssetDatabase
|
|
147
|
+
?? DxMessaging.Editor.DxMessagingEditorIdle.CanMutateAssetDatabase;
|
|
148
|
+
return canMutateAssetDatabase();
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
private static void ApplySidecarAndScheduleCscRspSync(DxMessagingSettings settings)
|
|
152
|
+
{
|
|
153
|
+
try
|
|
154
|
+
{
|
|
155
|
+
SidecarApplier(settings);
|
|
156
|
+
}
|
|
157
|
+
finally
|
|
158
|
+
{
|
|
159
|
+
ScheduleCscRspAdditionalFileSync();
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
private static void ScheduleCscRspAdditionalFileSync()
|
|
164
|
+
{
|
|
165
|
+
try
|
|
166
|
+
{
|
|
167
|
+
Action scheduler =
|
|
168
|
+
CscRspAdditionalFileSyncScheduler ?? ScheduleDefaultCscRspAdditionalFileSync;
|
|
169
|
+
scheduler();
|
|
170
|
+
}
|
|
171
|
+
catch (Exception ex)
|
|
172
|
+
{
|
|
173
|
+
DxMessaging.Editor.DxMessagingEditorLog.LogWarning(
|
|
174
|
+
"Failed to schedule csc.rsp base-call ignore additionalfile sync.",
|
|
175
|
+
ex
|
|
176
|
+
);
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
private static void ScheduleDefaultCscRspAdditionalFileSync()
|
|
181
|
+
{
|
|
182
|
+
DxMessaging.Editor.SetupCscRsp.ScheduleAdditionalFileForIgnoreListSync();
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
private static void RegenerateSidecarCore(DxMessagingSettings settings)
|
|
186
|
+
{
|
|
187
|
+
if (settings == null)
|
|
188
|
+
{
|
|
189
|
+
return;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
try
|
|
193
|
+
{
|
|
194
|
+
string newContent = BuildContent(settings._baseCallIgnoredTypes);
|
|
195
|
+
string absolutePath = GetAbsolutePath();
|
|
196
|
+
EnsureParentDirectoryExists(absolutePath);
|
|
197
|
+
|
|
198
|
+
if (File.Exists(absolutePath))
|
|
199
|
+
{
|
|
200
|
+
string existing = File.ReadAllText(absolutePath);
|
|
201
|
+
if (string.Equals(existing, newContent, StringComparison.Ordinal))
|
|
202
|
+
{
|
|
203
|
+
return;
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
File.WriteAllText(absolutePath, newContent);
|
|
208
|
+
AssetDatabase.ImportAsset(SidecarAssetPath);
|
|
209
|
+
}
|
|
210
|
+
catch (Exception ex)
|
|
211
|
+
{
|
|
212
|
+
DxMessaging.Editor.DxMessagingEditorLog.LogWarning(
|
|
213
|
+
$"Failed to write base-call ignore sidecar at '{SidecarAssetPath}'.",
|
|
214
|
+
ex
|
|
215
|
+
);
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
/// <summary>
|
|
220
|
+
/// Reads the sidecar file and returns its non-comment, non-blank entries.
|
|
221
|
+
/// Tolerant of a missing file (returns an empty list) and of <c>#</c>-prefixed comment lines.
|
|
222
|
+
/// </summary>
|
|
223
|
+
public static IReadOnlyList<string> ReadSidecar()
|
|
224
|
+
{
|
|
225
|
+
try
|
|
226
|
+
{
|
|
227
|
+
string absolutePath = GetAbsolutePath();
|
|
228
|
+
if (!File.Exists(absolutePath))
|
|
229
|
+
{
|
|
230
|
+
return Array.Empty<string>();
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
List<string> entries = new();
|
|
234
|
+
foreach (string rawLine in File.ReadAllLines(absolutePath))
|
|
235
|
+
{
|
|
236
|
+
if (string.IsNullOrWhiteSpace(rawLine))
|
|
237
|
+
{
|
|
238
|
+
continue;
|
|
239
|
+
}
|
|
240
|
+
string trimmed = rawLine.Trim();
|
|
241
|
+
if (trimmed.Length == 0 || trimmed[0] == '#')
|
|
242
|
+
{
|
|
243
|
+
continue;
|
|
244
|
+
}
|
|
245
|
+
entries.Add(trimmed);
|
|
246
|
+
}
|
|
247
|
+
return entries;
|
|
248
|
+
}
|
|
249
|
+
catch (Exception ex)
|
|
250
|
+
{
|
|
251
|
+
DxMessaging.Editor.DxMessagingEditorLog.LogWarning(
|
|
252
|
+
$"Failed to read base-call ignore sidecar at '{SidecarAssetPath}'.",
|
|
253
|
+
ex
|
|
254
|
+
);
|
|
255
|
+
return Array.Empty<string>();
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
internal static string BuildContent(IList<string> ignoredTypes)
|
|
260
|
+
{
|
|
261
|
+
StringBuilder builder = new();
|
|
262
|
+
builder.Append(HeaderComment).Append('\n');
|
|
263
|
+
builder.Append(FormatComment).Append('\n');
|
|
264
|
+
|
|
265
|
+
if (ignoredTypes == null)
|
|
266
|
+
{
|
|
267
|
+
return builder.ToString();
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
// Deterministic order for git-friendly diffs; deduplicate while preserving the user's
|
|
271
|
+
// typed casing where possible (Ordinal sort with Ordinal-set dedupe).
|
|
272
|
+
HashSet<string> seen = new(StringComparer.Ordinal);
|
|
273
|
+
List<string> sorted = new(ignoredTypes.Count);
|
|
274
|
+
foreach (string entry in ignoredTypes)
|
|
275
|
+
{
|
|
276
|
+
if (string.IsNullOrWhiteSpace(entry))
|
|
277
|
+
{
|
|
278
|
+
continue;
|
|
279
|
+
}
|
|
280
|
+
string trimmed = entry.Trim();
|
|
281
|
+
if (seen.Add(trimmed))
|
|
282
|
+
{
|
|
283
|
+
sorted.Add(trimmed);
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
sorted.Sort(StringComparer.Ordinal);
|
|
287
|
+
|
|
288
|
+
foreach (string entry in sorted)
|
|
289
|
+
{
|
|
290
|
+
builder.Append(entry).Append('\n');
|
|
291
|
+
}
|
|
292
|
+
return builder.ToString();
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
private static string GetAbsolutePath()
|
|
296
|
+
{
|
|
297
|
+
// Application.dataPath ends in "/Assets"; SidecarAssetPath begins with "Assets/".
|
|
298
|
+
string projectRoot = Path.GetFullPath(Path.Combine(Application.dataPath, ".."))
|
|
299
|
+
.Replace("\\", "/");
|
|
300
|
+
return Path.Combine(projectRoot, SidecarAssetPath).Replace("\\", "/");
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
private static void EnsureParentDirectoryExists(string absolutePath)
|
|
304
|
+
{
|
|
305
|
+
string directory = Path.GetDirectoryName(absolutePath);
|
|
306
|
+
if (!string.IsNullOrEmpty(directory) && !Directory.Exists(directory))
|
|
307
|
+
{
|
|
308
|
+
Directory.CreateDirectory(directory);
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
#endif
|
|
313
|
+
}
|