Exemplo n.º 1
0
 public CsiDocument(ICsiSession session)
 {
     this.mSession          = session;
     this.mRequestDocument  = new XmlDocument();
     this.mResponseDocument = (ICsiDocument)null;
     this.mRootElement      = (ICsiXmlElement) new CsiXmlElement((ICsiDocument)this, this.mRequestDocument.CreateElement("__InSite"));
     this.mRequestDocument.AppendChild((XmlNode)(this.mRootElement as CsiXmlElement).GetDomElement());
     this.mRootElement.SetAttribute("__version", "1.1");
     this.mRootElement.SetAttribute("__encryption", "2");
 }
Exemplo n.º 2
0
        ///// <summary>
        ///// 初始化
        ///// </summary>
        ///// <param name="factory">工厂</param>
        ///// <param name="employee"></param>
        ///// <param name="password"></param>
        //public CamstarCommon(string factory,string employee,string password)

        //{
        //    var model = GetConfigModel(factory);
        //    if (model is InsiteLoginModel loginModel)
        //    {
        //        loginModel.Password = password;
        //        loginModel.User = employee;
        //        _session = null;
        //        _client = null;
        //        _client = new CsiClient();
        //        _connection = null;
        //        _sessionId = Guid.NewGuid();
        //        _connection = _client.CreateConnection(loginModel.Host, loginModel.Port);
        //        _session = _connection.CreateSession(loginModel.User, loginModel.Password, _sessionId.ToString());
        //    }

        //}

        /// <summary>
        ///
        /// </summary>
        /// <param name="host"></param>
        /// <param name="port"></param>
        /// <param name="userName"></param>
        /// <param name="password"></param>

        public CamstarCommon(string host, int port, string userName, string password)
        {
            _session    = null;
            _client     = null;
            _client     = new CsiClient();
            _connection = null;
            _sessionId  = Guid.NewGuid();
            _connection = _client.CreateConnection(host, port);
            _session    = _connection.CreateSession(userName, password, _sessionId.ToString());
        }
Exemplo n.º 3
0
 public ICsiSession CreateSession(string userName, string password, string sessionName)
 {
     lock (this)
     {
         if (this.FindSession(sessionName) != null)
         {
             throw new Exceptions.CsiClientException(3014680L, this.GetType().FullName + "创建会话");
         }
         ICsiSession csiSession = (ICsiSession) new CsiSession(userName, password, (ICsiConnection)this);
         this._sessions[(object)sessionName] = (object)csiSession;
         return(csiSession);
     }
 }
Exemplo n.º 4
0
        /// <summary>
        /// 初始化
        /// </summary>
        /// <param name="factory">工厂</param>
        public CamstarCommon(string factory, IConfiguration configuration)
        {
            if (string.IsNullOrEmpty(factory))
            {
                throw new Exception("工厂参数不能为空");
            }
            var model = GetConfigModel(factory, configuration);

            if (model is InsiteLoginModel loginModel)
            {
                _session    = null;
                _client     = null;
                _client     = new CsiClient();
                _connection = null;

                _sessionId  = Guid.NewGuid();
                _connection = _client.CreateConnection(loginModel.Host, loginModel.Port);
                _session    = _connection.CreateSession(loginModel.User, loginModel.Password, _sessionId.ToString());
            }
        }
Exemplo n.º 5
0
 public CsiDocument(ICsiSession session, string xml)
 {
     this.mSession = session;
     this.BuildFromString(xml);
     this.mResponseDocument = (ICsiDocument)null;
 }