private void button1_Click_1(object sender, EventArgs e) { if (openFileDialog1.ShowDialog() == DialogResult.OK) { Bbs.SendFile(openFileDialog1.FileName, true); } }
public void Receive(byte c) { if (this.tbDisplay.InvokeRequired) { SetTextCallback d = new SetTextCallback(Receive); this.Invoke(d, new object[] { c }); } else { c = (byte)(Bbs.TerminalType.TranslateFromTerminal((char)c)); Bbs.Write("~c7" + (char)c); if ((c.Equals('\r') || (c.Equals('\n') || c.Equals(13)))) { if (currentline != "") { AppendText(lblUsername.Text + ": ", Color.Yellow, true); AppendText(currentline + "\r\n", Color.Yellow, false); currentline = ""; } } else { currentline += (char)c; } } //textBox1.Text += str; }
private void SendMessage() { Bbs.WriteLine("~l1~c1" + tbEntry.Text); AppendText("\r\nSysop: ", Color.White, true); AppendText(tbEntry.Text + "\r\n", Color.White, false); tbEntry.Text = ""; }
private void btSendFile_Click(object sender, EventArgs e) { if (openFileDialog1.ShowDialog() == DialogResult.OK) { Bbs.SendFile(openFileDialog1.FileName, false); } }
public async Task <IActionResult> InsertBbs(Bbs bbs) { var currentUser = HttpContext.User; if (currentUser.HasClaim(c => c.Type == "username")) { var username = currentUser.Claims.FirstOrDefault(c => c.Type == "username").Value; Usuario user = await _context.Usuarios.FirstOrDefaultAsync <Usuario>(u => u.Username == username); await _context.Bbss.AddAsync(bbs); await _context.SaveChangesAsync(); Bitacora bitacora = new Bitacora { Fecha = DateTime.Now, UsuarioId = user.Id, DescripcionBitacora = "Insertó nuevo BBS con ID " + bbs.Id }; await _context.Bitacora.AddAsync(bitacora); await _context.SaveChangesAsync(); return(StatusCode(201)); } return(Unauthorized()); }
public void AggiornaStato() { Operation = _uo.Operation; Srs.AggiornaStato(); As.AggiornaStato(); Bcs.AggiornaStato(); Bbs.AggiornaStato(); Rs.AggiornaStato(); }
private void button2_Click(object sender, EventArgs e) { Bbs.State_Object.SoloReceiver(OldReceiver); Bbs.Receive((byte)'\r'); Bbs.WriteLine("~l1~l1~d2Leaving Chat with SysOp"); btKickUser.Enabled = false; btEndChat.Enabled = false; btSend.Enabled = false; btSendFile.Enabled = false; tbEntry.Enabled = false; //this.Close(); }
public async Task <IActionResult> CreateBBS(MoBBSInfo moBBS) { if (!HttpContext.TryGetUserInfo(out var userInfo)) { this.MsgBox("登录已过期,请重新登录"); return(View()); } ViewData["Id"] = userInfo.Id; ViewData["UserName"] = userInfo.UserName; ViewData["HeadPhoto"] = userInfo.HeadPhoto; ViewData["Role"] = userInfo.Roles.ToLower(); if (!ModelState.IsValid) { this.MsgBox("验证论坛信息失败,请重试"); return(View()); } if (String.IsNullOrWhiteSpace(moBBS.BBSName)) { this.MsgBox("论坛名称不可为空!"); return(View()); } var isExsit = _uf.BBSRepository.IsExist(x => x.Bbstype == moBBS.BBSType && x.Bbsname.Equals(moBBS.BBSName, StringComparison.OrdinalIgnoreCase)); if (isExsit) { this.MsgBox("该论坛已存在,请不要重复创建"); return(View()); } var bbs = new Bbs { UserId = userInfo.Id, Bbsname = moBBS.BBSName, Bbstype = moBBS.BBSType }; await _uf.BBSRepository.InsertAsync(bbs); var result = await _uf.SaveChangesAsync(); if (result <= 0) { this.MsgBox("创建论坛失败"); return(View()); } BBSList.FreshBBSList(_uf); this.MsgBox($"恭喜你,创建论坛【{moBBS.BBSName}】成功"); return(View()); }
public async Task <IActionResult> UpdateBbs(Bbs bbs) { var currentUser = HttpContext.User; if (currentUser.HasClaim(c => c.Type == "username")) { var username = currentUser.Claims.FirstOrDefault(c => c.Type == "username").Value; Usuario user = await _context.Usuarios.FirstOrDefaultAsync <Usuario>(u => u.Username == username); var bbsObj = await _context.Bbss.SingleOrDefaultAsync(b => b.Id == bbs.Id); if (bbsObj != null) { bbsObj.ObservadorId = bbs.ObservadorId; bbsObj.ProcesoId = bbs.ProcesoId; bbsObj.TipoComportamientoId = bbs.TipoComportamientoId; bbsObj.AreaId = bbs.AreaId; bbsObj.ComportamientoId = bbs.ComportamientoId; bbsObj.Fecha = bbs.Fecha; bbsObj.TipoObservadoId = bbs.TipoObservadoId; _context.Bbss.Update(bbsObj); await _context.SaveChangesAsync(); Bitacora bitacora = new Bitacora { Fecha = DateTime.Now, UsuarioId = user.Id, DescripcionBitacora = "Actualizó BBS con ID " + bbs.Id }; await _context.Bitacora.AddAsync(bitacora); await _context.SaveChangesAsync(); return(StatusCode(202)); } return(StatusCode(400)); } return(Unauthorized()); }