public override string ToString()
        {
            var sb = new StringBuilder("TExecuteStatementReq(");

            sb.Append(", SessionHandle: ");
            sb.Append(SessionHandle == null ? "<null>" : SessionHandle.ToString());
            sb.Append(", Statement: ");
            sb.Append(Statement);
            if (ConfOverlay != null && __isset.confOverlay)
            {
                sb.Append(", ConfOverlay: ");
                sb.Append(ConfOverlay);
            }
            if (__isset.runAsync)
            {
                sb.Append(", RunAsync: ");
                sb.Append(RunAsync);
            }
            if (__isset.queryTimeout)
            {
                sb.Append(", QueryTimeout: ");
                sb.Append(QueryTimeout);
            }
            sb.Append(")");
            return(sb.ToString());
        }
Exemple #2
0
        public void Write(TProtocol oprot)
        {
            TStruct struc = new TStruct("TGetSchemasReq");

            oprot.WriteStructBegin(struc);
            TField field = new TField();

            field.Name = "sessionHandle";
            field.Type = TType.Struct;
            field.ID   = 1;
            oprot.WriteFieldBegin(field);
            SessionHandle.Write(oprot);
            oprot.WriteFieldEnd();
            if (CatalogName != null && __isset.catalogName)
            {
                field.Name = "catalogName";
                field.Type = TType.String;
                field.ID   = 2;
                oprot.WriteFieldBegin(field);
                oprot.WriteString(CatalogName);
                oprot.WriteFieldEnd();
            }
            if (SchemaName != null && __isset.schemaName)
            {
                field.Name = "schemaName";
                field.Type = TType.String;
                field.ID   = 3;
                oprot.WriteFieldBegin(field);
                oprot.WriteString(SchemaName);
                oprot.WriteFieldEnd();
            }
            oprot.WriteFieldStop();
            oprot.WriteStructEnd();
        }
Exemple #3
0
        private void AddAuthParameters(ICollection <WebPair> parameters, string timestamp, string nonce)
        {
            var authParameters = new WebParameterCollection
            {
                new WebPair("oauth_consumer_key", ConsumerKey),
                new WebPair("oauth_nonce", nonce),
                new WebPair("oauth_signature_method", SignatureMethod.ToRequestValue()),
                new WebPair("oauth_timestamp", timestamp),
                new WebPair("oauth_version", Version ?? "1.0")
            };

            if (!Token.IsNullOrBlank())
            {
                authParameters.Add(new WebPair("oauth_token", Token));
            }
            if (!CallbackUrl.IsNullOrBlank())
            {
                authParameters.Add(new WebPair("oauth_callback", CallbackUrl));
            }
            if (!Verifier.IsNullOrBlank())
            {
                authParameters.Add(new WebPair("oauth_verifier", Verifier));
            }
            if (!SessionHandle.IsNullOrBlank())
            {
                authParameters.Add(new WebPair("oauth_session_handle", SessionHandle));
            }
            foreach (var authParameter in authParameters)
            {
                parameters.Add(authParameter);
            }
        }
