コード例 #1
0
    public static void Demo(string path)
    {
        Console.WriteLine("\n--------------- Chapter 1.6 PrintAll ---------------");

        PrintAll pa = new PrintAll();

        pa.Dir_Walk(path);
        Console.WriteLine();
    }
コード例 #2
0
ファイル: Program.cs プロジェクト: ezocher/HigherOrderCsharp
    static void Main(string[] args)
    {
        string[] pathList =
        {
            @"c:\nosuchfileexists",
            @"C:\Temp\test.txt",
            Environment.GetFolderPath(Environment.SpecialFolder.CommonMusic),
            Environment.GetFolderPath(Environment.SpecialFolder.Desktop),
            Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments)
        };

        TotalSize.Demo(pathList);   // This demo runs multiple paths since it doesn't do much for each one

        /*
         * The Demo()s below all take one path - some of them are long running or produce a lot of output depending on your numbers of files
         *
         */

        string path = Environment.GetFolderPath(Environment.SpecialFolder.CommonDocuments);

        // Other directories you might want to try
        //      Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
        //      Environment.GetFolderPath(Environment.SpecialFolder.CommonMusic);
        //      Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
        //      Environment.GetFolderPath(Environment.SpecialFolder.UserProfile);
        //      @"C:\Users\"

        PrintAll.Demo(path);
        PrintWithSizes.Demo(path);
        PrintDangles.Demo(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile)); // UserProfile is a likely place to have many dangling links/shortcuts and will probably take a long time to run
        PrintSubdirSize.Demo(path);
        Sizehash.Demo(path);                                                                 // Set a breakpoint inside of Sizehash.Demo() and use the debugger if you want to explore the tree of Lists/Dictionaries that this creates
        ListOfAllPlainFiles.Demo(path);

        // A new sample that wasn't in the book that I just wanted to try
        string[] photosFileExtensions =
        {
            ".jpg",  ".jpeg", ".jpe", ".jif", ".jfif", ".jfi", // JPEG
            ".jp2",  ".j2k",  ".jpf", ".jpx", ".jpm",  ".mj2", // JPEG 2000
            ".jxr",  ".hdp",  ".wdp",                          // JPEG XR aka HD Photo
            ".heif", ".heic",                                  // HEIF

            // Raw image formats extensions from https://en.wikipedia.org/wiki/Raw_image_format
            ".3fr",  ".ari",  ".arw", ".bay", ".crw",  ".cr2", ".cr3", ".cap", ".data", ".dcs", ".dcr", ".dng", ".drf", ".eip", ".erf", ".fff", ".gpr", ".iiq", ".k25",
            ".kdc",  ".mdc",  ".mef", ".mos", ".mrw",  ".nef", ".nrw", ".obm", ".orf",  ".pef", ".ptx", ".pxn", ".r3d", ".raf", ".raw", ".rwl", ".rw2", ".rwz", ".sr2",
            ".srf",  ".srw",  ".tif", ".x3f"
        };

        PrintFilesFilteredByExtension.Demo(Environment.GetFolderPath(Environment.SpecialFolder.MyPictures), photosFileExtensions);

        Console.WriteLine("Press any key to exit");
        Console.ReadKey(true);
    }
コード例 #3
0
ファイル: MainApp.cs プロジェクト: stauroskou/OOP-E-Hospital
        public MainApp()
        {
            Console.WriteLine("1.  List of Doctors");
            Console.WriteLine("2.  List of Adresses");
            Console.WriteLine("3.  List of Patients");
            Console.WriteLine("4.  List of Rooms");
            Console.WriteLine("5.  List of Diseases");
            Console.WriteLine("6.  Patients per room");
            Console.WriteLine("7.  Petients per Doctor");
            Console.WriteLine("8.  Petients per disease");
            Console.WriteLine("9.  Petients per address");
            Console.WriteLine("10. Doctors per address");
            Console.WriteLine("11. Addreses per patients");
            Console.ForegroundColor = ConsoleColor.Red;
            Console.WriteLine("\nWow you can actually search! just type 'Search'");
            Console.ForegroundColor = ConsoleColor.White;
            Console.WriteLine();
            Console.Write("Select from above: ");
            string c = Console.ReadLine();

            if (c.ToUpper() == "SEARCH")
            {
                c = c.ToUpper();
            }
            if (c.ToUpper() == "CREDITS")
            {
                c = c.ToUpper();
            }
            switch (c)
            {
            case "1":
                Console.Clear();
                PrintAll.PrintAllDocs();
                Back();
                break;

            case "2":
                Console.Clear();
                PrintAll.PrintAllAddresses();
                Back();
                break;

            case "3":
                Console.Clear();
                PrintAll.PrintAllPatients();
                Back();
                break;

            case "4":
                Console.Clear();
                PrintAll.PrintAllRooms();
                Back();
                break;

            case "5":
                Console.Clear();
                PrintAll.PrintAllDiseases();
                Back();
                break;

            case "6":
                Console.Clear();
                PrintsPer.PatientsPerRoom();
                Back();
                break;

            case "7":
                Console.Clear();
                PrintsPer.PatientsPerDoctor();
                Back();
                break;

            case "8":
                Console.Clear();
                PrintsPer.PatientsPerDisease();
                Back();
                break;

            case "9":
                Console.Clear();
                PrintsPer.PatientsPerAdress();
                Back();
                break;

            case "10":
                Console.Clear();
                PrintsPer.DoctorsPerAdress();
                Back();
                break;

            case "11":
                Console.Clear();
                PrintsPer.AllAddressesPerPatients();
                Back();
                break;

            case "SEARCH":
                Console.Clear();
                new search();
                break;

            case "CREDITS":
                Console.Clear();
                new credits("STAUROS KOUTSOUKOS");
                break;

            default:
                Console.Clear();
                new MainApp();
                break;
            }
        }