Ejemplo n.º 1
0
 public static void SetChannelAttribute(uint handle, ChannelAttribute attribute, float value)
 {
     if (!BASS_ChannelSetAttribute(handle, (uint)attribute, value))
     {
         throw new BassException($"ChannelSetAttribute failed");
     }
 }
Ejemplo n.º 2
0
 public ChannelItemFilterContext(MemberInfo member, JsonSchemaResolver schemaResolver, JsonSchemaGenerator schemaGenerator, ChannelAttribute channel)
 {
     Member          = member;
     SchemaResolver  = schemaResolver;
     SchemaGenerator = schemaGenerator;
     Channel         = channel;
 }
Ejemplo n.º 3
0
 public static void SetChannelAttribute(this BassHandle handle, ChannelAttribute attribute, float value)
 {
     if (!handle.BASS_ChannelSetAttribute(attribute, value))
     {
         throw new BassException("ChannelSetAttribute failed");
     }
 }
Ejemplo n.º 4
0
        public static double GetChannelAttribute(int Handle, ChannelAttribute attrib)
        {
            float temp = 0;

            BASS_ChannelGetAttribute(Handle, attrib, ref temp);
            return(temp);
        }
Ejemplo n.º 5
0
        private static Type SetTitle(object channel, RssFeed f)
        {
            Type             type        = channel.GetType();
            ChannelAttribute channelAttr = null;

            if (type.HasCustomAttributeOfType <ChannelAttribute>(out channelAttr))
            {
                if (!string.IsNullOrEmpty(channelAttr.Title))
                {
                    f.Channel.Title = channelAttr.Title;
                }
            }

            if (string.IsNullOrEmpty(f.Channel.Title))
            {
                PropertyInfo prop = type.GetFirstProperyWithAttributeOfType <TitleAttribute>();
                if (prop != null)
                {
                    f.Channel.Title = (string)prop.GetValue(channel, null);
                }
                else
                {
                    f.Channel.Title = channel.ToString();
                }
            }

            return(type);
        }
Ejemplo n.º 6
0
        public static float GetChannelAttribute(this BassHandle handle, ChannelAttribute attribute)
        {
            if (!handle.BASS_ChannelGetAttribute(attribute, out var value))
            {
                throw new BassException("ChannelGetAttribute failed");
            }

            return(value);
        }
Ejemplo n.º 7
0
        public static float GetChannelAttribute(uint handle, ChannelAttribute attribute)
        {
            var value = 0.0f;

            if (!BASS_ChannelGetAttribute(handle, (uint)attribute, ref value))
            {
                throw new BassException($"ChannelGetAttribute failed");
            }

            return(value);
        }
Ejemplo n.º 8
0
        public List <ChannelDocument> GetDocumentation(AppDomain domain)
        {
            Debug.Assert(_services.Get <IChannelLocator>() != null);

            List <Type> channels = _services.Get <IChannelLocator>().RegisteredChannels(domain);

            foreach (var channel in channels)
            {
                ChannelDocument  channelDoc         = new ChannelDocument();
                ChannelAttribute channelAttr        = channel.GetCustomAttribute <ChannelAttribute>();
                string           channelDescription = channelAttr.Description == null ? string.Empty : channelAttr.Description.ToString();
                string           channelName        = String.IsNullOrEmpty(channelAttr.Name) ? channel.Name : channelAttr.Name;
                string           channelRoute       = $"~/channels/{channelName}";
                MethodInfo[]     methods            = channel.GetMethods().Where(x => x.GetCustomAttribute <ChannelMethodAttribute>() != null).ToArray();
                ChannelMethodDocs = new List <ChannelMethodDocument>();
                foreach (var method in methods)
                {
                    ChannelMethodDocument  methodDocument         = new ChannelMethodDocument();
                    ChannelMethodInfo      description            = _services.Get <IChannelMethodDescriptor>().GetMethodDescription(method);
                    ChannelMethodAttribute ChannelMethodAttribute = method.GetCustomAttribute <ChannelMethodAttribute>();
                    ChannelHttpMethod      HttpMethod             = ChannelMethodAttribute.HttpMethod;
                    string[] names = description.Parameters.Select(x => x.Name).ToArray();
                    Type[]   types = description.Parameters.Select(x => x.Type).ToArray();
                    methodDocument.HttpMethod          = HttpMethod;
                    methodDocument.InputParameters     = names;
                    methodDocument.InputParameterTypes = types;
                    methodDocument.ReturnTypeName      = method.ReturnType.Name;
                    methodDocument.ReturnType          = method.ReturnType;
                    methodDocument.URL         = $"{channelRoute}/{method.Name}/";
                    methodDocument.AuthSchema  = ChannelMethodAttribute.Schema;
                    methodDocument.Description = ChannelMethodAttribute.Description; //null possibility

                    ChannelMethodDocs.Add(methodDocument);
                }
                channelDoc.Name               = channel.Name;
                channelDoc.Description        = channelDescription; //null possibility
                channelDoc.URL                = channelRoute;
                channelDoc.AvailableEndpoints = ChannelMethodDocs;

                ChannelDocs.Add(channelDoc);
            }


            return(ChannelDocs);
        }