Exemple #4
0
		private OperationHandle InvokeMethodCore(string namespaceName, string className, CimInstance instance, string methodName, CimMethodParametersCollection methodParameters, CimOperationOptions options, CimAsyncCallbacksReceiverBase asyncCallbacksReceiver)
		{
			OperationHandle operationHandle = null;
			InstanceHandle instanceHandle;
			InstanceHandle instanceHandleForMethodInvocation;
			SessionHandle sessionHandle = this._handle;
			MiOperationFlags operationFlags = options.GetOperationFlags();
			OperationOptionsHandle operationOptionsHandle = options.GetOperationOptionsHandle();
			string str = namespaceName;
			string str1 = className;
			string str2 = methodName;
			if (instance != null)
			{
				instanceHandle = instance.InstanceHandle;
			}
			else
			{
				instanceHandle = null;
			}
			if (methodParameters != null)
			{
				instanceHandleForMethodInvocation = methodParameters.InstanceHandleForMethodInvocation;
			}
			else
			{
				instanceHandleForMethodInvocation = null;
			}
			SessionMethods.Invoke(sessionHandle, operationFlags, operationOptionsHandle, str, str1, str2, instanceHandle, instanceHandleForMethodInvocation, options.GetOperationCallbacks(asyncCallbacksReceiver), out operationHandle);
			return operationHandle;
		}
        private void AddAuthParameters(ICollection <WebPair> parameters, string timestamp, string nonce)
        {
            WebParameterCollection webParameterCollection = new WebParameterCollection();

            webParameterCollection.Add(new WebPair("oauth_consumer_key", ConsumerKey));
            webParameterCollection.Add(new WebPair("oauth_nonce", nonce));
            webParameterCollection.Add(new WebPair("oauth_signature_method", SignatureMethod.ToRequestValue()));
            webParameterCollection.Add(new WebPair("oauth_timestamp", timestamp));
            webParameterCollection.Add(new WebPair("oauth_version", Version ?? "1.0"));
            WebParameterCollection webParameterCollection2 = webParameterCollection;

            if (!Token.IsNullOrBlank())
            {
                webParameterCollection2.Add(new WebPair("oauth_token", Token));
            }
            if (!CallbackUrl.IsNullOrBlank())
            {
                webParameterCollection2.Add(new WebPair("oauth_callback", CallbackUrl));
            }
            if (!Verifier.IsNullOrBlank())
            {
                webParameterCollection2.Add(new WebPair("oauth_verifier", Verifier));
            }
            if (!SessionHandle.IsNullOrBlank())
            {
                webParameterCollection2.Add(new WebPair("oauth_session_handle", SessionHandle));
            }
            foreach (WebPair item in webParameterCollection2)
            {
                parameters.Add(item);
            }
        }
Exemple #6
0
        WebPairCollection GenerateAuthParameters(string timestamp, string nonce)
        {
            var authParameters = new WebPairCollection
            {
                new WebPair("oauth_consumer_key", ConsumerKey),
                new WebPair("oauth_nonce", nonce),
                new WebPair("oauth_signature_method", SignatureMethod.ToRequestValue()),
                new WebPair("oauth_timestamp", timestamp),
                new WebPair("oauth_version", Version ?? "1.0")
            };

            if (!Token.IsEmpty())
            {
                authParameters.Add(new WebPair("oauth_token", Token));
            }

            if (!CallbackUrl.IsEmpty())
            {
                authParameters.Add(new WebPair("oauth_callback", CallbackUrl));
            }

            if (!Verifier.IsEmpty())
            {
                authParameters.Add(new WebPair("oauth_verifier", Verifier));
            }

            if (!SessionHandle.IsEmpty())
            {
                authParameters.Add(new WebPair("oauth_session_handle", SessionHandle));
            }

            return(authParameters);
        }
        internal override PacketHandle ReadAsync(SessionHandle handle, out uint error)
        {
            SNIPacket packet;

            error = SNIProxy.Singleton.ReadAsync(handle.ManagedHandle, out packet);
            return(PacketHandle.FromManagedPacket(packet));
        }
Exemple #8
0
        internal static unsafe void Initialize()
        {
            if (Interlocked.CompareExchange(ref _isInitialized, 1, 0) == 0)
            {
                var platform = Environment.OSVersion.Platform;

                if (platform == PlatformID.Win32NT)
                {
                    // This is the path for regular windows apps using NuGet.
                    AddWindowsWrappersToPath("lib\\win32");

                    // This is the path for Unity apps built as standalone.
                    AddWindowsWrappersToPath("..\\Plugins", isUnityTarget: true);

                    // This is the path in the Unity package - it is what the Editor uses.
                    AddWindowsWrappersToPath("Windows", isUnityTarget: true);
                }

                SynchronizationContextScheduler.Install();
                SharedRealmHandle.Initialize();
                SessionHandle.InstallCallbacks();
                HttpClientTransport.Install();
                AppHandle.Initialize();
            }
        }
