ok this is my main. What do I have wrong with it?
class Program
{
static string[] categories = { "emulation" , "audio" ,
"console" , "anime" , "xxx" , "tv" , "pictures" , "video" };
static void Main(string[] args)
{
string proc = Process.GetCurrentProcess().ProcessName;
// get the list of all processes by that name
Process[] processes = Process.GetProcessesByName(proc);
// if there is more than one process...
if (processes.Length > 1)
{
//MessageBox.Show("Application is already running");
return;
}
else
{
for (int x = 0; x < categories.Length; x++)
{
MasterList master = new MasterList();
Groups groups = new Groups(categories[x]);
WorkerClass WC1 = new WorkerClass(master, groups);
WorkerClass WC2 = new WorkerClass(master, groups);
WorkerClass WC3 = new WorkerClass(master, groups);
WorkerClass WC4 = new WorkerClass(master, groups);
Thread Worker1 = new Thread(new
ThreadStart(WC1.Start));
Thread Worker2 = new Thread(new
ThreadStart(WC2.Start));
Thread Worker3 = new Thread(new
ThreadStart(WC3.Start));
Thread Worker4 = new Thread(new
ThreadStart(WC4.Start));
Worker1.Name = "Worker1";
Worker2.Name = "Worker2";
Worker3.Name = "Worker3";
Worker4.Name = "Worker4";
Worker1.Start();
Worker2.Start();
Worker3.Start();
Worker4.Start();
Worker4.Join();
Worker3.Join();
Worker2.Join();
Worker1.Join();
Console.WriteLine(master.size());
master.SetEnumerator();
Updater U1 = new Updater(master, categories[x]);
Updater U2 = new Updater(master, categories[x]);
Updater U3 = new Updater(master, categories[x]);
Thread Updater1 = new Thread(new
ThreadStart(U1.insert));
Thread Updater2 = new Thread(new
ThreadStart(U2.insert));
Thread Updater3 = new Thread(new
ThreadStart(U3.insert));
Updater1.Start();
Updater2.Start();
Updater3.Start();
Updater1.Join();
Updater2.Join();
Updater3.Join();
}
}
}
}