public static bool CrossCompileAOTDirectoryParallel(string crossCompilerPath, BuildTarget buildTarget, CrossCompileOptions crossCompileOptions, string sourceAssembliesFolder, string targetCrossCompiledASMFolder, string additionalOptions)
 {
   sourceAssembliesFolder = Path.Combine(Directory.GetCurrentDirectory(), sourceAssembliesFolder);
   targetCrossCompiledASMFolder = Path.Combine(Directory.GetCurrentDirectory(), targetCrossCompiledASMFolder);
   int workerThreads = 1;
   int completionPortThreads = 1;
   ThreadPool.GetMaxThreads(out workerThreads, out completionPortThreads);
   List<MonoCrossCompile.JobCompileAOT> jobCompileAotList = new List<MonoCrossCompile.JobCompileAOT>();
   List<ManualResetEvent> events = new List<ManualResetEvent>();
   bool flag = true;
   List<string> stringList = new List<string>(((IEnumerable<string>) Directory.GetFiles(sourceAssembliesFolder)).Where<string>((Func<string, bool>) (path => Path.GetExtension(path) == ".dll")));
   int count = stringList.Count;
   int filesFinished = 0;
   MonoCrossCompile.DisplayAOTProgressBar(count, filesFinished);
   long timeout = (long) Math.Min(1800000, (count + 3) * 1000 * 30);
   using (List<string>.Enumerator enumerator = stringList.GetEnumerator())
   {
     while (enumerator.MoveNext())
     {
       string fileName = Path.GetFileName(enumerator.Current);
       string output = Path.Combine(targetCrossCompiledASMFolder, fileName + ".s");
       MonoCrossCompile.JobCompileAOT jobCompileAot = new MonoCrossCompile.JobCompileAOT(buildTarget, crossCompilerPath, sourceAssembliesFolder, crossCompileOptions, fileName, output, additionalOptions);
       jobCompileAotList.Add(jobCompileAot);
       events.Add(jobCompileAot.m_doneEvent);
       ThreadPool.QueueUserWorkItem(new WaitCallback(jobCompileAot.ThreadPoolCallback));
       if (events.Count >= Environment.ProcessorCount)
       {
         flag = MonoCrossCompile.WaitForBuildOfFile(events, ref timeout);
         MonoCrossCompile.DisplayAOTProgressBar(count, filesFinished);
         ++filesFinished;
         if (!flag)
           break;
       }
     }
   }
   while (events.Count > 0)
   {
     flag = MonoCrossCompile.WaitForBuildOfFile(events, ref timeout);
     MonoCrossCompile.DisplayAOTProgressBar(count, filesFinished);
     ++filesFinished;
     if (!flag)
       break;
   }
   using (List<MonoCrossCompile.JobCompileAOT>.Enumerator enumerator = jobCompileAotList.GetEnumerator())
   {
     while (enumerator.MoveNext())
     {
       MonoCrossCompile.JobCompileAOT current = enumerator.Current;
       if (current.m_Exception != null)
       {
         UnityEngine.Debug.LogErrorFormat("Cross compilation job {0} failed.\n{1}", new object[2]
         {
           (object) current.m_input,
           (object) current.m_Exception
         });
         flag = false;
       }
     }
   }
   return flag;
 }
		public static bool CrossCompileAOTDirectoryParallel(string crossCompilerPath, BuildTarget buildTarget, CrossCompileOptions crossCompileOptions, string sourceAssembliesFolder, string targetCrossCompiledASMFolder, string additionalOptions)
		{
			sourceAssembliesFolder = Path.Combine(Directory.GetCurrentDirectory(), sourceAssembliesFolder);
			targetCrossCompiledASMFolder = Path.Combine(Directory.GetCurrentDirectory(), targetCrossCompiledASMFolder);
			int num = 1;
			int num2 = 1;
			ThreadPool.GetMaxThreads(out num, out num2);
			List<MonoCrossCompile.JobCompileAOT> list = new List<MonoCrossCompile.JobCompileAOT>();
			List<ManualResetEvent> list2 = new List<ManualResetEvent>();
			bool flag = true;
			List<string> list3 = new List<string>(
				from path in Directory.GetFiles(sourceAssembliesFolder)
				where Path.GetExtension(path) == ".dll"
				select path);
			int count = list3.Count;
			int num3 = 0;
			MonoCrossCompile.DisplayAOTProgressBar(count, num3);
			long num4 = (long)Math.Min(1800000, (count + 3) * 1000 * 30);
			foreach (string current in list3)
			{
				string fileName = Path.GetFileName(current);
				string output = Path.Combine(targetCrossCompiledASMFolder, fileName + ".s");
				MonoCrossCompile.JobCompileAOT jobCompileAOT = new MonoCrossCompile.JobCompileAOT(buildTarget, crossCompilerPath, sourceAssembliesFolder, crossCompileOptions, fileName, output, additionalOptions);
				list.Add(jobCompileAOT);
				list2.Add(jobCompileAOT.m_doneEvent);
				ThreadPool.QueueUserWorkItem(new WaitCallback(jobCompileAOT.ThreadPoolCallback));
				if (list2.Count >= Environment.ProcessorCount)
				{
					flag = MonoCrossCompile.WaitForBuildOfFile(list2, ref num4);
					MonoCrossCompile.DisplayAOTProgressBar(count, num3);
					num3++;
					if (!flag)
					{
						break;
					}
				}
			}
			while (list2.Count > 0)
			{
				flag = MonoCrossCompile.WaitForBuildOfFile(list2, ref num4);
				MonoCrossCompile.DisplayAOTProgressBar(count, num3);
				num3++;
				if (!flag)
				{
					break;
				}
			}
			foreach (MonoCrossCompile.JobCompileAOT current2 in list)
			{
				if (current2.m_Exception != null)
				{
					UnityEngine.Debug.LogErrorFormat("Cross compilation job {0} failed.\n{1}", new object[]
					{
						current2.m_input,
						current2.m_Exception
					});
					flag = false;
				}
			}
			return flag;
		}