Exemple #9
0
        public override string ToString()
        {
            var sb = new StringBuilder("TGetTablesReq(");

            sb.Append(", SessionHandle: ");
            sb.Append(SessionHandle == null ? "<null>" : SessionHandle.ToString());
            if (CatalogName != null && __isset.catalogName)
            {
                sb.Append(", CatalogName: ");
                sb.Append(CatalogName);
            }
            if (SchemaName != null && __isset.schemaName)
            {
                sb.Append(", SchemaName: ");
                sb.Append(SchemaName);
            }
            if (TableName != null && __isset.tableName)
            {
                sb.Append(", TableName: ");
                sb.Append(TableName);
            }
            if (TableTypes != null && __isset.tableTypes)
            {
                sb.Append(", TableTypes: ");
                sb.Append(TableTypes);
            }
            sb.Append(")");
            return(sb.ToString());
        }
Exemple #10
0
        public override int GetHashCode()
        {
            int hashcode = 157;

            unchecked {
                hashcode = (hashcode * 397) + SessionHandle.GetHashCode();
                if (__isset.catalogName)
                {
                    hashcode = (hashcode * 397) + CatalogName.GetHashCode();
                }
                if (__isset.schemaName)
                {
                    hashcode = (hashcode * 397) + SchemaName.GetHashCode();
                }
                if (__isset.tableName)
                {
                    hashcode = (hashcode * 397) + TableName.GetHashCode();
                }
                if (__isset.tableTypes)
                {
                    hashcode = (hashcode * 397) + TCollections.GetHashCode(TableTypes);
                }
            }
            return(hashcode);
        }
        public void Write(TProtocol oprot)
        {
            var struc = new TStruct("TGetDelegationTokenReq");

            oprot.WriteStructBegin(struc);
            var field = new TField
            {
                Name = "sessionHandle",
                Type = TType.Struct,
                ID   = 1
            };

            oprot.WriteFieldBegin(field);
            SessionHandle.Write(oprot);
            oprot.WriteFieldEnd();
            field.Name = "owner";
            field.Type = TType.String;
            field.ID   = 2;
            oprot.WriteFieldBegin(field);
            oprot.WriteString(Owner);
            oprot.WriteFieldEnd();
            field.Name = "renewer";
            field.Type = TType.String;
            field.ID   = 3;
            oprot.WriteFieldBegin(field);
            oprot.WriteString(Renewer);
            oprot.WriteFieldEnd();
            oprot.WriteFieldStop();
            oprot.WriteStructEnd();
        }
Exemple #12
0
        public override int GetHashCode()
        {
            int hashcode = 157;

            unchecked {
                hashcode = (hashcode * 397) + SessionHandle.GetHashCode();
                if (__isset.parentCatalogName)
                {
                    hashcode = (hashcode * 397) + ParentCatalogName.GetHashCode();
                }
                if (__isset.parentSchemaName)
                {
                    hashcode = (hashcode * 397) + ParentSchemaName.GetHashCode();
                }
                if (__isset.parentTableName)
                {
                    hashcode = (hashcode * 397) + ParentTableName.GetHashCode();
                }
                if (__isset.foreignCatalogName)
                {
                    hashcode = (hashcode * 397) + ForeignCatalogName.GetHashCode();
                }
                if (__isset.foreignSchemaName)
                {
                    hashcode = (hashcode * 397) + ForeignSchemaName.GetHashCode();
                }
                if (__isset.foreignTableName)
                {
                    hashcode = (hashcode * 397) + ForeignTableName.GetHashCode();
                }
            }
            return(hashcode);
        }
