private void button_Add_Click(object sender, EventArgs e) { ShellStruct shellStruct = new ShellStruct(); shellStruct.Id = this.Id; shellStruct.TargetId = this.textBox_TargetID.Text.Trim(); shellStruct.TargetLevel = this.comboBox_TargetLevel.Text.Trim(); shellStruct.ShellUrl = this.textBox_ShellPath.Text.Trim(); shellStruct.ShellPwd = this.textBox_ShellPass.Text.Trim(); shellStruct.ShellExtraSetting = this.richTextBox_Setting.Text.Trim(); shellStruct.Remark = this.textBox_Remark.Text.Trim(); shellStruct.ShellType = this.comboBox_ScritpType.Text.Trim(); shellStruct.ServerCoding = this.comboBox_ServerCoding.Text.Trim(); shellStruct.WebCoding = this.comboBox_WebCoding.Text.Trim(); shellStruct.Area = this.comboBox_Area.Text.Trim(); string time = DateTime.Now.Date.ToShortDateString(); if (time.Contains("/")) { time = time.Replace("/", "-"); } shellStruct.AddTime = time; _shellManager.Insert(shellStruct); OnWebshellChange(EventArgs.Empty); this.Close(); }
public static void ImportAltmanShellFromXml() { var openFileDialog = new OpenFileDialog { Title = "Select Altman Xml To Import", Filters = { new FileDialogFilter("Altman Xml", ".xml") } }; if (openFileDialog.ShowDialog(Application.Instance.MainForm) == DialogResult.Ok) { var srcfile = openFileDialog.FileName; try { var xmlString = GetAltmanXml(srcfile); var datas = ConvertXmlToDataTable(xmlString); var shellList = new List <Shell>(); foreach (DataRow row in datas.Rows) { shellList.Add(ConvertAltmanDataRowToShell(row)); } foreach (var shell in shellList) { ShellManager.Insert(shell); } if (shellList.Count > 0) { MessageBox.Show(string.Format("Imported {0} Shell(s)", shellList.Count)); } } catch (Exception ex) { MessageBox.Show(ex.Message); } } }
public static void ImportCaidaoShell() { if (!Eto.EtoEnvironment.Platform.IsWindows) { MessageBox.Show("Sorry, only supports windows."); return; } var openFileDialog = new OpenFileDialog { Title = "Select Caidao Databse To Import", Filters = { new FileDialogFilter("Caidao Databses", ".mdb") } }; if (openFileDialog.ShowDialog(Application.Instance.MainForm) == DialogResult.Ok) { var srcfile = openFileDialog.FileName; //var pwd = "密" + (char) 13 + (char) 9 + (char) 10 + "码" + (char) 2; var pwd = Encoding.GetEncoding(936).GetString(new byte[] { 0xc3, 0xdc, 0x0d, 0x09, 0x0a, 0xc2, 0xeb, 0x02 }); var connString = string.Format("Provider=Microsoft.Jet.OLEDB.4.0;" + "Data Source={0};" + "Mode=Share Deny Read|Share Deny Write;Persist Security Info=False;" + "Jet OLEDB:Database Password=\"{1}\"", srcfile, pwd); AccessHelper.ConnString = connString; try { var sites = GetCaiDaoSite(); var shellList = new List <Shell>(); foreach (DataRow row in sites.Rows) { shellList.Add(ConvertCaiDaoDataRowToShell(row)); } foreach (var shell in shellList) { ShellManager.Insert(shell); } if (shellList.Count > 0) { MessageBox.Show(string.Format("Imported {0} Shell(s)", shellList.Count)); MessageBox.Show( StrRes.GetString("StrImportCaidaoShellInfo", "Although the data of caidao be imported successfully, but it's scriptType and Config are not compatible with altman, you may still need to modify some data manually.")); } } catch (Exception ex) { MessageBox.Show(ex.Message); } } }
private void buttonAdd_Click(object sender, EventArgs e) { var shell = GetShellConfigFromPanel(); //验证Shell是否合法 if (!VerifyShell(shell)) { return; } ShellManager.Insert(shell); OnWebshellChange(EventArgs.Empty); Close(); }