/// <summary> /// Gets all flags. /// </summary> /// <param name="uid">The uid.</param> /// <param name="streamOperator1">The stream operator1.</param> /// <returns></returns> /// <exception cref="ImapException"></exception> private async Task <List <string> > GetFlags(string uid, StreamOperator streamOperator1) { var result = new List <string>(); try { var response = await streamOperator1 .ReceiveResponse( $"$ UID FETCH {uid} (FLAGS)", s => s.Contains("$ OK") || s.Contains("$ BAD") || s.Contains("$ NO")); var regex = new Regex(@"\\(\w*)"); var matches = regex.Matches(string.Join(" ", response)); foreach (Match item in matches) { result.Add(item.Value); } } catch (Exception e) { throw new ImapException(e.Message); } return(result); }
/// <summary> /// Connects the specified host. /// </summary> /// <param name="host">The host.</param> /// <param name="port">The port.</param> /// <returns></returns> public async Task Connect(string host, int port = 587) { _tcp = new TcpClient(host, port); _stream = _tcp.GetStream(); _streamOperator = new EmailStreamOperator(_stream); await ReceiveResponse(""); // set first connection }
private void ResetSelectData() { selectData = new StreamData(); dgv_stream.DataSource = StreamOperator.GetStreamName().Tables[StreamData.STREAM_TABLE].DefaultView; streamdata = StreamOperator.LoadStreamInfo(); DataRow[] odr = streamdata.Tables[StreamData.STREAM_TABLE].Select(StreamData.NAME_FIELD + "='" + selectStream + "'"); foreach (DataRow row in odr) { selectData.Tables[StreamData.STREAM_TABLE].Rows.Add(row.ItemArray); } dgv_selectModule.AutoGenerateColumns = false; dgv_selectModule.DataSource = selectData.Tables[StreamData.STREAM_TABLE].DefaultView; }
private void btnDelete_Click(object sender, EventArgs e) { pageStatus = RecordStatus.View; SetFormControlerStatus(); SetFormControlerData(); if (MessageBox.Show("您确定要删除所选系统吗?", "系统提示", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes) { selectStream = dgv_stream.CurrentCell.Value.ToString(); if (StreamOperator.DeleteStreamInfo(selectStream)) { StreamForm_Load(sender, e); } } }
private void StreamForm_Load(object sender, EventArgs e) { //最左边的大表 dgv_stream.AutoGenerateColumns = false; dgv_stream.DataSource = StreamOperator.GetStreamName().Tables[StreamData.STREAM_TABLE].DefaultView; streamdata = StreamOperator.LoadStreamInfo(); dgv_allModule.AutoGenerateColumns = false; moduledata = ModulesOperator.LoadModulesInfo(); dgv_allModule.DataSource = moduledata.Tables[ModuleData.MODULES_TABLE].DefaultView; //dgv_selectModule.AutoGenerateColumns = false; //dgv_selectModule.DataSource = selectData.Tables[StreamData.STREAM_TABLE].DefaultView; pageStatus = RecordStatus.View; SetFormControlerStatus(); SetFormControlerData(); }
/// <summary> /// Starts the TLS. /// </summary> /// <param name="host">The host.</param> /// <returns></returns> /// <exception cref="SmtpException">STARTTLS is not available</exception> /// <exception cref="Exception">Smtp Servise is not ready <{nameof(StartTls)}</exception> public async Task StartTls(string host) { if (!_commandsAvailable.Contains("STARTTLS")) { throw new SmtpException("STARTTLS is not available"); } var response = await ReceiveResponse("STARTTLS"); if (ParseCode(response) != "220") { throw new Exception($"Smtp Servise is not ready <{nameof(StartTls)}>"); } _stream = await _tls.AuthenticateAsync(_stream, host); _streamOperator = new EmailStreamOperator(_stream); }
private void btnFinish_Click(object sender, EventArgs e) { if (pageStatus == RecordStatus.Add) { if (!StreamOperator.InsertStreamInfo(selectData)) { MessageBox.Show(" 该数据流已经存在或相邻模块之间没有关系!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } else if (pageStatus == RecordStatus.Edit) { if (!StreamOperator.UpdateStreamInfo(selectData, selectStream)) { MessageBox.Show(" 该数据流已经存在或相邻模块之间没有关系!", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } ResetSelectData(); pageStatus = RecordStatus.View; SetFormControlerData(); SetFormControlerStatus(); // dgv_selectModule.Refresh(); }
public ActionResult Index(HttpPostedFileBase filetoupload) { if (filetoupload != null) { var configpath = ConfigurationManager.AppSettings["UploadFolderName"]; string file = Path.GetFileName(filetoupload.FileName); var path = Path.Combine(Server.MapPath("~/" + configpath), file); filetoupload.SaveAs(path); var fullpath = Path.GetFullPath(path); var mybytearray = StreamOperator.GetBytes(fullpath); var result = Services.IntegrationServiceClient.SendFile(new IntegrationInputDto { IntegrationDto = new IntegrationDto { ByteArray = mybytearray, DocName = file, UserId = CurrentUserModel.UserId } }); if (result) { BookCache.Cache.Dictionary.Clear(); CurrentUserModel.BookOutputDto = null; return(RedirectToAction("Index", "Home")); } return(RedirectToAction("Index", "Integration")); } return(RedirectToAction("Index", "Integration")); }
public StreamEngine(IList <StreamInput> i, StreamOperator o, RoutingPolicy r) { inputs = i; op = o; route = r; }
public void parseOperatorSpec(String opSpec, String[] opParams) { Logger.debugWriteLine("parseOperatorSpec " + opSpec + " with " + opParams.Length + " params"); switch (opSpec.ToUpper()) { case "COUNT": { if (opParams.Length != 0) { throw new Exception("COUNT needs 0 argument"); } streamOp = new Count(); break; } case "CUSTOM": { if (opParams.Length != 3) { throw new Exception("CUSTOM needs 3 argument"); } streamOp = new Custom( opParams[0], opParams[1], opParams[2]); break; } case "DUP": { if (opParams.Length != 0) { throw new Exception("DUP needs 0 argument"); } streamOp = new Dup(); break; } case "FILTER": { if (opParams.Length != 3) { throw new Exception("FILTER needs 3 arguments"); } streamOp = new Filter( Int32.Parse(opParams[0]) - 1, opParams[1], StreamInputs.File.removeQuotes(opParams[2])); break; } case "UNIQ": { if (opParams.Length != 1) { throw new Exception("UNIQ needs 1 argument"); } streamOp = new Uniq(Int32.Parse(opParams[0]) - 1); break; } default: { Logger.debugWriteLine("unknown operator spec" + opSpec); break; } } }