Exemple #13
0
        private bool AnnounceToSession()
        {
            ServerConnectionStatusUpdateEventHandler statusChangedCallback = (s, args) =>
            {
                switch (s.ConnectionStatus)
                {
                case ServerConnectionStatus.ConnectionErrorClientReconnect:
                case ServerConnectionStatus.Disconnected:
                case ServerConnectionStatus.LicenseExpired:
                case ServerConnectionStatus.ServerShutdown:
                case ServerConnectionStatus.ServerShutdownInProgress:
                    NotConnectedCallback?.Invoke(s, args);
                    // My idea was, to call Dispose() here, but I think, we should do it from
                    // outside the RemoteObject context ...
                    return;

                case ServerConnectionStatus.Connected:
                case ServerConnectionStatus.SessionAutomaticallyRecreated:
                    PostConnectionEstablished?.Invoke(s, args);
                    // I think, it's a good idea, to have a callback like this. So you can provide e. g. the
                    // monitoring of some UA variables here.
                    return;

                default:
                    /*
                     *  case ServerConnectionStatus.Connecting:
                     *  case ServerConnectionStatus.ConnectionWarningWatchdogTimeout:
                     */
                    return;
                }
            };

            return(SessionHandle.AddStatusChangedHandler(statusChangedCallback));
        }
        public async Task WriteAsync(TProtocol oprot, CancellationToken cancellationToken)
        {
            oprot.IncrementRecursionDepth();
            try
            {
                var struc = new TStruct("TGetPrimaryKeysReq");
                await oprot.WriteStructBeginAsync(struc, cancellationToken);

                var field = new TField();
                field.Name = "sessionHandle";
                field.Type = TType.Struct;
                field.ID   = 1;
                await oprot.WriteFieldBeginAsync(field, cancellationToken);

                await SessionHandle.WriteAsync(oprot, cancellationToken);

                await oprot.WriteFieldEndAsync(cancellationToken);

                if (CatalogName != null && __isset.catalogName)
                {
                    field.Name = "catalogName";
                    field.Type = TType.String;
                    field.ID   = 2;
                    await oprot.WriteFieldBeginAsync(field, cancellationToken);

                    await oprot.WriteStringAsync(CatalogName, cancellationToken);

                    await oprot.WriteFieldEndAsync(cancellationToken);
                }
                if (SchemaName != null && __isset.schemaName)
                {
                    field.Name = "schemaName";
                    field.Type = TType.String;
                    field.ID   = 3;
                    await oprot.WriteFieldBeginAsync(field, cancellationToken);

                    await oprot.WriteStringAsync(SchemaName, cancellationToken);

                    await oprot.WriteFieldEndAsync(cancellationToken);
                }
                if (TableName != null && __isset.tableName)
                {
                    field.Name = "tableName";
                    field.Type = TType.String;
                    field.ID   = 4;
                    await oprot.WriteFieldBeginAsync(field, cancellationToken);

                    await oprot.WriteStringAsync(TableName, cancellationToken);

                    await oprot.WriteFieldEndAsync(cancellationToken);
                }
                await oprot.WriteFieldStopAsync(cancellationToken);

                await oprot.WriteStructEndAsync(cancellationToken);
            }
            finally
            {
                oprot.DecrementRecursionDepth();
            }
        }
Exemple #15
0
        public void Write(TProtocol oprot)
        {
            TStruct struc = new TStruct("TGetTablesReq");

            oprot.WriteStructBegin(struc);
            TField field = new TField();

            field.Name = "sessionHandle";
            field.Type = TType.Struct;
            field.ID   = 1;
            oprot.WriteFieldBegin(field);
            SessionHandle.Write(oprot);
            oprot.WriteFieldEnd();
            if (CatalogName != null && __isset.catalogName)
            {
                field.Name = "catalogName";
                field.Type = TType.String;
                field.ID   = 2;
                oprot.WriteFieldBegin(field);
                oprot.WriteString(CatalogName);
                oprot.WriteFieldEnd();
            }
            if (SchemaName != null && __isset.schemaName)
            {
                field.Name = "schemaName";
                field.Type = TType.String;
                field.ID   = 3;
                oprot.WriteFieldBegin(field);
                oprot.WriteString(SchemaName);
                oprot.WriteFieldEnd();
            }
            if (TableName != null && __isset.tableName)
            {
                field.Name = "tableName";
                field.Type = TType.String;
                field.ID   = 4;
                oprot.WriteFieldBegin(field);
                oprot.WriteString(TableName);
                oprot.WriteFieldEnd();
            }
            if (TableTypes != null && __isset.tableTypes)
            {
                field.Name = "tableTypes";
                field.Type = TType.List;
                field.ID   = 5;
                oprot.WriteFieldBegin(field);
                {
                    oprot.WriteListBegin(new TList(TType.String, TableTypes.Count));
                    foreach (string _iter89 in TableTypes)
                    {
                        oprot.WriteString(_iter89);
                    }
                    oprot.WriteListEnd();
                }
                oprot.WriteFieldEnd();
            }
            oprot.WriteFieldStop();
            oprot.WriteStructEnd();
        }
