private Shell GetShellConfigFromPanel()
	    {
			var shell = new Shell();

			shell.Id = this.Id;
		    shell.TargetId = _textBoxName.Text.Trim();//*
			shell.TargetLevel = _comboBoxLevel.Text;
		    shell.ShellType = _dropDownScritpType.SelectedKey ?? "";//*

			shell.ShellUrl = _textBoxShellPath.Text.Trim();//*
			shell.ShellPwd = _textBoxShellPass.Text.Trim();//*

			shell.ShellExtraString = _richTextBoxSetting.Text;
			shell.Remark = _textBoxRemark.Text;

		    shell.ServerCoding = _dropDownServerCoding.SelectedKey ?? "";//*
		    shell.WebCoding = _dropDownWebCoding.SelectedKey ?? "";//*

			var time = DateTime.Now.Date.ToShortDateString();
			if (time.Contains("/"))
			{
				time = time.Replace("/", "-");
			}
			shell.AddTime = time;
		    return shell;
	    }
        public FormEditWebshell(Shell shellArray)
        {
            InitUi();

            //init
            ComboBox_ScriptType_Init();

            _buttonAdd.Enabled = false;
            _buttonAlter.Enabled = true;

            this.Id = shellArray.Id;
            _textBoxName.Text = shellArray.TargetId;
	        _comboBoxLevel.Text = shellArray.TargetLevel;
            _comboBoxLevel.Items.Add(shellArray.TargetLevel);
			_dropDownScritpType.SelectedKey = shellArray.ShellType;

            _textBoxShellPath.Text = shellArray.ShellUrl;
            _textBoxShellPass.Text = shellArray.ShellPwd;

            _textBoxRemark.Text = shellArray.Remark;

	        if (_dropDownServerCoding.Items.FirstOrDefault(r => r.Key == shellArray.ServerCoding) == null)
	        {
				_dropDownServerCoding.Items.Add(shellArray.ServerCoding);
	        }
			_dropDownServerCoding.SelectedKey = shellArray.ServerCoding;

	        if (_dropDownWebCoding.Items.FirstOrDefault(r => r.Key == shellArray.WebCoding) == null)
	        {
				_dropDownWebCoding.Items.Add(shellArray.WebCoding);
	        }
			_dropDownWebCoding.SelectedKey = shellArray.WebCoding;

			_richTextBoxSetting.Text = shellArray.ShellExtraString;
        }
Exemple #3
0
        public DoNetPluginTest(IHost host, PluginParameter data)
        {
			_host = host;
			_shellData = (Shell)data[0];

            Init();
            ShowShellTypeDataInLable(_shellData);
        }
Exemple #4
0
		/// <summary>
		/// 提交命令
		/// </summary>
		/// <param name="data">shellstruct数据</param>
		/// <param name="funcNameXpath">xpath表示的方法名(/cmder/readfile)</param>
		/// <param name="param"></param>
		public static byte[] SubmitCommand(Shell data, string funcNameXpath, string[] param)
		{
			var shellType = CustomShellTypeProvider.GetShellType(data.ShellType);
			var customCommandCode = new CustomCommandCode(shellType, data.ShellPwd);
			var commandCode = customCommandCode.GetCode(funcNameXpath, param);

			var httpClient = new HttpClient(GetHttpHeader(data));
			return httpClient.SubmitCommandByPost(data.ShellUrl, commandCode);
		}
Exemple #5
0
        public PanelShellCmder(IHost host, PluginParameter data)
        {
            Init();
            _host = host;
			_shellData = (Shell)data[0];

            _consoleBoxCmder.CommandEntered+=ConsoleBoxCmderCommandEntered;
            _consoleBoxCmder.Prompt = "AltmanCmder";
            ConnectOneShell();
        }
