示例#1
0
文件: Tunnel.cs 项目: KSLcom/Launcher
 public new void Close()
 {
     if (tunnelCurrent == this)
     {
         tunnelCurrent = null;
     }
     tunnelActiveList.Remove(this);
     base.Close();
     if (tunnelActiveList.Count == 0)
     {
         RestoreTabExpansion();
     }
 }
示例#2
0
        protected override void ProcessRecord()
        {
            Runspace runspace = System.Management.Automation.Runspaces.Runspace.DefaultRunspace;

            for (int i = 0; i < HostAddress.Length; i++)
            {
                Binding binding = ((Binding != null) && (i < Binding.Length)) ? Binding[i] : CreateDefaultBinding();
                Tunnel  tunnel  = new Tunnel(runspace, binding, new EndpointAddress(HostAddress[i]));
                if (!NoSelect.IsPresent)
                {
                    tunnel.SetAsCurrent();
                }
                this.WriteObject(tunnel);
            }

            base.ProcessRecord();
        }
示例#3
0
        protected override void EndProcessing()
        {
            Tunnel tunnel = (Tunnel != null) ? Tunnel : Tunnel.TunnelCurrent;

            if (tunnel == null)
            {
                throw new ApplicationException("Invoke-Tunnel failed: no specified or current tunnel.");
            }

            byte[][] pipeAsByteArrayArray;

            if (entirePipeLine.Count == 0)
            {
                pipeAsByteArrayArray = null;
            }
            else
            {
                pipeAsByteArrayArray = new byte[entirePipeLine.Count][];
                for (int i = 0; i < entirePipeLine.Count; i++)
                {
                    pipeAsByteArrayArray[i] = Tunnel.SerializeToByteArray(entirePipeLine[i]);
                }
            }

            if (scriptBlock != null)
            {
                byte[][] byteArrayArray = tunnel.RunScript(scriptBlock.ToString(), pipeAsByteArrayArray, PipeOutput.IsPresent);

                foreach (byte[] byteArray in byteArrayArray)
                {
                    this.WriteObject(Tunnel.DeserializeToObject(byteArray));
                }
            }

            base.EndProcessing();
        }
示例#4
0
文件: Tunnel.cs 项目: KSLcom/Launcher
 public void SetAsCurrent()
 {
     tunnelCurrent = this;
 }