Ejemplo n.º 1
0
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

        public void SendAsyncCommand(string command, OnAsyncOutputDelegate asyncDelegate = null)
        {
            LoggingUtils.Print(string.Format("[JdbClient] SendAsyncCommand: {0}", command));

            if (string.IsNullOrWhiteSpace(command))
            {
                throw new ArgumentNullException("command");
            }

            if (m_jdbClientInstance == null)
            {
                return;
            }

            m_timeSinceLastOperation.Restart();

            AsyncCommandData commandData = new AsyncCommandData();

            commandData.Command = command;

            commandData.OutputDelegate = asyncDelegate;

            ++m_sessionCommandToken;

            lock (m_asyncCommandData)
            {
                m_asyncCommandData.Add(m_sessionCommandToken, commandData);
            }

            //command = m_sessionCommandToken + command;

            m_jdbClientInstance.SendCommand(command);

            m_timeSinceLastOperation.Restart();
        }
Ejemplo n.º 2
0
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

    public void SendAsyncCommand (string command, OnAsyncOutputDelegate asyncDelegate = null)
    {
      LoggingUtils.Print (string.Format ("[JdbClient] SendAsyncCommand: {0}", command));

      if (string.IsNullOrWhiteSpace (command))
      {
        throw new ArgumentNullException ("command");
      }

      if (m_jdbClientInstance == null)
      {
        return;
      }

      m_timeSinceLastOperation.Restart ();

      AsyncCommandData commandData = new AsyncCommandData ();

      commandData.Command = command;

      commandData.OutputDelegate = asyncDelegate;

      ++m_sessionCommandToken;

      lock (m_asyncCommandData)
      {
        m_asyncCommandData.Add (m_sessionCommandToken, commandData);
      }

      //command = m_sessionCommandToken + command;

      m_jdbClientInstance.SendCommand (command);

      m_timeSinceLastOperation.Restart ();
    }