Exemple #16
0
		private CimSession(SessionHandle handle, string computerName)
		{
			this._disposeThreadSafetyLock = new object();
			this._handle = handle;
			this.ComputerName = computerName;
			this.InstanceId = Guid.NewGuid();
			CimApplication.AddTracking(this);
		}
        internal override PacketHandle ReadAsync(SessionHandle handle, out uint error)
        {
            SNIPacket packet = null;

            error = handle.ManagedHandle.ReceiveAsync(ref packet);

            SqlClientEventSource.Log.TryTraceEvent("TdsParserStateObjectManaged.ReadAsync | Info | State Object Id {0}, Session Id {1}, Packet DataLeft {2}", _objectID, _sessionHandle?.ConnectionId, packet?.DataLeft);
            return(PacketHandle.FromManagedPacket(packet));
        }
Exemple #18
0
        public override int GetHashCode()
        {
            int hashcode = 157;

            unchecked {
                hashcode = (hashcode * 397) + SessionHandle.GetHashCode();
                hashcode = (hashcode * 397) + InfoType.GetHashCode();
            }
            return(hashcode);
        }
Exemple #19
0
        public override int GetHashCode()
        {
            int hashcode = 157;

            unchecked {
                hashcode = (hashcode * 397) + SessionHandle.GetHashCode();
                hashcode = (hashcode * 397) + DelegationToken.GetHashCode();
            }
            return(hashcode);
        }
Exemple #20
0
        protected virtual async Task Dispose(bool disposing)
        {
            if (disposing)
            {
                await CloseOperationAsync();

                _lastSchema = null;
                _client     = null;
                _session    = null;
            }
        }
Exemple #21
0
        public void Write(TProtocol oprot)
        {
            var struc = new TStruct("TGetColumnsReq");

            oprot.WriteStructBegin(struc);
            var field = new TField
            {
                Name = "sessionHandle",
                Type = TType.Struct,
                ID   = 1
            };

            oprot.WriteFieldBegin(field);
            SessionHandle.Write(oprot);
            oprot.WriteFieldEnd();
            if (CatalogName != null && __isset.catalogName)
            {
                field.Name = "catalogName";
                field.Type = TType.String;
                field.ID   = 2;
                oprot.WriteFieldBegin(field);
                oprot.WriteString(CatalogName);
                oprot.WriteFieldEnd();
            }
            if (SchemaName != null && __isset.schemaName)
            {
                field.Name = "schemaName";
                field.Type = TType.String;
                field.ID   = 3;
                oprot.WriteFieldBegin(field);
                oprot.WriteString(SchemaName);
                oprot.WriteFieldEnd();
            }
            if (TableName != null && __isset.tableName)
            {
                field.Name = "tableName";
                field.Type = TType.String;
                field.ID   = 4;
                oprot.WriteFieldBegin(field);
                oprot.WriteString(TableName);
                oprot.WriteFieldEnd();
            }
            if (ColumnName != null && __isset.columnName)
            {
                field.Name = "columnName";
                field.Type = TType.String;
                field.ID   = 5;
                oprot.WriteFieldBegin(field);
                oprot.WriteString(ColumnName);
                oprot.WriteFieldEnd();
            }
            oprot.WriteFieldStop();
            oprot.WriteStructEnd();
        }
