E:\TrabalhoSuely\RoboDescompilado\Redistribuir\ZionRobot\Tasks\Output.cs E:\TrabalhoSuely\RoboDescompilado\CriarVerificar\ZionRobot\Tasks\Output.cs
using System; using System;
using System.Collections.Concurrent; using System.Collections.Concurrent;
using System.Diagnostics; using System.Diagnostics;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Threading; using System.Threading;
using System.Windows; using System.Windows;
using System.Windows.Threading; using System.Windows.Threading;
using ZionRobot.Handlers; using ZionRobot.Handlers;
using ZionRobot.Models.Items; using ZionRobot.Models.Items;
using ZionRobot.Models.Source; using ZionRobot.Models.Source;
using ZionRobot.Persistence; using ZionRobot.Persistence;
using ZionVault.Binder.Output; using ZionVault.Binder.Output;
   
namespace ZionRobot.Tasks namespace ZionRobot.Tasks
{ {
    // Token: 0x02000021 RID: 33     // Token: 0x02000018 RID: 24
    internal class Output     internal class Output
    {     {
        // Token: 0x17000030 RID: 48         // Token: 0x1700001E RID: 30
        // (get) Token: 0x060000BA RID: 186 RVA: 0x000067E4 File Offset: 0x000049E4         // (get) Token: 0x06000082 RID: 130 RVA: 0x00005624 File Offset: 0x00003824
        public bool Running         public bool Running
        {         {
            get             get
            {             {
                return this.running;                 return this.running;
            }             }
        }         }
   
        // Token: 0x060000BB RID: 187 RVA: 0x000067EC File Offset: 0x000049EC         // Token: 0x06000083 RID: 131 RVA: 0x0000562C File Offset: 0x0000382C
        public Output()         public Output()
        {         {
            this.running = false;             this.running = false;
        }         }
   
        // Token: 0x060000BC RID: 188 RVA: 0x00006814 File Offset: 0x00004A14         // Token: 0x06000084 RID: 132 RVA: 0x00005654 File Offset: 0x00003854
        public void Execute(Origin source, ZionRobot.Models.Items.File file)         public void Execute(Origin source, ZionRobot.Models.Items.File file)
        {         {
            this.running = true;             this.running = true;
            this.stopwatch.Start();             this.stopwatch.Start();
            Application.Current.Dispatcher.Invoke(delegate()             Application.Current.Dispatcher.Invoke(delegate()
            {             {
                this.handler = Browser.Instance;                 this.handler = Browser.Instance;
            });             });
            System.Action <>9__4;             System.Action <>9__4;
            ThreadStart <>9__2;             ThreadStart <>9__2;
            System.Action <>9__5;             System.Action <>9__5;
            ThreadStart <>9__3;             ThreadStart <>9__3;
            new Thread(delegate()             new Thread(delegate()
            {             {
                ThreadStart start;                 ThreadStart start;
                if ((start = <>9__2) == null)                 if ((start = <>9__2) == null)
                {                 {
                    start = (<>9__2 = delegate()                     start = (<>9__2 = delegate()
                    {                     {
                        try                         try
                        {                         {
                            Dispatcher dispatcher = Application.Current.Dispatcher;                             Dispatcher dispatcher = Application.Current.Dispatcher;
                            System.Action callback;                             System.Action callback;
                            if ((callback = <>9__4) == null)                             if ((callback = <>9__4) == null)
                            {                             {
                                callback = (<>9__4 = delegate()                                 callback = (<>9__4 = delegate()
                                {                                 {
                                    this.map(file);                                     this.map(file);
                                    this.handler.Source = source;                                     this.handler.Source = source;
                                    Directory.CreateDirectory(Path.Combine(Basic.DoneFolder, source.Title));                                     Directory.CreateDirectory(Path.Combine(Basic.DoneFolder, source.Title));
                                    this.handler.ExecuteAndMove(file, Path.Combine(Basic.DoneFolder, source.Title));                                     this.handler.ExecuteAndMove(file, Path.Combine(Basic.DoneFolder, source.Title));
                                });                                 });
                            }                             }
                            dispatcher.Invoke(callback);                             dispatcher.Invoke(callback);
                        }                         }
                        catch (Exception ex)                         catch (Exception ex)
                        {                         {
                            file.Status = "ERROR";                             file.Status = "ERROR";
                        }                         }
                    });                     });
                }                 }
                Thread t = new Thread(start);                 Thread t = new Thread(start);
                t.Start();                 t.Start();
                ThreadStart start2;                 ThreadStart start2;
                if ((start2 = <>9__3) == null)                 if ((start2 = <>9__3) == null)
                {                 {
                    start2 = (<>9__3 = delegate()                     start2 = (<>9__3 = delegate()
                    {                     {
                        while (this.handler.Main == null || this.handler.Main.IsAlive)                         while (this.handler.Main == null || this.handler.Main.IsAlive)
                        {                         {
                            bool flag = this.stopwatch.Elapsed.TotalSeconds > (double)this.limitTime;                             bool flag = this.stopwatch.Elapsed.TotalSeconds > (double)this.limitTime;
                            if (flag)                             if (flag)
                            {                             {
                                break;                                 break;
                            }                             }
                            Thread.Sleep(1000);                             Thread.Sleep(1000);
                        }                         }
                        this.stopwatch.Stop();                         this.stopwatch.Stop();
                        this.stopwatch.Reset();                         this.stopwatch.Reset();
                        Dispatcher dispatcher = Application.Current.Dispatcher;                         Dispatcher dispatcher = Application.Current.Dispatcher;
                        System.Action callback;                         System.Action callback;
                        if ((callback = <>9__5) == null)                         if ((callback = <>9__5) == null)
                        {                         {
                            callback = (<>9__5 = delegate()                             callback = (<>9__5 = delegate()
                            {                             {
                                this.handler.Close();                                 this.handler.Close();
                            });                             });
                        }                         }
                        dispatcher.Invoke(callback);                         dispatcher.Invoke(callback);
                        this.running = false;                         this.running = false;
                    });                     });
                }                 }
                new Thread(start2).Start();                 new Thread(start2).Start();
            }).Start();             }).Start();
        }         }
   
        // Token: 0x060000BD RID: 189 RVA: 0x00006884 File Offset: 0x00004A84         // Token: 0x06000085 RID: 133 RVA: 0x000056C4 File Offset: 0x000038C4
.        public void Execute(Origin source)  
        {  
            this.running = true;  
            this.stopwatch.Start();  
            Application.Current.Dispatcher.Invoke(delegate()  
            {  
                this.handler = Browser.Instance;  
            });  
            System.Action <>9__4;  
            ThreadStart <>9__2;  
            System.Action <>9__5;  
            ThreadStart <>9__3;  
            new Thread(delegate()  
            {  
                ThreadStart start;  
                if ((start = <>9__2) == null)  
                {  
                    start = (<>9__2 = delegate()  
                    {  
                        try  
                        {  
                            Dispatcher dispatcher = Application.Current.Dispatcher;  
                            System.Action callback;  
                            if ((callback = <>9__4) == null)  
                            {  
                                callback = (<>9__4 = delegate()  
                                {  
                                    this.handler.Source = source;  
                                    Directory.CreateDirectory(Path.Combine(Basic.DoneFolder, source.Title));  
                                    this.handler.ExecuteDemo();  
                                });  
                            }  
                            dispatcher.Invoke(callback);  
                        }  
                        catch (Exception ex)  
                        {  
                        }  
                    });  
                }  
                Thread t = new Thread(start);  
                t.Start();  
                ThreadStart start2;  
                if ((start2 = <>9__3) == null)  
                {  
                    start2 = (<>9__3 = delegate()  
                    {  
                        while (this.handler.Main == null || this.handler.Main.IsAlive)  
                        {  
                            bool flag = this.stopwatch.Elapsed.TotalSeconds > (double)this.limitTime;  
                            if (flag)  
                            {  
                                break;  
                            }  
                            Thread.Sleep(1000);  
                        }  
                        this.stopwatch.Stop();  
                        this.stopwatch.Reset();  
                        Dispatcher dispatcher = Application.Current.Dispatcher;  
                        System.Action callback;  
                        if ((callback = <>9__5) == null)  
                        {  
                            callback = (<>9__5 = delegate()  
                            {  
                                this.handler.Close();  
                            });  
                        }  
                        dispatcher.Invoke(callback);  
                        this.running = false;  
                    });  
                }  
                new Thread(start2).Start();  
            }).Start();  
        }  
   
        // Token: 0x060000BE RID: 190 RVA: 0x000068EC File Offset: 0x00004AEC  
        private void map(ZionRobot.Models.Items.File file)         private void map(ZionRobot.Models.Items.File file)
        {         {
            (from p in file.METAObject.Pages             (from p in file.METAObject.Pages
            select p.SearchElements).ToList<ConcurrentBag<Field>>().ForEach(delegate(ConcurrentBag<Field> PageElements)             select p.SearchElements).ToList<ConcurrentBag<Field>>().ForEach(delegate(ConcurrentBag<Field> PageElements)
            {             {
                PageElements.ToList<Field>().ForEach(delegate(Field f)                 PageElements.ToList<Field>().ForEach(delegate(Field f)
                {                 {
                    bool flag = f.Type == "Date";                     bool flag = f.Type == "Date";
                    if (flag)                     if (flag)
                    {                     {
                        f.Value = DateTime.Parse(f.Value).ToString("dd/MM/yyyy");                         f.Value = DateTime.Parse(f.Value).ToString("dd/MM/yyyy");
                    }                     }
                    this.handler.DictionaryValues.Add(f.FullName, f.Value);                     this.handler.DictionaryValues.Add(f.FullName, f.Value);
                });                 });
            });             });
        }         }
   
        // Token: 0x04000046 RID: 70         // Token: 0x0400002D RID: 45
        private bool running;         private bool running;
   
        // Token: 0x04000047 RID: 71         // Token: 0x0400002E RID: 46
        private Browser handler;         private Browser handler;
   
        // Token: 0x04000048 RID: 72         // Token: 0x0400002F RID: 47
        private int limitTime = 1200;         private int limitTime = 1200;
   
        // Token: 0x04000049 RID: 73         // Token: 0x04000030 RID: 48
        private Stopwatch stopwatch = new Stopwatch();         private Stopwatch stopwatch = new Stopwatch();
    }     }
} }