示例#1
0
        public static void Command([NotNull] this BssCfg641 server, [NotNull] string command, params object[] args)
        {
            if (server == null) throw new ArgumentNullException("server");
            if (command == null) throw new ArgumentNullException("command");

            var formattedCommand = string.Format(command, args);
            server.ProcessInstruction(formattedCommand);
        }
示例#2
0
        public static string Query([NotNull] this BssCfg641 server, [NotNull] string query, params object[] args)
        {
            if (server == null) throw new ArgumentNullException("server");
            if (query == null) throw new ArgumentNullException("query");

            var formatedQuery = string.Format(query, args);
            var result = server.QueryValue(formatedQuery, 0);
            return result;
        }
示例#3
0
        /// <summary>
        /// Adds retry/timeout ability to the LockServerSettings method.
        /// </summary>
        public static void LockServerSettings([NotNull] this BssCfg641 server, TimeSpan? timeout)
        {
            if (server == null) throw new ArgumentNullException("server");

            if (!timeout.HasValue)
            {
                server.LockServerSettings();
                return;
            }

            try
            {
                Attempt.Repeatedly.Do(server.LockServerSettings)
                   .CatchWhere(x => x.Exception is COMException)
                   .TakeForDuration(timeout.Value)
                   .DelayWhereFailed(TimeSpan.FromMilliseconds(250))
                   .ThrowIfCantSucceed();
            }
            catch (RepeatedFailureException ex)
            {
                throw new BitviseServerSettingsLockingException("Could not obtain server settings lock.", ex);
            }
        }