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: 0x02000021 RID: 33
	internal class Queue : Thread
	{
		// Token: 0x060000BC RID: 188 RVA: 0x000066C4 File Offset: 0x000048C4
		public Queue(Workflow roadmap)
		{
			this.roadmap = roadmap;
			base.Initilize(true);
		}

		// Token: 0x060000BD RID: 189 RVA: 0x000066DD File Offset: 0x000048DD
		public override void Execute()
		{
			base.Execute();
			this.LookInsideFolders(this.roadmap.Folders);
		}

		// Token: 0x060000BE RID: 190 RVA: 0x000066F9 File Offset: 0x000048F9
		private void LookInsideFolders(List<Folder> folders)
		{
			folders.ForEach(delegate(Folder folder)
			{
				this.LookInsideFolders(folder.Folders);
				this.ManageQueues(folder.Files);
			});
		}

		// Token: 0x060000BF RID: 191 RVA: 0x0000670F File Offset: 0x0000490F
		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: 0x04000044 RID: 68
		private Workflow roadmap;

		// Token: 0x04000045 RID: 69
		public Control control;
	}
}
