Ejemplo n.º 1
0
        private Task getPayloadsDownloadTask(int taskId)
        {
            return(Task.Run(() => {
                //Process.GetCurrentProcess().Threads.Count;

                ScriptEngine <PayloadsDownloader, PayloadsDownloaderData> downloadScript = new ScriptEngine <PayloadsDownloader, PayloadsDownloaderData>();
                PayloadsDownloaderData d = _data.DownloadData.Copy();
                d.TaskId = taskId;

                PayloadsUpdateData d1 = _data.UpdateData.Copy();
                d1.TaskId = taskId;

                PayloadsUploaderData d2 = _data.UploadData.Copy();
                d2.TaskId = taskId;
                Debug.WriteLine("Current has {0} Threads", Process.GetCurrentProcess().Threads.Count);
                Debug.WriteLine("Thread:{0} is running payloads task:{1}", Thread.CurrentThread.ManagedThreadId, taskId);
                downloadScript.Run(d);
                //Debug.WriteLine("Thread:{0} Finished Download task:{1}", Thread.CurrentThread.ManagedThreadId, taskId);

                ScriptEngine <PayloadsUpdate, PayloadsUpdateData> updateScript = new ScriptEngine <PayloadsUpdate, PayloadsUpdateData>();

                //Debug.WriteLine("Thread:{0} is running update task:{1}", Thread.CurrentThread.ManagedThreadId, taskId);
                updateScript.Run(d1);



                ScriptEngine <PayloadsUploader, PayloadsUploaderData> uploadScript = new ScriptEngine <PayloadsUploader, PayloadsUploaderData>();
                uploadScript.Run(d2);
                Debug.WriteLine("Thread:{0} Finished payloads task:{1}", Thread.CurrentThread.ManagedThreadId, taskId);
            }));
        }
Ejemplo n.º 2
0
 public PayloadsUploaderData Copy(PayloadsUploaderData data)
 {
     return(new PayloadsUploaderData()
     {
         Host = data.Host,
         Port = data.Port,
         UserName = data.UserName,
         Password = data.Password,
         ProxyHost = data.ProxyHost,
         ProxyHostPort = data.ProxyHostPort
     });
 }