示例#1
0
 /// <summary>
 /// 连接一句话
 /// </summary>
 private void ConnectOneShell()
 {
     try
     {
         //初始化ShellCmder
         _shellCmder = new ShellCmderService(_hostService,_shellData);
         //初始化内部命令
         _internalCommand = new InternalCommand(shellTextBox_Cmder, _shellCmder);
         //获取系统信息
         OsInfo info = _shellCmder.GetSysInfo();
         string str = string.Format("操作系统平台:{0}    当前用户:{1}", info.Platform, info.CurrentUser);
         //设置系统平台
         if (info.DirSeparators == @"\")
         {
             _isWin = true;
         }
         else
         {
             _isWin = false;
         }
         //设置当前目录
         _currentDir = info.ShellDir;
         //cmder的系统平台
         shellTextBox_Cmder.IsWin = _isWin;
         //设置提示信息
         shellTextBox_Cmder.Prompt = _currentDir;
         shellTextBox_Cmder.PrintCommandResult(str);
     }
     catch(Exception ex)
     {
         shellTextBox_Cmder.PrintCommandResult(ex.Message);
     }
 }
示例#2
0
 /// <summary>
 /// 连接一句话
 /// </summary>
 private void ConnectOneShell()
 {
     try
     {
         //初始化ShellCmder
         _shellCmder = new ShellCmderService(_host, _shellData);
         //初始化内部命令
         _internalCommand = new InternalCommand(shellTextBox_Cmder, _shellCmder);
         //获取系统信息
         OsInfo info = _shellCmder.GetSysInfo();
         string str  = string.Format("操作系统平台:{0}    当前用户:{1}", info.Platform, info.CurrentUser);
         //设置系统平台
         if (info.DirSeparators == @"\")
         {
             _isWin = true;
         }
         else
         {
             _isWin = false;
         }
         //设置当前目录
         _currentDir = info.ShellDir;
         //cmder的系统平台
         shellTextBox_Cmder.IsWin = _isWin;
         //设置提示信息
         shellTextBox_Cmder.Prompt = _currentDir;
         shellTextBox_Cmder.PrintCommandResult(str);
     }
     catch (Exception ex)
     {
         shellTextBox_Cmder.PrintCommandResult(ex.Message);
     }
 }
示例#3
0
 public InternalCommand(TextBoxShell shellTextBoxCmder, ShellCmderService cmdshell)
 {
     this.shellTextBoxCmder = shellTextBoxCmder;
     this.cmdshell          = cmdshell;
 }