示例#1
0
        internal override AbstractServerTransportManager GetCommandTransportManager(Guid powerShellCmdId)
        {
            if (_transportManagers.ContainsKey(powerShellCmdId))
            {
                return(_transportManagers[powerShellCmdId]);
            }
            var manager = new WSManServerTransportManager(powerShellCmdId, _writer);

            manager.MigrateDataReadyEventHandlers(this);
            _transportManagers.Add(powerShellCmdId, manager);
            return(manager);
        }
示例#2
0
        public byte[] ReceiveData(Guid sessionId, Guid powerShellCmdId)
        {
            ServerRemoteSession session;

            if (_sessions.TryGetValue(sessionId, out session))
            {
                if (powerShellCmdId == Guid.Empty)
                {
                    WSManServerSessionTransportManager transport = (WSManServerSessionTransportManager)session.SessionDataStructureHandler.TransportManager;
                    return(transport.GetBuffer());
                }
                else
                {
                    WSManServerTransportManager manager = (WSManServerTransportManager)session.SessionDataStructureHandler.TransportManager.GetCommandTransportManager(powerShellCmdId);
                    return(manager.GetBuffer());
                }
            }
            return(new byte[0]);
        }