private static void AddFiles(IEnumerable<string> source, List<string> target, MainForm frm)
 {
     foreach (string filename in source) {
         FileAttributes attr = File.GetAttributes(filename);
         if ((attr & FileAttributes.Directory) == FileAttributes.Directory) {
             string[] files2 = Directory.GetFiles(filename);
             AddFiles(files2, target, frm);
         } else {
             string extension = Path.GetExtension(filename);
             extension = extension != null && extension.StartsWith(".") ? extension.Substring(1) : extension;
             if (frm._engine.InputFormats.Contains(extension)) {
                 target.Add(filename);
             }
         }
     }
 }
            public bool Handle(IDataObject data, MainForm frm)
            {
                object obj = data.GetData(Format);
                string[] files = obj as string[];

                bool handled;
                if (files != null) {
                    List<string> target = new List<string>();
                    AddFiles(files, target, frm);
                    frm.AddFiles(target);
                    handled = true;
                } else {
                    handled = false;
                }

                return handled;
            }