コード例 #1
0
 internal void EnableGranularValidation(ValidateStringCallback validationCallback)
 {
     // Iterate over all the keys, adding each to the set containing the keys awaiting validation.
     // Unlike dictionaries, HashSet<T> can contain null keys, so don't need to special-case them.
     _keysAwaitingValidation = new HashSet <string>(Keys.Cast <string>(), StringComparer.OrdinalIgnoreCase);
     _validationCallback     = validationCallback;
 }
コード例 #2
0
 /// <summary>
 /// Clears the contents of the <see cref="NpgsqlConnectionStringBuilder"/> instance.
 /// </summary>
 public override void Clear()
 {
     Contract.Assert(Keys != null);
     foreach (var k in Keys.Cast <string>().ToArray())
     {
         Remove(k);
     }
 }
コード例 #3
0
        /*
         * We added granular request validation in ASP.NET 4.5 to provide a better request validation story for our developers.
         * Instead of validating the entire collection ahead of time, we'll only validate entries that are actually looked at.
         */

        internal void EnableGranularValidation(ValidateStringCallback validationCallback)
        {
            // Iterate over all the keys, adding each to the set containing the keys awaiting validation.
            // Unlike dictionaries, HashSet<T> can contain null keys, so don't need to special-case them.
            _keysAwaitingValidation = new HashSet <string>(Keys.Cast <string>().Where(KeyIsCandidateForValidation), StringComparer.OrdinalIgnoreCase);
            _validationCallback     = validationCallback;

            // This forces CopyTo and other methods that cache entries to flush their caches, ensuring
            // that all values go through validation again.
            InvalidateCachedArrays();
        }
コード例 #4
0
 public void Set(string key, string value)
 {
     EnsureExistence();
     if (Has(key))
     {
         var index = Keys.Cast <string>().IndexOf(key);
         Values[index] = value;
     }
     else
     {
         Keys.Add(key);
         Values.Add(value);
     }
 }
コード例 #5
0
 public bool Has(string key)
 {
     EnsureExistence();
     return(Keys.Cast <string>().Contains(key));
 }
コード例 #6
0
 public string Get(string key)
 {
     EnsureExistence();
     return(Keys.Cast <string>().Corresponding(key, Values.Cast <string>()));
 }
コード例 #7
0
ファイル: ResizeSettings.cs プロジェクト: freiguy1/Noodle
 /// <summary>
 /// Returns a string containing all the settings in the class, in querystring form. Use ToStringEncoded() to get a URL-safe querystring.
 /// This method does not encode commas, spaces, etc.
 /// </summary>
 /// <returns></returns>
 public override string ToString()
 {
     return(string.Join(";", Keys.Cast <string>().Select(x => x + ":" + this[x])));
 }
コード例 #8
0
 public override string ToString()
 {
     return(string.Join("&", Keys.Cast <string>().Select(
                            key => string.Format("{0}={1}", key, this[key]))));
 }
コード例 #9
0
ファイル: Keyboard.cs プロジェクト: CuteITGuy/CB.Win32
 public static async Task<bool> SendKeyCombination(Keys[] keys, int time)
 {
     return await SendKeyCombination(keys.Cast<VirtualKeys>().ToArray(), time);
 }
コード例 #10
0
ファイル: KeyServiceBase.cs プロジェクト: gissehel/Fenester
 public IEnumerable <IKey> GetKeys() => Keys.Cast <IKey>();
コード例 #11
0
ファイル: Keyboard.cs プロジェクト: CuteITGuy/CB.Win32
 /// <summary>
 ///     Stimulate a key combination press
 /// </summary>
 /// <param name="keys">The key combination</param>
 /// <returns>If the function succeeds it returns true; otherwise, returns false</returns>
 public static bool SendKeyCombination(Keys[] keys)
 {
     return SendKeyCombination(keys.Cast<VirtualKeys>().ToArray());
 }
コード例 #12
0
        public ConnectionConfiguration Parse(string connectionString)
        {
            ConnectionString = connectionString;

            var connectionConfiguration     = new ConnectionConfiguration(settings);
            var connectionConfigurationType = typeof(ConnectionConfiguration);

            foreach (var key in Keys.Cast <string>())
            {
                var property = connectionConfigurationType.GetProperty(key, BindingFlags.IgnoreCase | BindingFlags.Public | BindingFlags.Instance);
                property?.SetValue(connectionConfiguration, TypeDescriptor.GetConverter(property.PropertyType).ConvertFrom(this[key]));
            }

            if (connectionConfiguration.UseTls && !ContainsKey("port"))
            {
                connectionConfiguration.Port = 5671;
            }

            if (ContainsKey("host"))
            {
                ParseHosts(connectionConfiguration, this["host"] as string);
            }
            else
            {
                throw new Exception("Invalid connection string. 'host' value must be supplied. e.g: \"host=myServer\"");
            }

            if (ContainsKey("dequeuetimeout"))
            {
                var message = "The 'DequeueTimeout' connection string option has been removed. Consult the documentation for further information.";

                Logger.Error(message);

                throw new NotSupportedException(message);
            }

            if (ContainsKey("maxwaittimeforconfirms"))
            {
                var message = "The 'MaxWaitTimeForConfirms' connection string option has been removed. Consult the documentation for further information";

                Logger.Error(message);

                throw new NotSupportedException(message);
            }

            if (ContainsKey("prefetchcount"))
            {
                var message = "The 'PrefetchCount' connection string option has been removed. Use 'EndpointConfiguration.UseTransport<RabbitMQTransport>().PrefetchCount' instead.";

                Logger.Error(message);

                throw new NotSupportedException(message);
            }

            if (ContainsKey("usepublisherconfirms"))
            {
                var message = "The 'UsePublisherConfirms' connection string option has been removed. Use 'EndpointConfiguration.UseTransport<RabbitMQTransport>().UsePublisherConfirms' instead.";

                Logger.Error(message);

                throw new NotSupportedException(message);
            }

            return(connectionConfiguration);
        }
コード例 #13
0
 /// <summary>
 ///
 /// </summary>
 /// <returns></returns>
 public Task CleatAsync()
 {
     return(_db.HashDeleteAsync(Name, Keys.Cast(x => (RedisValue)x).ToArray()));
 }
コード例 #14
0
 /// <summary>
 ///
 /// </summary>
 public void Clear()
 {
     _db.HashDelete(Name, Keys.Cast(x => (RedisValue)x).ToArray());
 }
コード例 #15
0
 public override System.Collections.Generic.IEnumerable <string> GetDynamicMemberNames()
 {
     return(Keys.Cast <string>().AsEnumerable());
 }