Beispiel #1
0
 public ImplDescriptor(IImplDescriptor other)
 {
     Name        = other.Name;
     Description = other.Description;
     Type        = other.Type;
     Plugin      = other.Plugin;
     Manager     = other.Manager;
 }
        private TImpl GetImplInstance <TImpl, TProvidedImpl, TProvider>(IImplDescriptor descriptor) where TProvider : IProvider <TProvidedImpl> where TProvidedImpl : IProvided, TImpl where TImpl : class
        {
            var providing = descriptor as ProvidedImplDescriptor;

            if (providing != null)
            {
                return(providing.Instance as TImpl);
            }
            return(_Container.GetExports <TImpl, IImplDescriptor>().FirstOrDefault(entry => entry.Metadata.Type.FullName.Equals(descriptor.Type.FullName))?.Value);
        }
Beispiel #3
0
 internal override InflateResult Inflate(PluginManager pluginManager)
 {
     if (!string.IsNullOrEmpty(Type))
     {
         _Descriptor = pluginManager.GetBooleanBoundPropertyDescriptor(Type);
         if (_Descriptor != null)
         {
             _Impl = pluginManager.GetBooleanBoundPropertyInstance(_Descriptor);
             if (_Impl != null)
             {
                 _Impl.Deserialize(Any);
             }
             else
             {
                 return(InflateResult.WithError(string.Format("Failed to find BooleanBoundProperty instance for type \"{0}\"", _Descriptor.Type.FullName)));
             }
         }
     }
     return(InflateResult.Default);
 }
 public StringBoundProperty GetStringBoundPropertyInstance(IImplDescriptor descriptor)
 {
     return(GetImplInstance <StringBoundProperty, ProvidedStringBoundProperty, StringBoundPropertyProvider>(descriptor));
 }
 public BooleanBoundProperty GetBooleanBoundPropertyInstance(IImplDescriptor descriptor)
 {
     return(GetImplInstance <BooleanBoundProperty, ProvidedBooleanBoundProperty, BooleanBoundPropertyProvider>(descriptor));
 }
 public FloatBoundProperty GetFloatBoundPropertyInstance(IImplDescriptor descriptor)
 {
     return(GetImplInstance <FloatBoundProperty, ProvidedFloatBoundProperty, FloatBoundPropertyProvider>(descriptor));
 }
 public ActionExecutable GetActionInstance(IImplDescriptor descriptor)
 {
     return(GetImplInstance <ActionExecutable, ProvidedActionExecutable, ActionExecutableProvider>(descriptor));
 }