using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
namespace TestTestTest
{
class Program
{
static void Main(string[] args)
{
var list = new SortedList<string, FileInfo>();
foreach (var name in Directory.GetFiles("C:\\WINDOWS"))
{
list.Add(name, new FileInfo(name));
}
Action a = () =>
{
while (true)
{
foreach (var kvp in list)
{
Console.WriteLine("Action=A:{0}", kvp.Value.Name);
}
}
};
Action b = () =>
{
while (true)
{
for (int i = 0; i < list.Count; i++)
{
Console.WriteLine("Action=B:{0}", list[list.Keys[i]].Name);
}
}
};
for (int i = 0; i < 25; i++ )
{
Task.Factory.StartNew(a);
Task.Factory.StartNew(b);
}
Thread.Sleep(600 * 1000);
}
}
}
dXNpbmcgU3lzdGVtOwp1c2luZyBTeXN0ZW0uQ29sbGVjdGlvbnM7CnVzaW5nIFN5c3RlbS5Db2xsZWN0aW9ucy5HZW5lcmljOwp1c2luZyBTeXN0ZW0uRGlhZ25vc3RpY3M7CnVzaW5nIFN5c3RlbS5JTzsKdXNpbmcgU3lzdGVtLkxpbnE7CnVzaW5nIFN5c3RlbS5UZXh0Owp1c2luZyBTeXN0ZW0uVGhyZWFkaW5nOwp1c2luZyBTeXN0ZW0uVGhyZWFkaW5nLlRhc2tzOwoKbmFtZXNwYWNlIFRlc3RUZXN0VGVzdAp7CiAgICBjbGFzcyBQcm9ncmFtCiAgICB7CiAgICAgICAgc3RhdGljIHZvaWQgTWFpbihzdHJpbmdbXSBhcmdzKQogICAgICAgIHsKICAgICAgICAgICAgdmFyIGxpc3QgPSBuZXcgU29ydGVkTGlzdDxzdHJpbmcsIEZpbGVJbmZvPigpOwogICAgICAgICAgICBmb3JlYWNoICh2YXIgbmFtZSBpbiBEaXJlY3RvcnkuR2V0RmlsZXMoIkM6XFxXSU5ET1dTIikpCiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgIGxpc3QuQWRkKG5hbWUsIG5ldyBGaWxlSW5mbyhuYW1lKSk7CiAgICAgICAgICAgIH0KCiAgICAgICAgICAgIEFjdGlvbiBhID0gKCkgPT4KICAgICAgICAgICAgewogICAgICAgICAgICAgICAgd2hpbGUgKHRydWUpCiAgICAgICAgICAgICAgICB7CiAgICAgICAgICAgICAgICAgICAgZm9yZWFjaCAodmFyIGt2cCBpbiBsaXN0KQogICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgQ29uc29sZS5Xcml0ZUxpbmUoIkFjdGlvbj1BOnswfSIsIGt2cC5WYWx1ZS5OYW1lKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH07CgogICAgICAgICAgICBBY3Rpb24gYiA9ICgpID0+CiAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgIHdoaWxlICh0cnVlKQogICAgICAgICAgICAgICAgewogICAgICAgICAgICAgICAgICAgIGZvciAoaW50IGkgPSAwOyBpIDwgbGlzdC5Db3VudDsgaSsrKQogICAgICAgICAgICAgICAgICAgIHsKICAgICAgICAgICAgICAgICAgICAgICAgQ29uc29sZS5Xcml0ZUxpbmUoIkFjdGlvbj1COnswfSIsIGxpc3RbbGlzdC5LZXlzW2ldXS5OYW1lKTsKICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH07CgogICAgICAgICAgICBmb3IgKGludCBpID0gMDsgaSA8IDI1OyBpKysgKQogICAgICAgICAgICB7CiAgICAgICAgICAgICAgICBUYXNrLkZhY3RvcnkuU3RhcnROZXcoYSk7CiAgICAgICAgICAgICAgICBUYXNrLkZhY3RvcnkuU3RhcnROZXcoYik7CiAgICAgICAgICAgIH0KICAgICAgICAgICAgVGhyZWFkLlNsZWVwKDYwMCAqIDEwMDApOwogICAgICAgIH0KICAgIH0KfQo=