static void MakeIPS(string[] args) { string input = ""; string input2 = ""; string output = ""; Console.WriteLine("Parsing arguments..."); foreach (string a in args) { string ar = a.Trim().ToLower(); if (ar.StartsWith("/original:")) { int idx = ar.IndexOf(':') + 1; input = ar.Substring(idx); } else if (ar.StartsWith("/modified:")) { int idx = ar.IndexOf(':') + 1; input2 = ar.Substring(idx); } if (ar.StartsWith("/output:")) { int idx = ar.IndexOf(':') + 1; output = ar.Substring(idx); } } if (input.Length > 0 && input2.Length > 0) { IPS.Create(input, input2, output); } else { Console.WriteLine("No Input file specified."); } }
public ActionResult Create([Bind(Include = "id_ips,nombre,nit,telefono,nombre_contacto,apellidos_contacto,transferencia,numero_cuenta")] IPS iPS) { try { if (ModelState.IsValid) { if (!iPS.isValidated) { throw new Exception(); } db.IPS.Add(iPS); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(iPS)); } catch (Exception ex) { foreach (var issue in iPS.GetReglasValidacion()) { ModelState.AddModelError(issue.propiedad, issue.mensaje); } return(View(iPS)); } }
public async Task <Response> Update(int id, IPSRequest request) { IPS iPS = await _IPSRepository.FindById(id); if (iPS == null) { return(new Response { IsSuccess = false, Message = Messages.NotFound.ToString() }); } iPS.Name = request.Name; iPS.NIT = request.NIT; int result = await _IPSRepository.Update(iPS); if (result > 0) { return(new Response { IsSuccess = true, Message = Messages.Updated.ToString(), Result = result }); } else { return(new Response { IsSuccess = false, Message = Messages.NotUpdated.ToString() }); } }
public async Task <int> Update(IPS data) { _context.IPSs.Update(data); await _context.SaveChangesAsync(); return(1); }
public IActionResult CreateIps(CreateIpsViewModel model) { if (ModelState.IsValid) { var ips = new IPS(); var direction = new Direction(); ips.Name = model.Name; ips.Type = model.Type; ips.ServicesList = new List <Service>(); direction.Type = model.Direction.Type; direction.Avenue = model.Direction.Avenue; direction.Street = model.Direction.Street; direction.Number = model.Direction.Number; _servicesAmbulance.AddDirection(direction); ips.Direction = direction; _servicesAmbulance.AddIps(ips); _servicesAmbulance.Commit(); return(RedirectToAction("Ips")); } return(View()); }
private void btn_IrIniciarSesion_Click(object sender, EventArgs e) { if (txt_usuario.Text == "") { MessageBox.Show("Ingrese un usuario"); txt_contraseña.Clear(); } else if (txt_contraseña.Text == "") { MessageBox.Show("Ingrese una Contraseña"); txt_usuario.Clear(); } else { string contraseña = txt_contraseña.Text; string usuario = txt_usuario.Text; IPS ips = new IPS(); if (ips.IniciarSesion(usuario, contraseña)) { Form Modulo = new Modulo_Principal(); Modulo.Show(); this.Hide(); txt_contraseña.Clear(); txt_usuario.Clear(); } else { MessageBox.Show("Datos Incorrectos"); } } }
public async Task <int> Create(IPS data) { _context.IPSs.Add(data); await _context.SaveChangesAsync(); return(data.Id); }
public async Task <int> Delete(int id) { IPS data = await _context.IPSs.FindAsync(id); if (data == null) { return(0); } _context.IPSs.Remove(data); await _context.SaveChangesAsync(); return(1); }
public ActionResult DeleteConfirmed(int id) { try { IPS iPS = db.IPS.Find(id); db.IPS.Remove(iPS); db.SaveChanges(); return(RedirectToAction("Index")); } catch (Exception ex) { return(new HttpStatusCodeResult(HttpStatusCode.InternalServerError)); } }
private void timer1_Tick(object sender, EventArgs e) { timer1.Stop(); //if (IPS.Contains("192.168.113.73")) // this.SendLed("192.168.113.73"); List <ScreenLEDEntity> listscreen = ScreenLedFactory.GetAllLed(); foreach (ScreenLEDEntity screen in listscreen) { if (IPS.Contains(screen.IPADDRESS)) { this.SendLed(screen.IPADDRESS); } } timer1.Start(); }
// GET: IPS/Edit/5 public ActionResult Edit(int?id) { try { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } IPS iPS = db.IPS.Find(id); if (iPS == null) { return(HttpNotFound()); } return(View(iPS)); } catch (Exception ex) { return(new HttpStatusCodeResult(HttpStatusCode.InternalServerError)); } }
private void iPSToolStripMenuItem_Click(object sender, EventArgs e) { if (romFile.FileLoaded) { OpenFileDialog ofd = new OpenFileDialog(); ofd.Title = "Open original file"; ofd.Filter = "GB/GBC Files|*.gb;*.gbc|All Files|*"; ofd.FileName = ""; if (ofd.ShowDialog() == System.Windows.Forms.DialogResult.OK) { byte[] orig = File.ReadAllBytes(ofd.FileName); if (orig.Length != romFile.Length) { Error.ShowErrorMessage(ErrorMessage.IPS_FileSizeMismatch); } SaveFileDialog afd = new SaveFileDialog(); afd.Title = "Save IPS File..."; afd.Filter = "GB/GBC Files|*.gb;*.gbc|All Files|*"; afd.FileName = ""; if (afd.ShowDialog() == System.Windows.Forms.DialogResult.OK) { IPS ips = new IPS(); ErrorMessage emt = ips.GenerateIPS(orig, romFile.MainFile); if (emt != ErrorMessage.General_NoError) { File.WriteAllBytes(afd.FileName, ips.GetIPS()); MessageBox.Show("Patch successfuly written to " + Environment.NewLine + afd.FileName); } else { Error.ShowErrorMessage(emt); } } } } else { Error.ShowErrorMessage(ErrorMessage.General_NoFileLoaded); } }
public async Task <Response> FindById(int id) { IPS result = await _IPSRepository.FindById(id); if (result != null) { return(new Response { IsSuccess = true, Message = Messages.Found.ToString(), Result = result }); } else { return(new Response { IsSuccess = false, Message = Messages.NotFound.ToString() }); } }
public async Task <Response> Create(IPSRequest model) { IPS info = _mapper.Map <IPS>(model); int result = await _IPSRepository.Create(info); if (result > 0) { return(new Response { IsSuccess = true, Message = Messages.Created.ToString(), Result = result }); } else { return(new Response { IsSuccess = false, Message = Messages.NotCreated.ToString() }); } }
static int[] ROMMult = new int[] { 0x25000, 0x50000, 0x100000, 0x200000, 0x300000, 0x400000, 0x50000, 0x60000, 0x70000, 0x80000 }; //Up to 64Mbit static void FinalizeBuild(Build b, string outfile, string outfolder) { DateTime start = DateTime.Now; foreach (section s in b.buildSections) { if (File.Exists(s.path)) { BuildSection(outfile, s.path, b.path, s); } else { if (s.path.Contains("|")) { string[] files = s.path.Split('|'); bool allgood = true; string allfiles = ""; foreach (string fi in files) { if (!File.Exists(outfolder + fi)) { allgood = false; Console.WriteLine(s.path + " - File does not exist."); } else { allfiles += (allfiles == "") ? outfolder + fi : "|" + outfolder + fi; } } if (allgood) { BuildSection(outfile, allfiles, b.path, s); } } else { if (File.Exists(outfolder + s.path)) { BuildSection(outfile, outfolder + s.path, b.path, s); } else { Console.WriteLine(s.path + " - File does not exist."); } } } } if (!(b.revbyteloc == "")) { int offset = 0; try { offset = int.Parse(b.revbyteloc, NumberStyles.HexNumber); } catch { Console.WriteLine("Invalid Revision Offset HEX value."); } if (offset > 0) { byte[] newfile = File.ReadAllBytes(outfile); newfile[offset] = Convert.ToByte(b.revision); File.WriteAllBytes(outfile, newfile); } } Console.WriteLine("Build Sub-Sections Complete (Elapsed: " + GetElapsedTime(start) + ")"); if (b.pad == "true") { //now check to see if the ROM file has grown larger. byte[] newfile = File.ReadAllBytes(outfile); byte[] oldfile = File.ReadAllBytes(outfolder + b.original); if (newfile.Length > oldfile.Length) {//if so, then pad the file to the next Size PadROM(newfile, outfile); } //recalculate checksum SNESChecksum.FixROM(outfile); } //make xdelta and ips patches if specified... if (b.diff.Split('|').Contains("xdelta")) { xDelta.Make(outfolder + b.original, outfile); } if (b.diff.Split('|').Contains("ips")) { IPS.Create(outfolder + b.original, outfile); } }
public async Task <IPS> FindById(int id) { IPS data = await _context.IPSs.FindAsync(id); return(data); }
public void AddIps(IPS Ips) { _context.Ips.Add(Ips); }