Ejemplo n.º 9
0
 public ChannelItemFilterContext(MethodInfo method, ISchemaRepository schemaRepository, ChannelAttribute channel)
 {
     Method           = method;
     SchemaRepository = schemaRepository;
     Channel          = channel;
 }
Ejemplo n.º 10
0
        public ChannelConfigurationInfo Configure(HttpListener httpChannel, Type channel, MethodInfo method, string baseURL)
        {
            ChannelEndpoint  endpoint    = new ChannelEndpoint();
            ChannelAttribute channelAttr = channel.GetCustomAttribute <ChannelAttribute>();

            if (!String.IsNullOrEmpty(channelAttr.Name))
            {
                endpoint.URL = "/channels/" + channelAttr.Name + "/" + method.Name + "/";
            }
            else
            {
                endpoint.URL = "/channels/" + channel.Name + "/" + method.Name + "/";
            }

            endpoint.Name = channel.Name + "." + method.Name;

            ChannelMethodAttribute       channelMethod = method.GetCustomAttribute <ChannelMethodAttribute>();
            AuthorizeChannelAttribute    authAttr      = channel.GetCustomAttribute <AuthorizeChannelAttribute>();
            ChannelAuthenticationSchemes channelSchema = channelMethod.Schema;
            ChannelHttpMethod            httpMethod    = channelMethod.HttpMethod;

            string methodURL = string.Empty;

            if (baseURL == null)
            {
                methodURL = "http://localhost:4200" + endpoint.URL;
            }
            else
            {
                methodURL = baseURL + endpoint.URL;
            }

            bool httpAuthRequired = false;

            //Start hosting
            httpChannel.Prefixes.Add(methodURL);
            if (authAttr != null)
            {
                if (authAttr.Schema != ChannelAuthenticationSchemes.Anonymous)
                {
                    httpAuthRequired = true;
                }
            }
            //ChannelMethod can override ChannelAttribute Authentication Schemes
            if (channelSchema != ChannelAuthenticationSchemes.Anonymous)
            {
                httpAuthRequired = true;
            }
            else
            {
                if (authAttr != null)
                {
                    channelSchema = authAttr.Schema;
                }
            }

            return(new ChannelConfigurationInfo
            {
                ChannelAttribute = channelAttr,
                MethodAttribute = channelMethod,
                MethodUrl = methodURL,
                HttpMethod = httpMethod,
                AuthScheme = channelSchema,
                AuthorizeAttribute = authAttr,
                AuthenticationRequired = httpAuthRequired,
                Endpoint = endpoint
            });
        }
