File tree Expand file tree Collapse file tree 1 file changed +21
-1
lines changed
managed/CounterStrikeSharp.API/Core/Plugin Expand file tree Collapse file tree 1 file changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -204,6 +204,26 @@ public void Load(bool hotReload = false)
204204
205205 if ( Plugin == null ) throw new Exception ( "Unable to create plugin instance" ) ;
206206
207+ /* Version Priority order:
208+ * ModuleVersion override
209+ * Assembly.GetName().Version
210+ * "<unknown>"
211+ */
212+ if ( Plugin is BasePlugin basePlugin )
213+ {
214+ // if no override we look for assembly version
215+ if ( basePlugin . _version == "<unknown>" )
216+ {
217+ Version ? assemblyVersion = defaultAssembly . GetName ( ) . Version ;
218+
219+ // if its set, we use that, otherwise it remains "<unknown>"
220+ if ( assemblyVersion != null )
221+ {
222+ basePlugin . _version = assemblyVersion . ToString ( ) ;
223+ }
224+ }
225+ }
226+
207227 State = PluginState . Loading ;
208228
209229 Plugin . ModulePath = _path ;
@@ -241,4 +261,4 @@ public void Unload(bool hotReload = false)
241261 _logger . LogInformation ( "Finished unloading plugin {Name}" , cachedName ) ;
242262 }
243263 }
244- }
264+ }
You can’t perform that action at this time.
0 commit comments