From a2fc7a24fe5c4dd428bd2444ba4387b29bdc7101 Mon Sep 17 00:00:00 2001 From: Morten Aune Lyrstad <4653628+malware-dev@users.noreply.github.com> Date: Sun, 30 Apr 2023 09:55:56 +0200 Subject: [PATCH] Fixed outdated whitelist. Upped version. Attempt to fix the docgen not being able to extract all actions and properties now (currently failure) --- Source/DocGen.sln.DotSettings | 2 + .../WhitelistAndTerminalCachesView.xaml | 2 +- .../IngameScriptTemplate/MDK/whitelist.cache | 153 +++++++++++++++--- Source/MDK/MDKPackage.GeneratedInfo.cs | 2 +- Source/MDK/source.extension.vsixmanifest | 2 +- Source/MDKAnalyzer/whitelist.cache | 7 + Source/MDKAnalyzer_Legacy/whitelist.cache | 134 +++++++++++++-- .../Digi/TempBlockSpawn.cs | 136 ++++++++++++++++ .../MDKWhitelistExtractor/ExtractorPlugin.cs | 115 +++++++++---- .../MDKWhitelistExtractor.csproj | 9 ++ .../MDKProjectProperties.GeneratedInfo.cs | 2 +- 11 files changed, 495 insertions(+), 69 deletions(-) create mode 100644 Source/DocGen.sln.DotSettings create mode 100644 Source/MDKWhitelistExtractor/Digi/TempBlockSpawn.cs diff --git a/Source/DocGen.sln.DotSettings b/Source/DocGen.sln.DotSettings new file mode 100644 index 0000000..bed70be --- /dev/null +++ b/Source/DocGen.sln.DotSettings @@ -0,0 +1,2 @@ + + OB \ No newline at end of file diff --git a/Source/DocGen2/WhitelistAndTerminalCachesView.xaml b/Source/DocGen2/WhitelistAndTerminalCachesView.xaml index 66b00f9..eee9e38 100644 --- a/Source/DocGen2/WhitelistAndTerminalCachesView.xaml +++ b/Source/DocGen2/WhitelistAndTerminalCachesView.xaml @@ -24,7 +24,7 @@ Text="{Binding StatusText}" Margin="8" /> This operation will start the game and use a plugin to extract certain information only available through a running game. - The plugin will shut town the game automatically when its job is complete. + The plugin will shut down the game automatically when its job is complete. \ No newline at end of file diff --git a/Source/IngameScriptTemplate/MDK/whitelist.cache b/Source/IngameScriptTemplate/MDK/whitelist.cache index da31af9..5435797 100644 --- a/Source/IngameScriptTemplate/MDK/whitelist.cache +++ b/Source/IngameScriptTemplate/MDK/whitelist.cache @@ -1,13 +1,109 @@ System.Collections.*, mscorlib -System.Collections.Generic.*, mscorlib System.Collections.Generic.*, System.Core System.Collections.Generic.*, System -System.Collections.Concurrent.*, mscorlib -System.Collections.Concurrent.*, System -System.Linq.*, System.Core +System.Collections.Generic.*, mscorlib System.Text.*, mscorlib System.Text.RegularExpressions.*, System System.Globalization.*, mscorlib +System.Linq.IQueryable+*, System.Core +System.Linq.IQueryable+*, System.Core +System.Linq.IQueryProvider+*, System.Core +System.Linq.IOrderedQueryable+*, System.Core +System.Linq.IOrderedQueryable+*, System.Core +System.Linq.Queryable+*, System.Core +System.Linq.Enumerable+*, System.Core +System.Linq.EmptyEnumerable+*, System.Core +System.Linq.IdentityFunction+*, System.Core +System.Linq.IOrderedEnumerable+*, System.Core +System.Linq.IGrouping+*, System.Core +System.Linq.ILookup+*, System.Core +System.Linq.Lookup+*, System.Core +System.Linq.Set+*, System.Core +System.Linq.GroupedEnumerable+*, System.Core +System.Linq.GroupedEnumerable+*, System.Core +System.Linq.OrderedEnumerable+*, System.Core +System.Linq.OrderedEnumerable+*, System.Core +System.Linq.EnumerableSorter+*, System.Core +System.Linq.EnumerableSorter+*, System.Core +System.Linq.Buffer+*, System.Core +System.Linq.SystemCore_EnumerableDebugView+*, System.Core +System.Linq.SystemCore_EnumerableDebugViewEmptyException+*, System.Core +System.Linq.SystemCore_EnumerableDebugView+*, System.Core +System.Linq.IIListProvider+*, System.Core +System.Linq.SingleLinkedNode+*, System.Core +System.Linq.EnumerableQuery+*, System.Core +System.Linq.EnumerableQuery+*, System.Core +System.Linq.EnumerableExecutor+*, System.Core +System.Linq.EnumerableExecutor+*, System.Core +System.Linq.EnumerableRewriter+*, System.Core +System.Linq.TypeHelper+*, System.Core +System.Linq.Strings+*, System.Core +System.Linq.Error+*, System.Core +System.Linq.AggregationMinMaxHelpers+*, System.Core +System.Linq.SRDescriptionAttribute+*, System.Core +System.Linq.SRCategoryAttribute+*, System.Core +System.Linq.SR+*, System.Core +System.Linq.Enumerable.Iterator+*, System.Core +System.Linq.Enumerable.WhereEnumerableIterator+*, System.Core +System.Linq.Enumerable.WhereArrayIterator+*, System.Core +System.Linq.Enumerable.WhereListIterator+*, System.Core +System.Linq.Enumerable.SelectEnumerableIterator+*, System.Core +System.Linq.Enumerable.WhereSelectEnumerableIterator+*, System.Core +System.Linq.Enumerable.WhereSelectArrayIterator+*, System.Core +System.Linq.Enumerable.WhereSelectListIterator+*, System.Core +System.Linq.Enumerable.AppendPrependIterator+*, System.Core +System.Linq.Enumerable.AppendPrepend1Iterator+*, System.Core +System.Linq.Enumerable.AppendPrependN+*, System.Core +System.Linq.Enumerable.d__2+*, System.Core +System.Linq.Enumerable.d__5+*, System.Core +System.Linq.Enumerable.<>c__DisplayClass6_0+*, System.Core +System.Linq.Enumerable.<>c__DisplayClass7_0+*, System.Core +System.Linq.Enumerable.d__17+*, System.Core +System.Linq.Enumerable.d__19+*, System.Core +System.Linq.Enumerable.d__21+*, System.Core +System.Linq.Enumerable.d__23+*, System.Core +System.Linq.Enumerable.d__25+*, System.Core +System.Linq.Enumerable.d__27+*, System.Core +System.Linq.Enumerable.d__29+*, System.Core +System.Linq.Enumerable.d__31+*, System.Core +System.Linq.Enumerable.d__33+*, System.Core +System.Linq.Enumerable.d__35+*, System.Core +System.Linq.Enumerable.d__38+*, System.Core +System.Linq.Enumerable.d__41+*, System.Core +System.Linq.Enumerable.d__59+*, System.Core +System.Linq.Enumerable.d__61+*, System.Core +System.Linq.Enumerable.d__64+*, System.Core +System.Linq.Enumerable.d__67+*, System.Core +System.Linq.Enumerable.d__70+*, System.Core +System.Linq.Enumerable.d__73+*, System.Core +System.Linq.Enumerable.d__75+*, System.Core +System.Linq.Enumerable.d__93+*, System.Core +System.Linq.Enumerable.d__95+*, System.Core +System.Linq.Enumerable.d__97+*, System.Core +System.Linq.Enumerable.d__113+*, System.Core +System.Linq.Enumerable.d__115+*, System.Core +System.Linq.IdentityFunction.<>c+*, System.Core +System.Linq.Lookup.Grouping+*, System.Core +System.Linq.Lookup.d__12+*, System.Core +System.Linq.Lookup.d__13+*, System.Core +System.Linq.Set.Slot+*, System.Core +System.Linq.OrderedEnumerable.d__1+*, System.Core +System.Linq.EnumerableRewriter.<>c__DisplayClass9_0+*, System.Core +System.Linq.EnumerableRewriter.<>c+*, System.Core +System.Linq.EnumerableRewriter.<>c__DisplayClass10_0+*, System.Core +System.Linq.ParallelEnumerable.<>c__10+*, System.Core +System.Linq.ParallelEnumerable.<>c__DisplayClass47_0+*, System.Core +System.Linq.ParallelEnumerable.<>c__DisplayClass48_0+*, System.Core +System.Linq.ParallelEnumerable.<>c__DisplayClass49_0+*, System.Core +System.Linq.ParallelEnumerable.<>c__DisplayClass50_0+*, System.Core +System.Linq.ParallelEnumerable.<>c__51+*, System.Core +System.Linq.ParallelEnumerable.<>c__149+*, System.Core +System.Linq.AggregationMinMaxHelpers.<>c__DisplayClass3_0+*, System.Core +System.Linq.AggregationMinMaxHelpers.<>c__DisplayClass4_0+*, System.Core +System.Linq.AggregationMinMaxHelpers.<>c+*, System.Core +System.Linq.ParallelQuery.<>c__1+*, System.Core +System.Linq.ParallelQuery.<>c__2+*, System.Core +System.Linq.Lookup.Grouping.d__7+*, System.Core object+*, mscorlib System.IDisposable+*, mscorlib string+*, mscorlib @@ -51,9 +147,6 @@ System.Xml.Serialization.XmlRootAttribute+*, System.Xml System.Xml.Serialization.XmlTextAttribute+*, System.Xml System.Xml.Serialization.XmlTypeAttribute+*, System.Xml System.Runtime.CompilerServices.RuntimeHelpers+*, mscorlib -System.IO.Stream+*, mscorlib -System.IO.TextWriter+*, mscorlib -System.IO.TextReader+*, mscorlib System.IO.BinaryReader+*, mscorlib System.IO.BinaryWriter+*, mscorlib System.NullReferenceException+*, mscorlib @@ -80,6 +173,13 @@ System.StringSplitOptions+*, mscorlib System.DateTimeKind+*, mscorlib System.MidpointRounding+*, mscorlib System.EventArgs+*, mscorlib +System.Buffer+*, mscorlib +System.ComponentModel.INotifyPropertyChanging+*, System +System.ComponentModel.PropertyChangingEventHandler+*, System +System.ComponentModel.PropertyChangingEventArgs+*, System +System.ComponentModel.INotifyPropertyChanged+*, System +System.ComponentModel.PropertyChangedEventHandler+*, System +System.ComponentModel.PropertyChangedEventArgs+*, System System.Reflection.MemberInfo, mscorlib System.Reflection.MemberInfo.Name, mscorlib System.Type, mscorlib @@ -150,25 +250,32 @@ System.Func+*, System.Core System.Func+*, System.Core SpaceEngineers.Game.ModAPI.Ingame.*, SpaceEngineers.Game +SpaceEngineers.Game.ModAPI.Ingame.*, SpaceEngineers.ObjectBuilders System.Collections.Generic.*, VRage.Library VRage.Game.ModAPI.Ingame.*, VRage.Game +VRage.Game.ModAPI.Ingame.Utilities.*, VRage.Game Sandbox.ModAPI.Ingame.*, Sandbox.Common VRageMath.*, VRage.Math +VRage.Game.GUI.TextPanel.*, VRage.Game +SpaceEngineers.Game.ModAPI.Ingame.IMyTurretControlBlock+*, Sandbox.Common Sandbox.Game.Gui.TerminalActionExtensions+*, Sandbox.Game Sandbox.ModAPI.Interfaces.ITerminalAction+*, Sandbox.Common Sandbox.ModAPI.Interfaces.ITerminalProperty+*, Sandbox.Common Sandbox.ModAPI.Interfaces.ITerminalProperty+*, Sandbox.Common Sandbox.ModAPI.Interfaces.TerminalPropertyExtensions+*, Sandbox.Common Sandbox.Game.Localization.MySpaceTexts+*, Sandbox.Game +System.Text.StringBuilderExtensions_Format+*, VRage.Library VRage.MyFixedPoint+*, VRage.Library -VRage.MyTexts, VRage -VRage.MyTexts.GetString(string), VRage -VRage.MyTexts.GetString(VRage.Utils.MyStringId), VRage -VRage.MyTexts.Exists(VRage.Utils.MyStringId), VRage -VRage.MyTexts.Get(VRage.Utils.MyStringId), VRage -VRage.MyTexts.AppendFormat(System.Text.StringBuilder, VRage.Utils.MyStringId, object), VRage -VRage.MyTexts.Languages, VRage -VRage.MyTexts.LanguageDescription+*, VRage +VRage.MyTuple+*, VRage.Library +VRage.MyTuple+*, VRage.Library +VRage.MyTuple+*, VRage.Library +VRage.MyTuple+*, VRage.Library +VRage.MyTuple+*, VRage.Library +VRage.MyTuple+*, VRage.Library +VRage.MyTuple+*, VRage.Library +VRage.MyTupleComparer+*, VRage.Library +VRage.MyTupleComparer+*, VRage.Library +VRage.MyTexts.MyLanguageDescription+*, VRage VRage.MyLanguagesEnum+*, VRage VRage.Game.Components.MyComponentContainer, VRage.Game VRage.Game.Components.MyComponentContainer.TryGet(out T), VRage.Game @@ -181,9 +288,14 @@ VRage.Game.MyRelationsBetweenPlayerAndBlock+*, VRage.Game VRage.Game.MyRelationsBetweenPlayerAndBlockExtensions+*, VRage.Game VRage.Game.Components.MyResourceSourceComponentBase+*, VRage.Game VRage.Game.ObjectBuilders.Definitions.MyObjectBuilder_GasProperties+*, VRage.Game -VRage.ObjectBuilders.MyObjectBuilder_Base+*, VRage.Game -VRage.Game.Components.MyComponentBase+*, VRage.Game VRage.ObjectBuilders.SerializableDefinitionId+*, VRage.Game +VRage.Game.MyCubeSize+*, VRage.Game +VRage.Game.Components.MyComponentBase, VRage.Game +VRage.Game.Components.MyComponentBase.GetAs(), VRage.Game +VRage.Game.Components.MyComponentBase.ContainerBase, VRage.Game +VRage.ObjectBuilders.MyObjectBuilder_Base, VRage.Game +VRage.ObjectBuilders.MyObjectBuilder_Base.TypeId, VRage.Game +VRage.ObjectBuilders.MyObjectBuilder_Base.SubtypeId, VRage.Game Sandbox.Game.EntityComponents.MyResourceSourceComponent, Sandbox.Game Sandbox.Game.EntityComponents.MyResourceSourceComponent.CurrentOutput, Sandbox.Game Sandbox.Game.EntityComponents.MyResourceSourceComponent.MaxOutput, Sandbox.Game @@ -191,6 +303,7 @@ Sandbox.Game.EntityComponents.MyResourceSourceComponent.DefinedOutput, Sandbox.G Sandbox.Game.EntityComponents.MyResourceSourceComponent.ProductionEnabled, Sandbox.Game Sandbox.Game.EntityComponents.MyResourceSourceComponent.RemainingCapacity, Sandbox.Game Sandbox.Game.EntityComponents.MyResourceSourceComponent.HasCapacityRemaining, Sandbox.Game +Sandbox.Game.EntityComponents.MyResourceSourceComponent.ResourceTypes, Sandbox.Game Sandbox.Game.EntityComponents.MyResourceSinkComponent, Sandbox.Game Sandbox.Game.EntityComponents.MyResourceSinkComponent.AcceptedResources, Sandbox.Game Sandbox.Game.EntityComponents.MyResourceSinkComponent.RequiredInput, Sandbox.Game @@ -204,4 +317,8 @@ VRage.Game.Components.MyResourceSinkComponentBase.IsPowerAvailable(VRage.Game.My VRage.Game.Components.MyResourceSinkComponentBase.IsPoweredByType(VRage.Game.MyDefinitionId), VRage.Game VRage.Game.Components.MyResourceSinkComponentBase.MaxRequiredInputByType(VRage.Game.MyDefinitionId), VRage.Game VRage.Game.Components.MyResourceSinkComponentBase.RequiredInputByType(VRage.Game.MyDefinitionId), VRage.Game -VRage.Game.Components.MyResourceSinkComponentBase.SuppliedRatioByType(VRage.Game.MyDefinitionId), VRage.Game \ No newline at end of file +VRage.Game.Components.MyResourceSinkComponentBase.SuppliedRatioByType(VRage.Game.MyDefinitionId), VRage.Game +System.ArrayExtensions, VRage.Library +System.ArrayExtensions.Contains(T[], T), VRage.Library +VRage.Game.ModAPI.Ingame.MyPhysicalInventoryItemExtensions_ModAPI+*, Sandbox.Game +System.Collections.Immutable.*, System.Collections.Immutable \ No newline at end of file diff --git a/Source/MDK/MDKPackage.GeneratedInfo.cs b/Source/MDK/MDKPackage.GeneratedInfo.cs index d73670b..ab8e4fb 100644 --- a/Source/MDK/MDKPackage.GeneratedInfo.cs +++ b/Source/MDK/MDKPackage.GeneratedInfo.cs @@ -10,7 +10,7 @@ public partial class MDKPackage /// /// The current package version /// - public static readonly Version Version = new Version("1.4.13"); + public static readonly Version Version = new Version("1.4.14"); /// /// The required IDE version diff --git a/Source/MDK/source.extension.vsixmanifest b/Source/MDK/source.extension.vsixmanifest index f301e8d..e405ab8 100644 --- a/Source/MDK/source.extension.vsixmanifest +++ b/Source/MDK/source.extension.vsixmanifest @@ -1,7 +1,7 @@  - + MDK/SE A toolkit to help with ingame script (programmable block) development for Keen Software House's space sandbox Space Engineers. diff --git a/Source/MDKAnalyzer/whitelist.cache b/Source/MDKAnalyzer/whitelist.cache index 856beca..5435797 100644 --- a/Source/MDKAnalyzer/whitelist.cache +++ b/Source/MDKAnalyzer/whitelist.cache @@ -174,6 +174,12 @@ System.DateTimeKind+*, mscorlib System.MidpointRounding+*, mscorlib System.EventArgs+*, mscorlib System.Buffer+*, mscorlib +System.ComponentModel.INotifyPropertyChanging+*, System +System.ComponentModel.PropertyChangingEventHandler+*, System +System.ComponentModel.PropertyChangingEventArgs+*, System +System.ComponentModel.INotifyPropertyChanged+*, System +System.ComponentModel.PropertyChangedEventHandler+*, System +System.ComponentModel.PropertyChangedEventArgs+*, System System.Reflection.MemberInfo, mscorlib System.Reflection.MemberInfo.Name, mscorlib System.Type, mscorlib @@ -251,6 +257,7 @@ VRage.Game.ModAPI.Ingame.Utilities.*, VRage.Game Sandbox.ModAPI.Ingame.*, Sandbox.Common VRageMath.*, VRage.Math VRage.Game.GUI.TextPanel.*, VRage.Game +SpaceEngineers.Game.ModAPI.Ingame.IMyTurretControlBlock+*, Sandbox.Common Sandbox.Game.Gui.TerminalActionExtensions+*, Sandbox.Game Sandbox.ModAPI.Interfaces.ITerminalAction+*, Sandbox.Common Sandbox.ModAPI.Interfaces.ITerminalProperty+*, Sandbox.Common diff --git a/Source/MDKAnalyzer_Legacy/whitelist.cache b/Source/MDKAnalyzer_Legacy/whitelist.cache index e03d85f..5435797 100644 --- a/Source/MDKAnalyzer_Legacy/whitelist.cache +++ b/Source/MDKAnalyzer_Legacy/whitelist.cache @@ -1,13 +1,109 @@ System.Collections.*, mscorlib -System.Collections.Generic.*, mscorlib System.Collections.Generic.*, System.Core System.Collections.Generic.*, System -System.Collections.Concurrent.*, mscorlib -System.Collections.Concurrent.*, System -System.Linq.*, System.Core +System.Collections.Generic.*, mscorlib System.Text.*, mscorlib System.Text.RegularExpressions.*, System System.Globalization.*, mscorlib +System.Linq.IQueryable+*, System.Core +System.Linq.IQueryable+*, System.Core +System.Linq.IQueryProvider+*, System.Core +System.Linq.IOrderedQueryable+*, System.Core +System.Linq.IOrderedQueryable+*, System.Core +System.Linq.Queryable+*, System.Core +System.Linq.Enumerable+*, System.Core +System.Linq.EmptyEnumerable+*, System.Core +System.Linq.IdentityFunction+*, System.Core +System.Linq.IOrderedEnumerable+*, System.Core +System.Linq.IGrouping+*, System.Core +System.Linq.ILookup+*, System.Core +System.Linq.Lookup+*, System.Core +System.Linq.Set+*, System.Core +System.Linq.GroupedEnumerable+*, System.Core +System.Linq.GroupedEnumerable+*, System.Core +System.Linq.OrderedEnumerable+*, System.Core +System.Linq.OrderedEnumerable+*, System.Core +System.Linq.EnumerableSorter+*, System.Core +System.Linq.EnumerableSorter+*, System.Core +System.Linq.Buffer+*, System.Core +System.Linq.SystemCore_EnumerableDebugView+*, System.Core +System.Linq.SystemCore_EnumerableDebugViewEmptyException+*, System.Core +System.Linq.SystemCore_EnumerableDebugView+*, System.Core +System.Linq.IIListProvider+*, System.Core +System.Linq.SingleLinkedNode+*, System.Core +System.Linq.EnumerableQuery+*, System.Core +System.Linq.EnumerableQuery+*, System.Core +System.Linq.EnumerableExecutor+*, System.Core +System.Linq.EnumerableExecutor+*, System.Core +System.Linq.EnumerableRewriter+*, System.Core +System.Linq.TypeHelper+*, System.Core +System.Linq.Strings+*, System.Core +System.Linq.Error+*, System.Core +System.Linq.AggregationMinMaxHelpers+*, System.Core +System.Linq.SRDescriptionAttribute+*, System.Core +System.Linq.SRCategoryAttribute+*, System.Core +System.Linq.SR+*, System.Core +System.Linq.Enumerable.Iterator+*, System.Core +System.Linq.Enumerable.WhereEnumerableIterator+*, System.Core +System.Linq.Enumerable.WhereArrayIterator+*, System.Core +System.Linq.Enumerable.WhereListIterator+*, System.Core +System.Linq.Enumerable.SelectEnumerableIterator+*, System.Core +System.Linq.Enumerable.WhereSelectEnumerableIterator+*, System.Core +System.Linq.Enumerable.WhereSelectArrayIterator+*, System.Core +System.Linq.Enumerable.WhereSelectListIterator+*, System.Core +System.Linq.Enumerable.AppendPrependIterator+*, System.Core +System.Linq.Enumerable.AppendPrepend1Iterator+*, System.Core +System.Linq.Enumerable.AppendPrependN+*, System.Core +System.Linq.Enumerable.d__2+*, System.Core +System.Linq.Enumerable.d__5+*, System.Core +System.Linq.Enumerable.<>c__DisplayClass6_0+*, System.Core +System.Linq.Enumerable.<>c__DisplayClass7_0+*, System.Core +System.Linq.Enumerable.d__17+*, System.Core +System.Linq.Enumerable.d__19+*, System.Core +System.Linq.Enumerable.d__21+*, System.Core +System.Linq.Enumerable.d__23+*, System.Core +System.Linq.Enumerable.d__25+*, System.Core +System.Linq.Enumerable.d__27+*, System.Core +System.Linq.Enumerable.d__29+*, System.Core +System.Linq.Enumerable.d__31+*, System.Core +System.Linq.Enumerable.d__33+*, System.Core +System.Linq.Enumerable.d__35+*, System.Core +System.Linq.Enumerable.d__38+*, System.Core +System.Linq.Enumerable.d__41+*, System.Core +System.Linq.Enumerable.d__59+*, System.Core +System.Linq.Enumerable.d__61+*, System.Core +System.Linq.Enumerable.d__64+*, System.Core +System.Linq.Enumerable.d__67+*, System.Core +System.Linq.Enumerable.d__70+*, System.Core +System.Linq.Enumerable.d__73+*, System.Core +System.Linq.Enumerable.d__75+*, System.Core +System.Linq.Enumerable.d__93+*, System.Core +System.Linq.Enumerable.d__95+*, System.Core +System.Linq.Enumerable.d__97+*, System.Core +System.Linq.Enumerable.d__113+*, System.Core +System.Linq.Enumerable.d__115+*, System.Core +System.Linq.IdentityFunction.<>c+*, System.Core +System.Linq.Lookup.Grouping+*, System.Core +System.Linq.Lookup.d__12+*, System.Core +System.Linq.Lookup.d__13+*, System.Core +System.Linq.Set.Slot+*, System.Core +System.Linq.OrderedEnumerable.d__1+*, System.Core +System.Linq.EnumerableRewriter.<>c__DisplayClass9_0+*, System.Core +System.Linq.EnumerableRewriter.<>c+*, System.Core +System.Linq.EnumerableRewriter.<>c__DisplayClass10_0+*, System.Core +System.Linq.ParallelEnumerable.<>c__10+*, System.Core +System.Linq.ParallelEnumerable.<>c__DisplayClass47_0+*, System.Core +System.Linq.ParallelEnumerable.<>c__DisplayClass48_0+*, System.Core +System.Linq.ParallelEnumerable.<>c__DisplayClass49_0+*, System.Core +System.Linq.ParallelEnumerable.<>c__DisplayClass50_0+*, System.Core +System.Linq.ParallelEnumerable.<>c__51+*, System.Core +System.Linq.ParallelEnumerable.<>c__149+*, System.Core +System.Linq.AggregationMinMaxHelpers.<>c__DisplayClass3_0+*, System.Core +System.Linq.AggregationMinMaxHelpers.<>c__DisplayClass4_0+*, System.Core +System.Linq.AggregationMinMaxHelpers.<>c+*, System.Core +System.Linq.ParallelQuery.<>c__1+*, System.Core +System.Linq.ParallelQuery.<>c__2+*, System.Core +System.Linq.Lookup.Grouping.d__7+*, System.Core object+*, mscorlib System.IDisposable+*, mscorlib string+*, mscorlib @@ -51,9 +147,6 @@ System.Xml.Serialization.XmlRootAttribute+*, System.Xml System.Xml.Serialization.XmlTextAttribute+*, System.Xml System.Xml.Serialization.XmlTypeAttribute+*, System.Xml System.Runtime.CompilerServices.RuntimeHelpers+*, mscorlib -System.IO.Stream+*, mscorlib -System.IO.TextWriter+*, mscorlib -System.IO.TextReader+*, mscorlib System.IO.BinaryReader+*, mscorlib System.IO.BinaryWriter+*, mscorlib System.NullReferenceException+*, mscorlib @@ -81,6 +174,12 @@ System.DateTimeKind+*, mscorlib System.MidpointRounding+*, mscorlib System.EventArgs+*, mscorlib System.Buffer+*, mscorlib +System.ComponentModel.INotifyPropertyChanging+*, System +System.ComponentModel.PropertyChangingEventHandler+*, System +System.ComponentModel.PropertyChangingEventArgs+*, System +System.ComponentModel.INotifyPropertyChanged+*, System +System.ComponentModel.PropertyChangedEventHandler+*, System +System.ComponentModel.PropertyChangedEventArgs+*, System System.Reflection.MemberInfo, mscorlib System.Reflection.MemberInfo.Name, mscorlib System.Type, mscorlib @@ -157,12 +256,15 @@ VRage.Game.ModAPI.Ingame.*, VRage.Game VRage.Game.ModAPI.Ingame.Utilities.*, VRage.Game Sandbox.ModAPI.Ingame.*, Sandbox.Common VRageMath.*, VRage.Math +VRage.Game.GUI.TextPanel.*, VRage.Game +SpaceEngineers.Game.ModAPI.Ingame.IMyTurretControlBlock+*, Sandbox.Common Sandbox.Game.Gui.TerminalActionExtensions+*, Sandbox.Game Sandbox.ModAPI.Interfaces.ITerminalAction+*, Sandbox.Common Sandbox.ModAPI.Interfaces.ITerminalProperty+*, Sandbox.Common Sandbox.ModAPI.Interfaces.ITerminalProperty+*, Sandbox.Common Sandbox.ModAPI.Interfaces.TerminalPropertyExtensions+*, Sandbox.Common Sandbox.Game.Localization.MySpaceTexts+*, Sandbox.Game +System.Text.StringBuilderExtensions_Format+*, VRage.Library VRage.MyFixedPoint+*, VRage.Library VRage.MyTuple+*, VRage.Library VRage.MyTuple+*, VRage.Library @@ -173,14 +275,7 @@ VRage.MyTuple+*, VRage.Library VRage.MyTuple+*, VRage.Library VRage.MyTupleComparer+*, VRage.Library VRage.MyTupleComparer+*, VRage.Library -VRage.MyTexts, VRage -VRage.MyTexts.GetString(string), VRage -VRage.MyTexts.GetString(VRage.Utils.MyStringId), VRage -VRage.MyTexts.Exists(VRage.Utils.MyStringId), VRage -VRage.MyTexts.Get(VRage.Utils.MyStringId), VRage -VRage.MyTexts.AppendFormat(System.Text.StringBuilder, VRage.Utils.MyStringId, object), VRage -VRage.MyTexts.Languages, VRage -VRage.MyTexts.LanguageDescription+*, VRage +VRage.MyTexts.MyLanguageDescription+*, VRage VRage.MyLanguagesEnum+*, VRage VRage.Game.Components.MyComponentContainer, VRage.Game VRage.Game.Components.MyComponentContainer.TryGet(out T), VRage.Game @@ -193,9 +288,11 @@ VRage.Game.MyRelationsBetweenPlayerAndBlock+*, VRage.Game VRage.Game.MyRelationsBetweenPlayerAndBlockExtensions+*, VRage.Game VRage.Game.Components.MyResourceSourceComponentBase+*, VRage.Game VRage.Game.ObjectBuilders.Definitions.MyObjectBuilder_GasProperties+*, VRage.Game -VRage.Game.Components.MyComponentBase+*, VRage.Game VRage.ObjectBuilders.SerializableDefinitionId+*, VRage.Game VRage.Game.MyCubeSize+*, VRage.Game +VRage.Game.Components.MyComponentBase, VRage.Game +VRage.Game.Components.MyComponentBase.GetAs(), VRage.Game +VRage.Game.Components.MyComponentBase.ContainerBase, VRage.Game VRage.ObjectBuilders.MyObjectBuilder_Base, VRage.Game VRage.ObjectBuilders.MyObjectBuilder_Base.TypeId, VRage.Game VRage.ObjectBuilders.MyObjectBuilder_Base.SubtypeId, VRage.Game @@ -206,6 +303,7 @@ Sandbox.Game.EntityComponents.MyResourceSourceComponent.DefinedOutput, Sandbox.G Sandbox.Game.EntityComponents.MyResourceSourceComponent.ProductionEnabled, Sandbox.Game Sandbox.Game.EntityComponents.MyResourceSourceComponent.RemainingCapacity, Sandbox.Game Sandbox.Game.EntityComponents.MyResourceSourceComponent.HasCapacityRemaining, Sandbox.Game +Sandbox.Game.EntityComponents.MyResourceSourceComponent.ResourceTypes, Sandbox.Game Sandbox.Game.EntityComponents.MyResourceSinkComponent, Sandbox.Game Sandbox.Game.EntityComponents.MyResourceSinkComponent.AcceptedResources, Sandbox.Game Sandbox.Game.EntityComponents.MyResourceSinkComponent.RequiredInput, Sandbox.Game @@ -221,4 +319,6 @@ VRage.Game.Components.MyResourceSinkComponentBase.MaxRequiredInputByType(VRage.G VRage.Game.Components.MyResourceSinkComponentBase.RequiredInputByType(VRage.Game.MyDefinitionId), VRage.Game VRage.Game.Components.MyResourceSinkComponentBase.SuppliedRatioByType(VRage.Game.MyDefinitionId), VRage.Game System.ArrayExtensions, VRage.Library -System.ArrayExtensions.Contains(T[], T), VRage.Library \ No newline at end of file +System.ArrayExtensions.Contains(T[], T), VRage.Library +VRage.Game.ModAPI.Ingame.MyPhysicalInventoryItemExtensions_ModAPI+*, Sandbox.Game +System.Collections.Immutable.*, System.Collections.Immutable \ No newline at end of file diff --git a/Source/MDKWhitelistExtractor/Digi/TempBlockSpawn.cs b/Source/MDKWhitelistExtractor/Digi/TempBlockSpawn.cs new file mode 100644 index 0000000..08f9deb --- /dev/null +++ b/Source/MDKWhitelistExtractor/Digi/TempBlockSpawn.cs @@ -0,0 +1,136 @@ +using System; +using Sandbox.Definitions; +using Sandbox.Game.Entities; +using Sandbox.ModAPI; +using VRage; +using VRage.Game; +using VRage.Game.ModAPI; +using VRage.ModAPI; +using VRage.ObjectBuilders; +using VRage.Utils; +using VRageMath; + +// Thanks, Digi, for providing me with this class. +// A minimum of alteration on my part to match my specific needs in this utility. + +namespace Digi.BuildInfo.Features.LiveData +{ + public struct TempBlockSpawn + { + public static void Spawn(MyCubeBlockDefinition def, bool deleteGridOnSpawn = true, Action callback = null) + { + new TempBlockSpawn(def, deleteGridOnSpawn, callback); + } + + readonly bool _deleteGrid; + readonly MyCubeBlockDefinition _blockDef; + readonly Action _callback; + + TempBlockSpawn(MyCubeBlockDefinition def, bool deleteGridOnSpawn = true, Action callback = null) + { + _blockDef = def; + _deleteGrid = deleteGridOnSpawn; + _callback = callback; + + MatrixD camMatrix = MyAPIGateway.Session.Camera.WorldMatrix; + Vector3D spawnPos = camMatrix.Translation + camMatrix.Backward * 100; + + MyObjectBuilder_CubeBlock blockOB = CreateBlockOB(def.Id); + + MyObjectBuilder_CubeGrid gridOB = new MyObjectBuilder_CubeGrid() + { + CreatePhysics = false, + GridSizeEnum = def.CubeSize, + PositionAndOrientation = new MyPositionAndOrientation(spawnPos, Vector3.Forward, Vector3.Up), + PersistentFlags = MyPersistentEntityFlags2.InScene, + IsStatic = true, + Editable = false, + DestructibleBlocks = false, + IsRespawnGrid = false, + Name = "BuildInfo_TemporaryGrid", + }; + + gridOB.CubeBlocks.Add(blockOB); + + // not really required for a single grid. + //MyAPIGateway.Entities.RemapObjectBuilder(gridOB); + + MyCubeGrid grid = (MyCubeGrid)MyAPIGateway.Entities.CreateFromObjectBuilderParallel(gridOB, true, SpawnCompleted); + grid.DisplayName = grid.Name; + grid.IsPreview = true; + grid.Save = false; + grid.Flags = EntityFlags.None; + grid.Render.Visible = false; + } + + MyObjectBuilder_CubeBlock CreateBlockOB(MyDefinitionId defId) + { + MyObjectBuilder_CubeBlock blockObj = (MyObjectBuilder_CubeBlock)MyObjectBuilderSerializer.CreateNewObject(defId); + + blockObj.EntityId = 0; + blockObj.Min = Vector3I.Zero; + +#if false + // NOTE these types do not check if their fields are null in their Remap() method. + MyObjectBuilder_TimerBlock timer = blockObj as MyObjectBuilder_TimerBlock; + if(timer != null) + { + timer.Toolbar = BuildInfoMod.Instance.Caches.EmptyToolbarOB; + return blockObj; + } + + MyObjectBuilder_ButtonPanel button = blockObj as MyObjectBuilder_ButtonPanel; + if(button != null) + { + button.Toolbar = BuildInfoMod.Instance.Caches.EmptyToolbarOB; + return blockObj; + } + + MyObjectBuilder_SensorBlock sensor = blockObj as MyObjectBuilder_SensorBlock; + if(sensor != null) + { + sensor.Toolbar = BuildInfoMod.Instance.Caches.EmptyToolbarOB; + return blockObj; + } + + // prohibited... + //MyObjectBuilder_TargetDummyBlock targetDummy = blockObj as MyObjectBuilder_TargetDummyBlock; + //if(targetDummy != null) + //{ + // targetDummy.Toolbar = BuildInfoMod.Instance.Caches.EmptyToolbarOB; + // return blockObj; + //} +#endif + + return blockObj; + } + + void SpawnCompleted(IMyEntity ent) + { + IMyCubeGrid grid = ent as IMyCubeGrid; + + try + { + IMySlimBlock block = grid?.GetCubeBlock(Vector3I.Zero); + if (block == null) + { + MyLog.Default.Error($"Can't get block from spawned entity for block: {_blockDef.Id.ToString()}; grid={grid?.EntityId.ToString() ?? "(NULL)"};)"); + return; + } + + _callback?.Invoke(block); + } + catch (Exception e) + { + MyLog.Default.Error(e.ToString()); + } + finally + { + if (_deleteGrid && grid != null) + { + grid.Close(); + } + } + } + } +} \ No newline at end of file diff --git a/Source/MDKWhitelistExtractor/ExtractorPlugin.cs b/Source/MDKWhitelistExtractor/ExtractorPlugin.cs index f29bbf3..dfd2cd5 100644 --- a/Source/MDKWhitelistExtractor/ExtractorPlugin.cs +++ b/Source/MDKWhitelistExtractor/ExtractorPlugin.cs @@ -1,4 +1,5 @@ -using System; +using Digi.BuildInfo.Features.LiveData; +using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Diagnostics; @@ -8,11 +9,17 @@ using System.Threading.Tasks; using System.Xml.Linq; using Sandbox; +using Sandbox.Definitions; using Sandbox.Game.Entities.Cube; using Sandbox.Game.World; +using Sandbox.Graphics.GUI; using Sandbox.ModAPI; using Sandbox.ModAPI.Interfaces; using SpaceEngineers.Game; +using SpaceEngineers.Game.GUI; +using System.Text; +using VRage; +using VRage.Game.ModAPI; using VRage.Plugins; using VRage.Scripting; using VRage.Utils; @@ -32,18 +39,26 @@ public void Dispose() { } public void Init(object gameInstance) { + Debugger.Launch(); + MyLog.Default.Info("Extractor Plugin Loaded."); _commandLine = new CommandLine(Environment.CommandLine); Game = (SpaceEngineersGame)gameInstance; } - public void Update() + public async void Update() { if (_firstInit) { _firstInit = false; - MySession.AfterLoading += MySession_AfterLoading; - MySessionLoader.LoadInventoryScene(); + await Task.Delay(TimeSpan.FromSeconds(1)); + MySandboxGame.Static.Invoke(() => + { + MySession.AfterLoading += MySession_AfterLoading; + var screen = MyScreenManager.GetFirstScreenOfType(); + var button = (MyGuiControlButton)screen.Controls.FirstOrDefault(c => c is MyGuiControlButton button && MyTexts.Get(MyCommonTexts.ScreenMenuButtonInventory).EqualsStrFast(button.Text)); + button.PressButton(); + }, "ExtractorPlugin"); } } @@ -78,24 +93,70 @@ void GrabTerminalActions(CommandLine commandLine) var targetsArgument = commandLine[targetsArgumentIndex + 1]; var targets = targetsArgument.Split(';'); - var gameAssembly = Game.GetType().Assembly; - var blockTypes = FindBlocks(gameAssembly).ToArray(); + //var gameAssembly = Game.GetType().Assembly; + //var blockTypes = FindBlocks(gameAssembly).ToArray(); var blocks = new List(); var experimentalMode = MySandboxGame.Config.ExperimentalMode; MySandboxGame.Config.ExperimentalMode = true; try { - foreach (var blockType in blockTypes) + // +MyCubeBlockDefinition + foreach (var definition in MyDefinitionManager.Static.GetAllDefinitions()) { - var instance = (IMyTerminalBlock)Activator.CreateInstance(blockType); - var actions = new List(new List()); - var properties = new List(); - instance.GetActions(actions); - instance.GetProperties(properties); - var blockInfo = new BlockInfo(blockType, FindTypeDefinition(blockType), FindInterface(blockType), actions, properties); - if (blockInfo.BlockInterfaceType != null && blocks.All(b => b.BlockInterfaceType != blockInfo.BlockInterfaceType)) - blocks.Add(blockInfo); + if (definition is MyCubeBlockDefinition cbd) + { + TempBlockSpawn.Spawn(cbd, callback: slim => + { + if (slim.FatBlock is not IMyTerminalBlock block) + return; + var infoAttribute = block.GetType().GetCustomAttribute(); + if (infoAttribute == null) + { + MyLog.Default.Info($"Could not get any info for {cbd.Id} because there's no interface attribute"); + return; + } + + var ingameType = infoAttribute.LinkedTypes.FirstOrDefault(t => t.Namespace?.EndsWith(".Ingame") ?? false); + if (ingameType == null) + { + MyLog.Default.Info($"Could not get any info for {cbd.Id} because there's no ingame interface in the interface attribute"); + return; + } + + + var actions = new List(new List()); + var properties = new List(); + block.GetActions(actions); + block.GetProperties(properties); + + MyLog.Default.Info($"Got {actions.Count} actions and {properties.Count} properties from {cbd.Id}"); + + //instance.GetActions(actions); + //instance.GetProperties(properties); + var blockInfo = new BlockInfo(block.GetType(), FindTypeDefinition(block.GetType()), ingameType, actions, properties); + if (blockInfo.BlockInterfaceType != null && blocks.All(b => b.BlockInterfaceType != blockInfo.BlockInterfaceType)) + blocks.Add(blockInfo); + }); + } } + + + // var terminalController = (IMyTerminalActionsHelper)MyTerminalControlFactoryHelper.Static; + // foreach (var blockType in blockTypes) + // { + // //var instance = (IMyTerminalBlock)Activator.CreateInstance(blockType); + // var actions = new List(new List()); + // var properties = new List(); + // terminalController.GetActions(blockType, actions); + // terminalController.GetProperties(blockType, properties); + // MyLog.Default.Info($"Got {actions.Count} actions and {properties.Count} properties from {blockType.Name}"); + + // //instance.GetActions(actions); + // //instance.GetProperties(properties); + // var blockInfo = new BlockInfo(blockType, FindTypeDefinition(blockType), FindInterface(blockType), actions, properties); + // if (blockInfo.BlockInterfaceType != null && blocks.All(b => b.BlockInterfaceType != blockInfo.BlockInterfaceType)) + // blocks.Add(blockInfo); + // } } finally { @@ -122,15 +183,17 @@ void WriteTerminals(List blocks, string[] targets) document.Save(target); } - void MySession_AfterLoading() + async void MySession_AfterLoading() { - GrabWhitelist(_commandLine); - GrabTerminalActions(_commandLine); - Task.Run(async () => + await Task.Delay(TimeSpan.FromSeconds(1)); + + MySandboxGame.Static.Invoke(() => { - await Task.Delay(TimeSpan.FromSeconds(5)); - MySandboxGame.ExitThreadSafe(); - }); + GrabWhitelist(_commandLine); + GrabTerminalActions(_commandLine); + }, "ExtractorPlugin"); + await Task.Delay(TimeSpan.FromSeconds(3)); + MySandboxGame.ExitThreadSafe(); } string FindTypeDefinition(Type block) @@ -145,14 +208,6 @@ Type FindInterface(Type block) { var attr = block.GetCustomAttribute(); return attr?.LinkedTypes.FirstOrDefault(l => l.Namespace?.EndsWith(".Ingame", StringComparison.OrdinalIgnoreCase) ?? false); - - //var interfaces = block.GetInterfaces().Where(i => typeof(IMyTerminalBlock).IsAssignableFrom(i) && (i.Namespace?.EndsWith(".Ingame") ?? false)).ToArray(); - //var candidateInterfaces = interfaces.Where(iface => - // /* bad interface inheritance workaround */ - // iface != typeof(IMyTerminalBlock) && iface != typeof(IMyFunctionalBlock) && - // /* workaround end */ - // !interfaces.Any(i => iface != i && iface.IsAssignableFrom(i))).ToArray(); - //return candidateInterfaces.SingleOrDefault(); } IEnumerable FindBlocks(Assembly gameAssembly, HashSet visitedAssemblies = null) diff --git a/Source/MDKWhitelistExtractor/MDKWhitelistExtractor.csproj b/Source/MDKWhitelistExtractor/MDKWhitelistExtractor.csproj index bf8b6f1..b52f6c0 100644 --- a/Source/MDKWhitelistExtractor/MDKWhitelistExtractor.csproj +++ b/Source/MDKWhitelistExtractor/MDKWhitelistExtractor.csproj @@ -54,6 +54,10 @@ $(SEBinPath)\Sandbox.Game.dll False + + $(SEBinPath)\Sandbox.Graphics.dll + False + $(SEBinPath)\SpaceEngineers.Game.dll False @@ -74,9 +78,14 @@ $(SEBinPath)\VRage.Scripting.dll False + + $(SEBinPath)\VRage.Math.dll + False + + diff --git a/Source/Mixin.MDKProjectProperties/MDKProjectProperties.GeneratedInfo.cs b/Source/Mixin.MDKProjectProperties/MDKProjectProperties.GeneratedInfo.cs index 83b297d..464b733 100644 --- a/Source/Mixin.MDKProjectProperties/MDKProjectProperties.GeneratedInfo.cs +++ b/Source/Mixin.MDKProjectProperties/MDKProjectProperties.GeneratedInfo.cs @@ -7,6 +7,6 @@ partial class MDKProjectProperties /// /// The current package version this utility assembly targets /// - public static readonly Version TargetPackageVersion = new Version("1.4.13"); + public static readonly Version TargetPackageVersion = new Version("1.4.14"); } }