Пример #1
0
        public string ToString(Alphabet alphabet, bool preserveCase, InvalidCharacterAction invalidCharacterAction = InvalidCharacterAction.Delete, char replaceChar = '?')
        {
            StringBuilder sb = new StringBuilder();

            for (int i = 0; i < numbers.Length; i++)
            {
                if (numbers[i] >= 0)
                {
                    sb.Append(alphabet[numbers[i]]);
                }
                else
                {
                    switch (invalidCharacterAction)
                    {
                    case InvalidCharacterAction.Preserve: sb.Append(text[i]); break;

                    case InvalidCharacterAction.Replace: sb.Append(replaceChar); break;

                    case InvalidCharacterAction.Delete: break;
                    }
                }
            }

            return(sb.ToString());
        }
Пример #2
0
        /// <summary>
        /// Create a new API wrapper
        /// </summary>
        /// <param name="key">Clockwork API Key</param>
        public API(string key)
        {
            if (string.IsNullOrEmpty(key))
            {
                throw new ArgumentException("API Key can't be blank", nameof(key));
            }

            Key = key;

            // Set some sensible & secure defaults
            SSL = true;

            // SMS defaults - Account defaults will be used if these are left as null
            From     = null;
            Long     = null;
            Truncate = null;
            InvalidCharacterAction = InvalidCharacterAction.AccountDefault;
        }