Exemple #6
0
		public static byte[] SubmitCommand(Shell data,
								string funcNameXpath, string[] param,
								bool isBindUploadProgressChangedEvent,
								bool isBindDownloadProgressChangedEvent)
		{
			CustomShellType shellType = CustomShellTypeProvider.GetShellType(data.ShellType);
			CustomCommandCode customCommandCode = new CustomCommandCode(shellType, data.ShellPwd);
			Dictionary<string, string> commandCode = customCommandCode.GetCode(funcNameXpath, param);
			HttpClient httpClient = new HttpClient();
			//if (isBindUploadProgressChangedEvent)
			//    httpClient.UploadFileProgressChangedToDo += httpClient_UploadFileProgressChangedToDo;
			//if (isBindDownloadProgressChangedEvent)
			//    httpClient.DownloadFileProgressChangedToDo += httpClient_DownloadFileProgressChangedToDo;
			return httpClient.SubmitCommandByPost(data.ShellUrl, commandCode);
		}
Exemple #7
0
		private void ShowShellTypeDataInLable(Shell data)
        {
            var strBuilder = new StringBuilder();
			if (data == null) return;

			strBuilder.AppendLine("[ShellUrl]:" + data.ShellUrl);
			strBuilder.AppendLine("[ShellPwd]:" + data.ShellPwd);
			strBuilder.AppendLine("[ShellType]:" + data.ShellType);
			strBuilder.AppendLine("[ServerCoding]:" + data.ServerCoding);
			strBuilder.AppendLine("[WebCoding]:" + data.WebCoding);
			strBuilder.AppendLine("[ShellExtraString]:" + data.ShellExtraString);
			strBuilder.AppendLine("[TimeOut]:" + data.TimeOut);

            _tbxShellData.Text = strBuilder.ToString();
        }
Exemple #8
0
		public FileEditerPanel(IHost host, Shell data, string filePath, bool autoLoadContent)
		{
			Init();

            this._host = host;
            this._shellData = data;

            _fileManager = new FileManager(_host, _shellData);
            _fileManager.ReadFileCompletedToDo += fileManager_LoadFileContentCompletedToDo;
            _fileManager.WriteFileCompletedToDo += fileManager_SaveFileCompletedToDo;

            if (filePath != null)
            {
				Url = filePath;
                if (autoLoadContent)
                    LoadFileContent(filePath);  
            }
        }
Exemple #9
0
		public ShellView(Shell shell)
		{
			this.Id = shell.Id;
			this.TargetId = shell.TargetId;
			this.TargetLevel = shell.TargetLevel;
			this.Status = shell.Status;

			this.ShellUrl = shell.ShellUrl;
			this.ShellPwd = shell.ShellPwd;
			this.ShellType = shell.ShellType;
			this.ShellExtraString = shell.ShellExtraString;

			this.ServerCoding = shell.ServerCoding;
			this.WebCoding = shell.WebCoding;

			this.TimeOut = shell.TimeOut;

			this.Area = shell.Area;
			this.Remark = shell.Remark;
			this.AddTime = shell.AddTime;
		}
Exemple #10
0
		public static PluginParameter ConvertShellStructToPluginParameter(Shell shell)
		{
			var param = new PluginParameter();
			param.AddParameter("id", shell.Id);
			param.AddParameter("target_id", shell.TargetId);
			param.AddParameter("target_level", shell.TargetLevel);
			param.AddParameter("status", shell.Status);

			param.AddParameter("shell_url", shell.ShellUrl);
			param.AddParameter("shell_pwd", shell.ShellPwd);
			param.AddParameter("shell_type", shell.ShellType);
			param.AddParameter("shell_extra_setting", shell.ShellExtraString);
			param.AddParameter("server_coding", shell.ServerCoding);
			param.AddParameter("web_coding", shell.WebCoding);

			param.AddParameter("area", shell.Area);
			param.AddParameter("remark", shell.Remark);
			param.AddParameter("add_time", shell.AddTime);

			return param;
		}
Exemple #11
0
		public static Shell ConvertDataRowToShellStruct(DataRow row)
		{
			Shell shell = new Shell();

			shell.Id = row["id"].ToString();
			shell.TargetId = row["target_id"].ToString();
			shell.TargetLevel = row["target_level"].ToString();
			shell.Status = row["status"].ToString();

			shell.ShellUrl = row["shell_url"].ToString();
			shell.ShellPwd = row["shell_pwd"].ToString();
			shell.ShellType = row["shell_type"].ToString();
			shell.ShellExtraString = row["shell_extra_setting"].ToString();
			shell.ServerCoding = row["server_coding"].ToString();
			shell.WebCoding = row["web_coding"].ToString();

			shell.Area = row["area"].ToString();
			shell.Remark = row["remark"].ToString();
			shell.AddTime = row["add_time"].ToString();

			return shell;
		}
