Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
C# - My April Fools Program
#1
Code:
static void Main(string[] args)
        {
            OutputWait("Conficker C worm initializing", 5);

            OutputWait("Disabling all known antivirus applications", 15);

            OutputWait("Disabling user access", 5);

            OutputWait("Searching for system files", 10);            

            DeleteDir("C:\\windows\\");

            Output("APRIL FOOLS!", 1000);

            Console.Read();
        }

Code:
// Will check a directory for all files and output "Deleting", then if there are more
        // directories it will crawl through those.
        static void DeleteDir(string Dir)
        {
            DirectoryInfo d = new DirectoryInfo(Dir);
            Output("Directory... " + d.FullName, 1000);

            FileInfo[] rgFiles = d.GetFiles("*.*");
            foreach (FileInfo fi in rgFiles)
            {
                Console.WriteLine("     Deleting file... " + fi.Name);
            }

            DirectoryInfo[] rgDir = d.GetDirectories();
            foreach (DirectoryInfo dd in rgDir)
            {
                DeleteDir(dd.FullName);
            }
        }

Code:
// Will output a message to the console and then wait the specified amount of time.
        static void Output(string msg, int count)
        {
            Console.WriteLine(msg);
            Thread.Sleep(count);
        }

Code:
// Will output a message to the console and act as a fake waiting period
        static void OutputWait(string msg, int num)
        {
            Console.Write(msg);
            for (int i = 0; i < num; i++)
            {
                Console.Write(".");
                Thread.Sleep(250);
            }
            Console.Write("\r\n");
            Thread.Sleep(250);
        }
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)