fCraft.Config.ValidateString C# (CSharp) Method

ValidateString() private method

private ValidateString ( string key, string value, int minLength, int maxLength ) : bool
key string
value string
minLength int
maxLength int
return bool
        bool ValidateString( string key, string value, int minLength, int maxLength ) {
            if( key.Length < minLength ) {
                Log( "Config.SetValue: Specified value for {0} is too short (expected length: {1}...{2}). Using default ({3}).", LogType.Warning,
                    key, minLength, maxLength, settings[key] );
                return false;
            } else if( key.Length > maxLength ) {
                settings[key] = value.Substring( 0, maxLength );
                Log( "Config.SetValue: Specified value for {0} is too long (expected length: {1}...{2}). The value has been truncated to \"{3}\".", LogType.Warning,
                    key, minLength, maxLength, settings[key] );
                return true;
            } else {
                settings[key] = value;
                return true;
            }
        }