コード例 #1
0
 public Telescope(string telescopeId) : base(telescopeId)
 {
     if (DriverLoader.AscomInterfaces(Impl.GetType()).Contains(typeof(ITelescopeV3)))
     {
         isPlatform6Telescope = true;
     }
     TL.LogMessage("Telescope", "Platform 5 Telescope: " + isPlatform5Telescope.ToString() + " Platform 6 Telescope: " + isPlatform6Telescope.ToString());
 }
コード例 #2
0
 virtual protected bool validateResult(object result)
 {
     if (result != null && DriverLoader.IsDriver(result.GetType()))
     {
         logger?.LogInformation($"Service type request successful");
         return(true);
     }
     logger?.LogInformation($"Service type request failed");
     return(false);
 }
コード例 #3
0
        virtual protected bool valdateRequestType(Type serviceType)
        {
            bool   result     = false;
            string driverName = serviceType?.FullName ?? "{null}";

            logger?.LogInformation($"Type requested: {driverName}");
            if (!DriverLoader.IsDriver(serviceType))
            {
                logger?.LogInformation($"Invalid type request: '{driverName ?? "null"}', not a driver type");
            }
            else if (serviceType.IsInterface)
            {
                logger?.LogInformation($"Invalid type request: '{driverName}', request typemust be a concrete implmentation class");
            }
            else if (DriverLoader.IsApiType(serviceType))
            {
                logger?.LogInformation($"Invalid type request: '{driverName}', request type cannot be a drvier API type ");
            }
            else
            {
                result = true;
            }
            return(result);
        }
コード例 #4
0
 public DriverApiService(IServiceProvider service) : base(service)
 {
     Selector = (Type dType) => { return(DriverLoader.GetApiDriver(dType)); };
 }
コード例 #5
0
 public DriverImplementationService(IServiceProvider service) : base(service)
 {
     Selector = (Type dType) => { return(DriverLoader.GetImplementation(dType)); };
 }