using System;
using System.Collections.Generic;
using System.Windows.Controls;
using ZionFoundation.Threading;
using ZionRobot.Models.Items;
using ZionRobot.Models.Process;

namespace ZionRobot.Tasks
{
	// Token: 0x02000019 RID: 25
	internal class Queue : Thread
	{
		// Token: 0x06000088 RID: 136 RVA: 0x00005794 File Offset: 0x00003994
		public Queue(Workflow roadmap)
		{
			this.roadmap = roadmap;
			base.Initilize(true);
		}

		// Token: 0x06000089 RID: 137 RVA: 0x000057AD File Offset: 0x000039AD
		public override void Execute()
		{
			base.Execute();
			this.LookInsideFolders(this.roadmap.Folders);
		}

		// Token: 0x0600008A RID: 138 RVA: 0x000057C9 File Offset: 0x000039C9
		private void LookInsideFolders(List<Folder> folders)
		{
			folders.ForEach(delegate(Folder folder)
			{
				this.LookInsideFolders(folder.Folders);
				this.ManageQueues(folder.Files);
			});
		}

		// Token: 0x0600008B RID: 139 RVA: 0x000057DF File Offset: 0x000039DF
		private void ManageQueues(List<File> files)
		{
			if (files != null)
			{
				files.ForEach(delegate(File file)
				{
					bool flag = !this.roadmap.Queues.Files.Contains(file);
					if (flag)
					{
						this.roadmap.Queues.Files.Add(file);
					}
				});
			}
		}

		// Token: 0x04000031 RID: 49
		private Workflow roadmap;

		// Token: 0x04000032 RID: 50
		public Control control;
	}
}
