| using System; |
| using System; |
| using System.Collections.Generic; |
| using System.Collections.Generic; |
. | using System.IO; |
| |
| using System.Linq; |
| using System.Linq; |
| using System.Threading; |
| using System.Threading; |
| using ZionFoundation.Threading; |
| using ZionFoundation.Threading; |
| using ZionRobot.Models.Items; |
| using ZionRobot.Models.Items; |
| using ZionRobot.Models.Process; |
| using ZionRobot.Models.Process; |
| using ZionRobot.Models.Source; |
| using ZionRobot.Models.Source; |
. | using ZionRobot.Models.ZFlow; |
| |
| using ZionRobot.Persistence; |
| using ZionRobot.Persistence; |
. | using ZionRobot.WebService; |
| |
| using ZionVault.Binder.Output; |
| using ZionVault.Binder.Output; |
| |
| |
| namespace ZionRobot.Tasks |
| namespace ZionRobot.Tasks |
| { |
| { |
| // Token: 0x02000020 RID: 32 |
| // Token: 0x02000017 RID: 23 |
| internal class JobManager : ZionFoundation.Threading.Thread |
| internal class JobManager : ZionFoundation.Threading.Thread |
| { |
| { |
| // Token: 0x1700002F RID: 47 |
| // Token: 0x1700001D RID: 29 |
| // (get) Token: 0x060000B2 RID: 178 RVA: 0x00006293 File Offset: 0x00004493 |
| // (get) Token: 0x0600007B RID: 123 RVA: 0x000052CB File Offset: 0x000034CB |
| // (set) Token: 0x060000B3 RID: 179 RVA: 0x0000629B File Offset: 0x0000449B |
| // (set) Token: 0x0600007C RID: 124 RVA: 0x000052D3 File Offset: 0x000034D3 |
| internal Workflow Workflow |
| internal Workflow Workflow |
| { |
| { |
| get |
| get |
| { |
| { |
| return this.workflow; |
| return this.workflow; |
| } |
| } |
| set |
| set |
| { |
| { |
| this.workflow = value; |
| this.workflow = value; |
| } |
| } |
| } |
| } |
| |
| |
| // Token: 0x060000B4 RID: 180 RVA: 0x000062A4 File Offset: 0x000044A4 |
| // Token: 0x0600007D RID: 125 RVA: 0x000052DC File Offset: 0x000034DC |
| public JobManager(Workflow workflow, bool execute = true) |
| public JobManager(Workflow workflow, bool execute = true) |
| { |
| { |
| this.workflow = workflow; |
| this.workflow = workflow; |
. | this.interval = 60000; |
| this.interval = 900000; |
| this.TInput = new Input(); |
| this.TInput = new Input(); |
| this.TExtractor = new Extractor(); |
| this.TExtractor = new Extractor(); |
| this.TOutput = new Output(); |
| this.TOutput = new Output(); |
| this.TSynchronizer = new Synchronizer(); |
| this.TSynchronizer = new Synchronizer(); |
| this.workflow.Folders.Add(new Folder(Basic.SearchResultFolder, true)); |
| this.workflow.Folders.Add(new Folder(Basic.SearchResultFolder, true)); |
| base.Initilize(execute); |
| base.Initilize(execute); |
| this.workflow.Queue.Start(); |
| this.workflow.Queue.Start(); |
| } |
| } |
| |
| |
| // Token: 0x060000B5 RID: 181 RVA: 0x00006338 File Offset: 0x00004538 |
| // Token: 0x0600007E RID: 126 RVA: 0x00005364 File Offset: 0x00003564 |
| public override void Execute() |
| public override void Execute() |
| { |
| { |
| bool flag = !this.tasksIsAlive(); |
| bool flag = !this.tasksIsAlive(); |
| if (flag) |
| if (flag) |
| { |
| { |
. | bool flag2 = this.sync == "Local"; |
| this.workflow.InputConfigurations.ForEach(delegate(Origin source) |
| if (flag2) |
| |
| { |
| { |
. | string rootPath = "C:\\Temp\\html\\"; |
| this.TInput.Execute(source); |
| Origin source = this.workflow.SyncConfigurations[0]; |
| while (this.TInput.Running) |
| Directory.GetFiles(rootPath + "andamentos", "*.json").ToList<string>().ForEach(delegate(string file) |
| |
| { |
| { |
. | string fileName = Path.GetFileName(file); |
| System.Threading.Thread.Sleep(2000); |
| this.TSynchronizer.SyncFromLocal(source, file, "Andamentos"); |
| } |
| while (this.TSynchronizer.Running) |
| }); |
| { |
| List<File> filesExtraction = this.workflow.Queues.Extraction; |
| System.Threading.Thread.Sleep(2000); |
| bool flag2 = filesExtraction.Count > 0; |
| } |
| if (flag2) |
| System.IO.File.Move(file, rootPath + "sincronizados\\andamentos\\" + fileName); |
| |
| }); |
| |
| } |
| |
| bool flag3 = this.sync == "Demo"; |
| |
| if (flag3) |
| |
| { |
| { |
. | this.workflow.OutputConfigurations.ForEach(delegate(Origin source) |
| filesExtraction.ForEach(delegate(File file) |
| { |
| { |
. | this.TOutput.Execute(source); |
| this.TExtractor.Execute(file, this.workflow.Blueprints); |
| while (this.TOutput.Running) |
| |
| { |
| |
| System.Threading.Thread.Sleep(2000); |
| |
| } |
| |
| }); |
| }); |
. | |
| filesExtraction.Clear(); |
| } |
| } |
. | bool flag4 = this.sync == "Publications"; |
| List<File> filesIntegration = new List<File>(); |
| if (flag4) |
| using (List<File>.Enumerator enumerator = this.workflow.Queues.Integration.GetEnumerator()) |
| { |
| { |
. | this.workflow.InputConfigurations.ForEach(delegate(Origin source) |
| while (enumerator.MoveNext()) |
| { |
| { |
. | this.TInput.Execute(source); |
| File file = enumerator.Current; |
| while (this.TInput.Running) |
| bool flag3 = string.IsNullOrEmpty(file.LawsuitNumber); |
| |
| if (flag3) |
| { |
| { |
. | System.Threading.Thread.Sleep(2000); |
| filesIntegration.Add(file); |
| } |
| } |
. | }); |
| else |
| List<ZionRobot.Models.Items.File> filesExtraction = this.workflow.Queues.Extraction; |
| |
| bool flag5 = filesExtraction.Count > 0; |
| |
| if (flag5) |
| |
| { |
| |
| filesExtraction.ForEach(delegate(ZionRobot.Models.Items.File file) |
| |
| { |
| { |
. | this.TExtractor.Execute(file, this.workflow.Blueprints); |
| File fi = (from f in filesIntegration |
| }); |
| where f.LawsuitNumber == file.LawsuitNumber |
| filesExtraction.Clear(); |
| select f).FirstOrDefault<File>(); |
| } |
| bool flag4 = fi != null; |
| List<ZionRobot.Models.Items.File> filesIntegration = new List<ZionRobot.Models.Items.File>(); |
| if (flag4) |
| using (List<ZionRobot.Models.Items.File>.Enumerator enumerator = this.workflow.Queues.Integration.GetEnumerator()) |
| |
| { |
| |
| while (enumerator.MoveNext()) |
| |
| { |
| |
| ZionRobot.Models.Items.File file = enumerator.Current; |
| |
| bool flag6 = string.IsNullOrEmpty(file.LawsuitNumber); |
| |
| if (flag6) |
| |
| { |
| { |
. | filesIntegration.Add(file); |
| Action<Field> <>9__5; |
| } |
| fi.METAObject.Pages.ForEach(delegate(Page page) |
| else |
| |
| { |
| |
| ZionRobot.Models.Items.File fi = (from f in filesIntegration |
| |
| where f.LawsuitNumber == file.LawsuitNumber |
| |
| select f).FirstOrDefault<ZionRobot.Models.Items.File>(); |
| |
| bool flag7 = fi != null; |
| |
| if (flag7) |
| |
| { |
| { |
. | Action<ZionVault.Binder.Output.Field> <>9__7; |
| List<Field> list = page.SearchElements.ToList<Field>(); |
| fi.METAObject.Pages.ForEach(delegate(Page page) |
| Action<Field> action; |
| |
| if ((action = <>9__5) == null) |
| { |
| { |
. | List<ZionVault.Binder.Output.Field> list = page.SearchElements.ToList<ZionVault.Binder.Output.Field>(); |
| action = (<>9__5 = delegate(Field element) |
| Action<ZionVault.Binder.Output.Field> action; |
| |
| if ((action = <>9__7) == null) |
| |
| { |
| { |
. | action = (<>9__7 = delegate(ZionVault.Binder.Output.Field element) |
| bool flag6 = element.Name == "ConteudoCompleto"; |
| |
| if (flag6) |
| { |
| { |
. | bool flag13 = element.Name == "ConteudoCompleto"; |
| element.Value = string.Format("{0}<hr>{1}", element.Value, file.PublicationContent); |
| if (flag13) |
| } |
| { |
| }); |
| element.Value = string.Format("{0}<hr>{1}", element.Value, file.PublicationContent); |
| } |
| } |
| list.ForEach(action); |
| }); |
| }); |
| } |
| fi.METAObject.Save(fi.META, false, false); |
| list.ForEach(action); |
| file.METAObject.Status = "GROUPED"; |
| }); |
| file.METAObject.Save(file.META, false, false); |
| fi.METAObject.Save(fi.META, false, false); |
| file.Status = "INTEGRATED"; |
| file.METAObject.Status = "GROUPED"; |
| |
| file.METAObject.Save(file.META, false, false); |
| |
| file.Status = "INTEGRATED"; |
| |
| } |
| |
| else |
| |
| { |
| |
| filesIntegration.Add(file); |
| |
| } |
| |
| } |
| } |
. | } |
| else |
| } |
| |
| bool flag8 = filesIntegration.Count > 0; |
| |
| if (flag8) |
| |
| { |
| |
| this.workflow.OutputConfigurations.ForEach(delegate(Origin source) |
| |
| { |
| |
| filesIntegration.ForEach(delegate(ZionRobot.Models.Items.File file) |
| |
| { |
| |
| this.TOutput.Execute(source, file); |
| |
| while (this.TOutput.Running) |
| |
| { |
| |
| System.Threading.Thread.Sleep(2000); |
| |
| } |
| |
| }); |
| |
| }); |
| |
| } |
| |
| } |
| |
| bool flag9 = this.sync == "Lawsuits"; |
| |
| if (flag9) |
| |
| { |
| |
| List<ZionRobot.Models.ZFlow.Lawsuit> lawsuitsToSync = new ZionRobot.WebService.Lawsuit().LawsuitsToSync(); |
| |
| bool flag10 = lawsuitsToSync.Count > 0; |
| |
| if (flag10) |
| |
| { |
| |
| this.workflow.SyncConfigurations.ForEach(delegate(Origin source) |
| |
| { |
| |
| int i = 1; |
| |
| lawsuitsToSync.ForEach(delegate(ZionRobot.Models.ZFlow.Lawsuit lawsuit) |
| |
| { |
| { |
. | this.TSynchronizer.Execute(source, lawsuit); |
| filesIntegration.Add(file); |
| while (this.TSynchronizer.Running) |
| } |
| { |
| } |
| System.Threading.Thread.Sleep(2000); |
| |
| } |
| |
| int i = i; |
| |
| i++; |
| |
| }); |
| |
| }); |
| |
| } |
| } |
| } |
| } |
. | bool flag11 = this.sync == "Activities"; |
| bool flag5 = filesIntegration.Count > 0; |
| if (flag11) |
| if (flag5) |
| { |
| { |
. | List<ZionRobot.Models.ZFlow.Activity> activitiesToSync = new ZionRobot.WebService.Activity().ActivityToSync(); |
| this.workflow.OutputConfigurations.ForEach(delegate(Origin source) |
| bool flag12 = activitiesToSync.Count > 0; |
| |
| if (flag12) |
| |
| { |
| { |
. | this.workflow.SyncConfigurations.ForEach(delegate(Origin source) |
| filesIntegration.ForEach(delegate(File file) |
| { |
| { |
. | activitiesToSync.ForEach(delegate(ZionRobot.Models.ZFlow.Activity activity) |
| this.TOutput.Execute(source, file); |
| { |
| while (this.TOutput.Running) |
| }); |
| |
| this.TSynchronizer.Execute(source, activitiesToSync[0]); |
| |
| while (this.TSynchronizer.Running) |
| |
| { |
| { |
| System.Threading.Thread.Sleep(2000); |
| System.Threading.Thread.Sleep(2000); |
| } |
| } |
| }); |
| }); |
. | } |
| }); |
| } |
| } |
| } |
| } |
| } |
| } |
| |
| |
| // Token: 0x060000B6 RID: 182 RVA: 0x0000670C File Offset: 0x0000490C |
| // Token: 0x0600007F RID: 127 RVA: 0x00005588 File Offset: 0x00003788 |
| private bool tasksIsAlive() |
| private bool tasksIsAlive() |
| { |
| { |
| return this.TInput.Running || this.TExtractor.Running || this.TOutput.Running || this.TSynchronizer.Running; |
| return this.TInput.Running || this.TExtractor.Running || this.TOutput.Running || this.TSynchronizer.Running; |
| } |
| } |
| |
| |
| // Token: 0x04000040 RID: 64 |
| // Token: 0x04000028 RID: 40 |
| private Workflow workflow; |
| private Workflow workflow; |
| |
| |
| // Token: 0x04000041 RID: 65 |
| // Token: 0x04000029 RID: 41 |
| private Input TInput; |
| private Input TInput; |
| |
| |
| // Token: 0x04000042 RID: 66 |
| // Token: 0x0400002A RID: 42 |
| private Extractor TExtractor; |
| private Extractor TExtractor; |
| |
| |
| // Token: 0x04000043 RID: 67 |
| // Token: 0x0400002B RID: 43 |
| private Output TOutput; |
| private Output TOutput; |
| |
| |
| // Token: 0x04000044 RID: 68 |
| // Token: 0x0400002C RID: 44 |
| private Synchronizer TSynchronizer; |
| private Synchronizer TSynchronizer; |
. | |
| |
| // Token: 0x04000045 RID: 69 |
| |
| private string sync = "Lawsuits"; |
| |
| } |
| } |
| } |
| } |
| |
| |