22using FlowSynx . Plugins . Azure . Files . Models ;
33using FlowSynx . Plugins . Azure . Files . Services ;
44using FlowSynx . PluginCore . Extensions ;
5+ using FlowSynx . PluginCore . Helpers ;
56
67namespace FlowSynx . Plugins . Azure . Files ;
78
89public class AzureFilePlugin : IPlugin
910{
1011 private IAzureFilesManager _manager = null ! ;
1112 private AzureFilesSpecifications ? _azureFilesSpecifications ;
13+ private bool _isInitialized ;
1214
1315 public PluginMetadata Metadata
1416 {
@@ -31,16 +33,26 @@ public PluginMetadata Metadata
3133
3234 public Task Initialize ( IPluginLogger logger )
3335 {
36+ if ( ReflectionHelper . IsCalledViaReflection ( ) )
37+ throw new InvalidOperationException ( Resources . ReflectionBasedAccessIsNotAllowed ) ;
38+
3439 ArgumentNullException . ThrowIfNull ( logger ) ;
3540 var connection = new AzureFilesConnection ( ) ;
3641 _azureFilesSpecifications = Specifications . ToObject < AzureFilesSpecifications > ( ) ;
3742 var client = connection . Connect ( _azureFilesSpecifications ) ;
3843 _manager = new AzureFilesManager ( logger , client ) ;
44+ _isInitialized = true ;
3945 return Task . CompletedTask ;
4046 }
4147
4248 public async Task < object ? > ExecuteAsync ( PluginParameters parameters , CancellationToken cancellationToken )
4349 {
50+ if ( ReflectionHelper . IsCalledViaReflection ( ) )
51+ throw new InvalidOperationException ( Resources . ReflectionBasedAccessIsNotAllowed ) ;
52+
53+ if ( ! _isInitialized )
54+ throw new InvalidOperationException ( $ "Plugin '{ Metadata . Name } ' v{ Metadata . Version } is not initialized.") ;
55+
4456 var operationParameter = parameters . ToObject < OperationParameter > ( ) ;
4557 var operation = operationParameter . Operation ;
4658
0 commit comments