Exemple #12
0
        /// <summary>
        /// 更新数据
        /// </summary>
        /// <param name="id"></param>
        /// <param name="model"></param>
		public static void Update(int id, Shell model)
        {
            Exception error = null;
            try
            {
                var dic = new Dictionary<string, object>
                {
                    {"id", id},
                    {"target_id", model.TargetId},
                    {"target_level", model.TargetLevel},
                    {"status", model.Status},
                    {"shell_url", model.ShellUrl},
                    {"shell_pwd", model.ShellPwd},
                    {"shell_type", model.ShellType},
                    {"shell_extra_setting", model.ShellExtraString},
                    {"server_coding", model.ServerCoding},
                    {"web_coding", model.WebCoding},
                    {"area", model.Area},
                    {"remark", model.Remark},
                    {"add_time", model.AddTime}
                };
                var where = new KeyValuePair<string, object>("id",id);
                _host.Database.Update(Tablename,dic,where);
            }
            catch (Exception ex)
            {
                error = ex;
                if (UpdateCompletedToDo != null)
                {
                    UpdateCompletedToDo(null, new CompletedEventArgs(error));
                }
            }
        }
Exemple #13
0
		public ShellCmder(IHost host, Shell data)
		{
			this._host = host;
			this._shellData = data;			
		}
Exemple #14
0
 public FileManager(IHost host, Shell data)
 {
     this._host = host;
     this._shellData = data;
 }
Exemple #15
0
        /// <summary>
        /// 插入数据
        /// </summary>
        /// <param name="model"></param>
		public static void Insert(Shell model)
        {
            Exception error = null;
            try
            {
                var dic = new Dictionary<string, object>
                {
                    //{"id", null},//主键自增长字段,不需要设置
                    {"target_id", model.TargetId},
                    {"target_level", model.TargetLevel},
                    {"status", model.Status},
                    {"shell_url", model.ShellUrl},
                    {"shell_pwd", model.ShellPwd},
                    {"shell_type", model.ShellType},
                    {"shell_extra_setting", model.ShellExtraString},
                    {"server_coding", model.ServerCoding},
                    {"web_coding", model.WebCoding},
                    {"area", model.Area},
                    {"remark", model.Remark},
                    {"add_time", model.AddTime}
                };
                _host.Database.Insert(Tablename, dic);
            }
            catch (Exception ex)
            {
                error = ex;
                if (InsertCompletedToDo != null)
                {
                    InsertCompletedToDo(null, new CompletedEventArgs(error));
                }
            }
        }
Exemple #16
0
		public static string[] GetShellSqlConnection(Shell data)
		{
			var shellExtra = new ShellExtra(data.ShellExtraString);
			return shellExtra.SqlConnection;
		}
Exemple #17
0
		public static WebHeaderCollection GetHttpHeader(Shell data)
		{
			var shellExtra = new ShellExtra(data.ShellExtraString);
			return shellExtra.HttpHeader;
		}
Exemple #18
0
	    private bool VerifyShell(Shell shell)
	    {
		    var success = true;
		    if (shell.TargetId == ""
				|| shell.ShellType == ""
				|| shell.ShellUrl == ""
				|| shell.ShellPwd == ""
				|| shell.ServerCoding == ""
				|| shell.WebCoding == "")
		    {
			    success = false;
			    MessageBox.Show(
					this,
					StrRes.GetString("StrPleaseFillOutTheProjectWith*","Please fill out the project with *"),
					MessageBoxType.Error);
		    }
			return success;
	    }
Exemple #19
0
		private byte[] SubmitCommand(Shell shell, string funcNameXpath, string[] param)
		{
			return Altman.Webshell.Service.SubmitCommand(shell, funcNameXpath, param);
		}
Exemple #20
0
        public DbManager(IHost host, Shell data, string dbType)
        {
            this._host = host;
            this._shellData = data;
	        this._dbType = dbType;
        }