Exemple #22
0
        public override string ToString()
        {
            StringBuilder sb = new StringBuilder("TGetInfoReq(");

            sb.Append("SessionHandle: ");
            sb.Append(SessionHandle == null ? "<null>" : SessionHandle.ToString());
            sb.Append(",InfoType: ");
            sb.Append(InfoType);
            sb.Append(")");
            return(sb.ToString());
        }
Exemple #23
0
        public override string ToString()
        {
            var sb = new StringBuilder("TCancelDelegationTokenReq(");

            sb.Append(", SessionHandle: ");
            sb.Append(SessionHandle == null ? "<null>" : SessionHandle.ToString());
            sb.Append(", DelegationToken: ");
            sb.Append(DelegationToken);
            sb.Append(")");
            return(sb.ToString());
        }
Exemple #24
0
        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="tcpClientHostConfig"></param>
        /// <param name="sessionHandle"></param>
        public TcpClientHost(TcpClientHostConfig tcpClientHostConfig, SessionHandle sessionHandle, ITcpClientLog tcpClientLog
            , Action<TcpClientToken> connectionToServerSuccessAction = null
            , Action<Exception> socketErrorAction = null)
        {
            _tcpClientHostConfig = tcpClientHostConfig;
            _iLog = tcpClientLog;
            _seeesionHandle = sessionHandle;
            _clientToken = new TcpClientToken(_seeesionHandle, _iLog);

            SocketErrorAction = socketErrorAction;
            ConnectionToServerSuccessAction = connectionToServerSuccessAction;
        }
Exemple #25
0
        public void Disconnect()
        {
            if (!Connected())
            {
                return;
            }

            lock (SessionLock)
            {
                SessionHandle?.Dispose();
            }
        }
        public override String ToString()
        {
            var sb = new StringBuilder("TGetDelegationTokenReq(");

            sb.Append("SessionHandle: ");
            sb.Append(SessionHandle == null ? "<null>" : SessionHandle.ToString());
            sb.Append(",Owner: ");
            sb.Append(Owner);
            sb.Append(",Renewer: ");
            sb.Append(Renewer);
            sb.Append(")");
            return(sb.ToString());
        }
Exemple #27
0
        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="sessionHandle"></param>
        public TcpClientToken(SessionHandle sessionHandle, ITcpClientLog tcpClientLog)
        {
            _sessionHandle = sessionHandle;
            _iLog = tcpClientLog;

            _tcpClient = new TcpClient();
            //_socket = _tcpClient.Client;

            buffer = new byte[1024 * 8];
            bufferList = new List<byte>(1024 * 8);

            TimeoutObject = new ManualResetEvent(false);
        }
Exemple #28
0
        public override string ToString()
        {
            StringBuilder sb = new StringBuilder("TGetSchemasReq(");

            sb.Append("SessionHandle: ");
            sb.Append(SessionHandle == null ? "<null>" : SessionHandle.ToString());
            sb.Append(",CatalogName: ");
            sb.Append(CatalogName);
            sb.Append(",SchemaName: ");
            sb.Append(SchemaName);
            sb.Append(")");
            return(sb.ToString());
        }
