private static bool CanBind(BindingProviderContext context)
        {
            if (context == null)
            {
                throw new ArgumentNullException("context");
            }

            // first, verify the file path binding (if it contains binding parameters)
            ParameterInfo parameter = context.Parameter;
            FileAttribute attribute = parameter.GetCustomAttribute <FileAttribute>(inherit: false);
            BindablePath  path      = new BindablePath(attribute.Path);

            path.ValidateContractCompatibility(context.BindingDataContract);

            // next, verify that the type is one of the types we support
            IEnumerable <Type> types = StreamValueBinder.SupportedTypes.Union(new Type[] { typeof(FileStream) });

            return(ValueBinder.MatchParameterType(parameter, types));
        }
        public Task <IValueProvider> BindAsync(BindingContext context)
        {
            if (context == null)
            {
                throw new ArgumentNullException("context");
            }

            FileInfo fileInfo = null;

            if (context != null)
            {
                BindablePath path          = new BindablePath(_attribute.Path);
                string       boundFileName = path.Bind(context.BindingData);
                string       filePath      = Path.Combine(_config.RootPath, boundFileName);
                fileInfo = new FileInfo(filePath);
            }

            return(BindAsync(fileInfo, context.ValueContext));
        }