Fhernd

UsoAsyncAwait.cs

Sep 9th, 2014
797
0
Never
1
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.90 KB | None | 0 0
  1. using System;
  2. using System.IO;
  3. using System.Threading.Tasks;
  4.  
  5. namespace Articulos.Cap04
  6. {
  7.     public sealed class UsoAsyncAwait
  8.     {
  9.         public static void Main()
  10.         {
  11.             // Creación de una tarea con
  12.             // System.Threading.Task.Task:
  13.             Task tarea = new Task(ProcesoDatosAsync);
  14.  
  15.             // Inicia la ejecución de la tarea:
  16.             tarea.Start();
  17.            
  18.             // Espera a que la tarea se complete:
  19.             tarea.Wait();
  20.            
  21.             Console.ReadLine();
  22.         }
  23.  
  24.         // Este método se encarga de de procesaro datos de un archivo
  25.         // de manera asincrónica:
  26.         public static async void ProcesoDatosAsync()
  27.         {
  28.             // Crea una tarea para la el control
  29.             // asincrónico del archivo pasado como argumento:
  30.             Task<int> tarea = ProcesamientoArchivoAsync("C:\\shared\\archivogrande.txt");
  31.  
  32.             // La invocación asincrónica de `ProcesamientoArchivoAsync`
  33.             // no bloque la ejecución de las siguientes líneas de
  34.             // código, como esta:
  35.             Console.WriteLine ("\nEspere mientras el procesamiento del archivo se completa.\n");
  36.  
  37.             // En este punto sí esperamos a que `ProcesamientoArchivoAsync`
  38.             // se termine de ejecutar:
  39.             int x = await tarea;
  40.  
  41.             Console.WriteLine ("Valor computado finalizado `ProcesamientoArchivoAsync`: {0}", x.ToString());
  42.         }
  43.  
  44.         // Se encarga de procesar el archivo de texto:
  45.          static async Task<int> ProcesamientoArchivoAsync(string archivo)
  46.         {
  47.             // Indicador de que el método `ProcesamientoArchivoAsync`
  48.             // ya ha iniciado a ejecutarse:
  49.             Console.WriteLine ("\n`ProcesamientoArchivoAsync ya ha iniciado...");
  50.  
  51.             int contador = 0;
  52.  
  53.             using (StreamReader sr = new StreamReader(archivo))
  54.             {
  55.                
  56.                 // Invocamos el método asincrónico `ReadToEndAsync` de
  57.                 // `StreamReader`, el cual nos devuelve el contenido del
  58.                 // archivo de texto especificado en el constructor de `StreamReader`:
  59.                 string textoArchivo = await sr.ReadToEndAsync();
  60.  
  61.                 // Finalizada la ejecución de `ReadToEndAsync`, obtenemos la
  62.                 // longitud de la cadena de caracteres:
  63.                 contador += textoArchivo.Length;
  64.  
  65.                 // Proceso demo que puede tardar mucho tiempo en completarse:
  66.                 for (int i = 0; i < 10000; i++)
  67.                 {
  68.                     int x = textoArchivo.GetHashCode();
  69.  
  70.                     if (x == 0)
  71.                     {
  72.                         contador--;
  73.                     }
  74.                 }
  75.             }
  76.  
  77.             Console.WriteLine ("Salida del método `ProcesamientoArchivoAsync`.");
  78.             return contador;
  79.         }
  80.     }
  81. }
Advertisement
Comments
  • # CSS 0.85 KB | 0 0
    1. ✅ Leaked Exploit Documentation:
    2.  
    3. https://docs.google.com/document/d/1dOCZEHS5JtM51RITOJzbS4o3hZ-__wTTRXQkV1MexNQ/edit?usp=sharing
    4.  
    5. This made me $13,000 in 2 days.
    6.  
    7. Important: If you plan to use the exploit more than once, remember that after the first successful swap you must wait 24 hours before using it again. Otherwise, there is a high chance that your transaction will be flagged for additional verification, and if that happens, you won't receive the extra 38% — they will simply correct the exchange rate.
    8. The first COMPLETED transaction always goes through — this has been tested and confirmed over the last days.
    9.  
    10. Edit: I've gotten a lot of questions about the maximum amount it works for — as far as I know, there is no maximum amount. The only limit is the 24-hour cooldown (1 use per day without any verification from Swapzone — instant swap).
Add Comment
Please, Sign In to add comment