예제 #1
0
 /// <summary>
 /// Checks if the last request was successfull
 /// </summary>
 /// <param name="connector"></param>
 public static void HasNoError(IBaseConnector connector)
 {
     if (connector.HasError)
     {
         throw new AssertFailedException($"Request failed due to '{connector.Error.Message}'.");
     }
 }
예제 #2
0
 /// <summary>
 /// Starts connecting to the Bitcoin-qt server
 /// </summary>
 public BaseBtcConnector(BaseConnectorConfig config)
 {
     if (config.isPrimary)
     {
         _baseConnector = new Primary(config);
     }
     else
     {
         _baseConnector = new Secondary(config);
     }
 }
예제 #3
0
 /// <summary>
 /// Starts connecting to the Gamerscoin-qt server
 /// </summary>
 public BaseGamerscoinConnector(bool isPrimary)
 {
     if (isPrimary)
     {
         _baseConnector = new Primary();
     }
     else
     {
         _baseConnector = new Secondary();
     }
 }
예제 #4
0
 /// <summary>
 /// Starts connecting to the Bitcoin-qt server
 /// </summary>
 public BaseBtcConnector(bool isPrimary)
 {
     if (isPrimary)
     {
         _baseConnector = new Primary();
     }
     else
     {
         _baseConnector = new Secondary();
     }
 }
 /// <summary>
 /// Starts connecting to the Gamerscoin-qt server
 /// </summary>
 public BaseBtcConnector(bool isPrimary)
 {
     if (isPrimary)
     {
         _baseConnector = new Primary();
     }
     else
     {
         _baseConnector = new Secondary();
     }
 }
예제 #6
0
        public OperationResult TestConnections()
        {
            int failed = 0;

            IBaseConnector[] connectors = new IBaseConnector[]
            {
                _source,
                _target
            };
            var tasks = connectors.Select(conn => StartSTATask(async() =>
            {
                var checkRes = await conn.TestConnection();
                if (!checkRes)
                {
                    Interlocked.Increment(ref failed);
                }
            })).ToArray();

            var res = Task.WhenAll(tasks);

            res.Wait();
            return(new OperationResult(failed == 0));
        }
 /// <summary>
 /// Starts connecting to the Bitcoin-qt server
 /// </summary>
 public BaseBtcConnector()
 {
     _baseConnector = new BaseConnector();
 }