Ejemplo n.º 1
0
        private static object RunFindAndReturnExitCode(FindOptions opts)
        {
            try
            {
                Console.WriteLine("FindDirectories(" + opts.Directory + ", " + opts.Mask + ", " + opts.IP + ")");

                IEnumerable <SimpleFileInfo> dirs = USBLAN.FindDirectories(opts.Directory, opts.Mask, opts.IP);
                foreach (SimpleFileInfo d in dirs)
                {
                    Console.WriteLine("d " + d.Name);
                }

                Console.WriteLine("FindFiles(" + opts.Directory + ", " + opts.Mask + ", " + opts.IP + ")");

                IEnumerable <SimpleFileInfo> files = USBLAN.FindFiles(opts.Directory, opts.Mask, opts.IP);
                foreach (SimpleFileInfo f in files)
                {
                    Console.WriteLine("f " + f.Name);
                }
            }
            catch (Exception e)
            {
                PrintException(e);
                return(1);
            }

            Console.WriteLine("find complete.");
            return(0);
        }
Ejemplo n.º 2
0
        private static void TestFindFiles()
        {
            IEnumerable <SimpleFileInfo> files = USBLAN.FindFiles("/Windows/", "DeviceImage.pn*");

            if (files != null)
            {
                int count = 0;
                Console.WriteLine("Files: ");
                foreach (var file in files)
                {
                    Console.WriteLine(++count + ") " + file.Name + " : " + file.Length);
                    Console.WriteLine("\t" + file.FullName + " : " + file.Extension);
                }
            }
            else
            {
                Console.WriteLine("returned null");
            }
        }