how does this code work?
<p>i got this code from my senior student who happens to away for a while,as i understand the code implements a program to monitor and track the status of the specified startup directory and performs some activities with new files.The list of actions to be ф determined list, each element implements the interface type</p>

<pre><code>interface IFileOperation {
/ / should I handle the file
bool Accept (string fileName);
/ / handler function file
void Process (string fileName);
}
</code></pre>

<p>Implement several alternative handlers and show performance software system</p>

<p>im not good with c sharp and i want to learn how this code really works expecially the code in the <code>class FileProcByExt</code> ,  <code>class FileProcNameAfter10</code> and <code>class FileProcEnc</code>,i know what i am asking to some of you is boring but i need your help i just want to understand this code and how it works,this is the whole code below</p>

<pre><code> interface IFileOperation {
/ / should I handle the file
bool Accept (string fileName);
/ / handler function file
void Process (string fileName);
}


    class FileProcByExt : IFileOperation
    {
        string extName;
        string folderName;
        public FileProcByExt(string ext = "")
        {
            extName = ext;
            if (extName == "")
                folderName = "ALLExt";
            else
                folderName = extName.ToUpper();
        }
        public bool Accept(string fileName)
        {
            bool res = false;
            if (extName == "" ) res = true; // all 
            if (Path.GetExtension(fileName) == "." + extName) res = true; // have extension 
            return res;
        }
        public void Process(string fileName)
        {
            Directory.CreateDirectory(Path.Combine(Path.GetDirectoryName(fileName),
                                                   folderName));
            File.Move(fileName,
                      Path.Combine(Path.GetDirectoryName(fileName),
                                   folderName,
                                   Path.GetFileName(fileName)));            
        }
    }
    class FileProcNameAfter10 : IFileOperation
    {
        static int cnt;
        public bool Accept(string fileName)
        {
            return Path.GetFileNameWithoutExtension(fileName).Length &gt; 10;
        }
        public void Process(string fileName)
        {
            File.Copy(fileName,
                      Path.Combine(Path.GetDirectoryName(fileName),
                                   "longname_" + cnt + Path.GetExtension(fileName)));
            cnt++;
        }
    }
    class FileProcEnc: IFileOperation
    {
        public bool Accept(string fileName)
        {
            FileInfo fi = new FileInfo(fileName);
            return fi.Length &lt; 1024;
        }
        public void Process(string fileName)
        {
            File.Encrypt(fileName);
        }
    }

    class Program
    {
        static void Main(string[] args)
        {
            try
            {             
                string directoryPath = args[0];
                string[] filesList, filesListTmp;
                IFileOperation[] opList = { new FileProcNameAfter10(),
                                            new FileProcEnc(),
                                            new FileProcByExt("jpeg"),
                                            new FileProcByExt("jpg"),
                                            new FileProcByExt("doc"),
                                            new FileProcByExt("pdf"),
                                            new FileProcByExt("djvu")
                                            };
                if (Directory.Exists(directoryPath))
                {
                    filesList = Directory.GetFiles(directoryPath);
                    while (true)
                    {
                        Thread.Sleep(500);
                        filesListTmp = Directory.GetFiles(directoryPath);
                        foreach (var elem in Enumerable.Except&lt;string&gt;(filesListTmp, filesList))
                        {
                            Console.WriteLine(elem);
                            foreach (var op in opList)
                            {
                                if (op.Accept(elem)) op.Process(elem);
                            }    
                        }
                        filesList = filesListTmp;
                        if (Console.KeyAvailable == true &amp;&amp; Console.ReadKey(true).Key == ConsoleKey.Escape) break;
                    }
                }
                else
                {
                    Console.WriteLine("There is no such directory.");
                    Console.ReadKey();
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("Error." + ex.Message);

            }
        }
    }
</code></pre>

<p>thanks in advance</p>
