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: 0x02000022 RID: 34
	internal class Queue : Thread
	{
		// Token: 0x060000C1 RID: 193 RVA: 0x000069BC File Offset: 0x00004BBC
		public Queue(Workflow roadmap)
		{
			this.roadmap = roadmap;
			base.Initilize(true);
		}

		// Token: 0x060000C2 RID: 194 RVA: 0x000069D5 File Offset: 0x00004BD5
		public override void Execute()
		{
			base.Execute();
			this.LookInsideFolders(this.roadmap.Folders);
		}

		// Token: 0x060000C3 RID: 195 RVA: 0x000069F1 File Offset: 0x00004BF1
		private void LookInsideFolders(List<Folder> folders)
		{
			folders.ForEach(delegate(Folder folder)
			{
				this.LookInsideFolders(folder.Folders);
				this.ManageQueues(folder.Files);
			});
		}

		// Token: 0x060000C4 RID: 196 RVA: 0x00006A07 File Offset: 0x00004C07
		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: 0x0400004A RID: 74
		private Workflow roadmap;

		// Token: 0x0400004B RID: 75
		public Control control;
	}
}
