Exemplo n.º 1
0
        protected override void OnProcess(object sender, EventArgs e)
        {
            foreach (FileDeletion file in FileDeletionCollection.Items)
            {
                if (TextParser.Parse(file.Enabled, DrivingData, SharedData, ModuleCommands).ToLower() == bool.TrueString.ToLower())
                {
                    if (TextParser.IsTableCommand(file.FileName, SharedData))
                    {
                        foreach (DataRow row in TextParser.GetCommandTable(file.FileName, SharedData).Select(TextParser.Parse(file.Filter, DrivingData, SharedData, ModuleCommands)))
                        {
                            DrivingData = row;
                            DeleteFile(file.FileName, file.Directory);

                            DrivingData = null;
                        }
                    }
                    else
                    {
                        DeleteFile(file.FileName, file.Directory, file.Filter);
                    }
                }
                else
                {
                    Logger.WriteLine("LanCleaner.Process", "", System.Diagnostics.TraceEventType.Information, 2, 0, SharedData.LogCategory);
                    Logger.WriteLine("LanCleaner.Process", "   SOURCE DIRECTORY: " + file.FileName, System.Diagnostics.TraceEventType.Information, 2, 0, SharedData.LogCategory);
                    Logger.WriteLine("LanCleaner.Process", "            ENABLED: " + TextParser.Parse(file.Enabled, DrivingData, SharedData, ModuleCommands), System.Diagnostics.TraceEventType.Information, 2, 0, SharedData.LogCategory);
                }
            }

            // Update the modules output table to contain all files deleted by this module.
            foreach (DataRow deleted_file in DeletedFilesTable.Rows)
            {
                GlobalOutputTable.Rows.Add(deleted_file.ItemArray);
                GlobalOutputTable.AcceptChanges();
            }
        }