Ejemplo n.º 11
0
        /// <exception cref="NotAvailableException">Channel object is no longer available.</exception>
        /// <exception cref="BassErrorException">
        ///     Some error occur to call a Bass function, check the error code and error message
        ///     to get more error information.
        /// </exception>
        /// <exception cref="BassNotLoadedException">
        ///     Bass DLL not loaded, you must use <see cref="BassManager.Initialize" /> to
        ///     load Bass DLL first.
        /// </exception>
        void IChannelInternal.SetAttribute(ChannelAttribute attribute, float value)
        {
            CheckAvailable();

            ChannelModule.ChannelSetAttributeFunction.CheckResult(
                ChannelModule.ChannelSetAttributeFunction.Delegate(Handle, attribute, value));
        }
Ejemplo n.º 12
0
 private static extern bool BASS_ChannelSetAttribute(this BassHandle handle, ChannelAttribute attribute, float value);
Ejemplo n.º 13
0
 internal PropertyAnimationCompletedEventArgs(ChannelAttribute property)
 {
     Property = property;
 }
Ejemplo n.º 14
0
        /// <exception cref="NotAvailableException">Channel object is no longer available.</exception>
        /// <exception cref="BassErrorException">
        ///     Some error occur to call a Bass function, check the error code and error message
        ///     to get more error information.
        /// </exception>
        /// <exception cref="BassNotLoadedException">
        ///     Bass DLL not loaded, you must use <see cref="BassManager.Initialize" /> to
        ///     load Bass DLL first.
        /// </exception>
        float IChannelInternal.GetAttribute(ChannelAttribute attribute)
        {
            CheckAvailable();

            float result = 0;

            ChannelModule.ChannelGetAttributeFunction.CheckResult(
                ChannelModule.ChannelGetAttributeFunction.Delegate(Handle, attribute, ref result));

            return result;
        }
Ejemplo n.º 15
0
 public bool Slide(ChannelAttribute attrib, double Value, int Time)
 {
     return(Bass.SlideChannelAttribute(Handle, attrib, (float)Value, Time));
 }
Ejemplo n.º 16
0
        /// <exception cref="NotAvailableException">Channel object is no longer available.</exception>
        /// <exception cref="BassErrorException">
        ///     Some error occur to call a Bass function, check the error code and error message
        ///     to get more error information.
        /// </exception>
        /// <exception cref="BassNotLoadedException">
        ///     Bass DLL not loaded, you must use <see cref="BassManager.Initialize" /> to
        ///     load Bass DLL first.
        /// </exception>
        bool IChannelInternal.IsSliding(ChannelAttribute attribute)
        {
            CheckAvailable();

            return
                ChannelModule.ChannelIsSlidingFunction.CheckResult(
                    ChannelModule.ChannelIsSlidingFunction.Delegate(Handle, attribute));
        }
Ejemplo n.º 17
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="ClientFinalMessage"/> class.
 /// </summary>
 /// <param name="clientFirstMessage">First client message.</param>
 /// <param name="serverFirstMessage">First server message.</param>
 public ClientFinalMessage(ClientFirstMessage clientFirstMessage, ServerFirstMessage serverFirstMessage)
 {
     Channel = new ChannelAttribute(clientFirstMessage.Gs2Header);
     Nonce   = new NonceAttribute(serverFirstMessage.Nonce?.Value);
 }
Ejemplo n.º 18
0
 public bool IsSliding(ChannelAttribute attrib)
 {
     return(Bass.IsChannelSliding(Handle, attrib));
 }
Ejemplo n.º 19
0
 public ChannelItemFilterContext(MemberInfo member, ISchemaRepository schemaRepository, ChannelAttribute channel)
 {
     Member           = member;
     SchemaRepository = schemaRepository;
     Channel          = channel;
 }
Ejemplo n.º 20
0
 public static bool SetChannelAttribute(int Handle, ChannelAttribute attrib, double value)
 {
     return(BASS_ChannelSetAttribute(Handle, attrib, (float)value));
 }
Ejemplo n.º 21
0
 extern static bool BASS_ChannelSetAttribute(int Handle, ChannelAttribute attrib, float value);
Ejemplo n.º 22
0
 public extern static bool IsChannelSliding(int Handle, ChannelAttribute attrib);
Ejemplo n.º 23
0
 public extern static bool SlideChannelAttribute(int Handle, ChannelAttribute attrib, float value, int time);