Exemple #29
0
        public override string ToString()
        {
            StringBuilder sb = new StringBuilder("TExecuteStatementReq(");

            sb.Append("SessionHandle: ");
            sb.Append(SessionHandle == null ? "<null>" : SessionHandle.ToString());
            sb.Append(",Statement: ");
            sb.Append(Statement);
            sb.Append(",ConfOverlay: ");
            sb.Append(ConfOverlay);
            sb.Append(")");
            return(sb.ToString());
        }
        public void Write(TProtocol oprot)
        {
            var struc = new TStruct("TExecuteStatementReq");

            oprot.WriteStructBegin(struc);
            var field = new TField
            {
                Name = "sessionHandle",
                Type = TType.Struct,
                ID   = 1
            };

            oprot.WriteFieldBegin(field);
            SessionHandle.Write(oprot);
            oprot.WriteFieldEnd();
            field.Name = "statement";
            field.Type = TType.String;
            field.ID   = 2;
            oprot.WriteFieldBegin(field);
            oprot.WriteString(Statement);
            oprot.WriteFieldEnd();
            if (ConfOverlay != null && __isset.confOverlay)
            {
                field.Name = "confOverlay";
                field.Type = TType.Map;
                field.ID   = 3;
                oprot.WriteFieldBegin(field);
                {
                    oprot.WriteMapBegin(new TMap(TType.String, TType.String, ConfOverlay.Count));
                    foreach (var _iter85 in ConfOverlay.Keys)
                    {
                        oprot.WriteString(_iter85);
                        oprot.WriteString(ConfOverlay[_iter85]);
                    }
                    oprot.WriteMapEnd();
                }
                oprot.WriteFieldEnd();
            }
            if (__isset.runAsync)
            {
                field.Name = "runAsync";
                field.Type = TType.Bool;
                field.ID   = 4;
                oprot.WriteFieldBegin(field);
                oprot.WriteBool(RunAsync);
                oprot.WriteFieldEnd();
            }
            oprot.WriteFieldStop();
            oprot.WriteStructEnd();
        }
        public void Write(TProtocol oprot)
        {
            var struc = new TStruct("TOpenSessionResp");

            oprot.WriteStructBegin(struc);
            var field = new TField
            {
                Name = "status",
                Type = TType.Struct,
                ID   = 1
            };

            oprot.WriteFieldBegin(field);
            Status.Write(oprot);
            oprot.WriteFieldEnd();
            field.Name = "serverProtocolVersion";
            field.Type = TType.I32;
            field.ID   = 2;
            oprot.WriteFieldBegin(field);
            oprot.WriteI32((Int32)ServerProtocolVersion);
            oprot.WriteFieldEnd();
            if (SessionHandle != null && __isset.sessionHandle)
            {
                field.Name = "sessionHandle";
                field.Type = TType.Struct;
                field.ID   = 3;
                oprot.WriteFieldBegin(field);
                SessionHandle.Write(oprot);
                oprot.WriteFieldEnd();
            }
            if (Configuration != null && __isset.configuration)
            {
                field.Name = "configuration";
                field.Type = TType.Map;
                field.ID   = 4;
                oprot.WriteFieldBegin(field);
                {
                    oprot.WriteMapBegin(new TMap(TType.String, TType.String, Configuration.Count));
                    foreach (var _iter80 in Configuration.Keys)
                    {
                        oprot.WriteString(_iter80);
                        oprot.WriteString(Configuration[_iter80]);
                    }
                    oprot.WriteMapEnd();
                }
                oprot.WriteFieldEnd();
            }
            oprot.WriteFieldStop();
            oprot.WriteStructEnd();
        }
        public override string ToString()
        {
            StringBuilder sb = new StringBuilder("TOpenSessionResp(");

            sb.Append("Status: ");
            sb.Append(Status == null ? "<null>" : Status.ToString());
            sb.Append(",ServerProtocolVersion: ");
            sb.Append(ServerProtocolVersion);
            sb.Append(",SessionHandle: ");
            sb.Append(SessionHandle == null ? "<null>" : SessionHandle.ToString());
            sb.Append(",Configuration: ");
            sb.Append(Configuration);
            sb.Append(")");
            return(sb.ToString());
        }
Exemple #33
0
        internal static Session SessionForPointer(IntPtr sessionPtr)
        {
            var tempHandle = new SessionHandle();
            tempHandle.SetHandle(sessionPtr);

            var shouldDispose = true;
            var session = _sessions.GetOrAdd(tempHandle, handle =>
            {
                shouldDispose = false;
                return new Session(handle);
            });

            if (shouldDispose)
            {
                tempHandle.Dispose();
            }

            return session;
        }
Exemple #34
0
 /// <summary>
 /// 授权回调
 /// </summary>
 /// <param name="token"></param>
 /// <param name="session"></param>
 public void AccreditCallback(UserToken token, SessionHandle session)
 {
     token.Session = session;
     AcceptEnd(token);
 }
Exemple #35
0
 private Session(SessionHandle handle)
 {
     Handle = handle;
 }