示例#1
0
        static void Main(string[] args)
        {
            System.Console.WriteLine("請輸入要去的硬碟");
            string path = Console.ReadLine();

            System.Console.WriteLine("請輸入要開啟的文件名稱");
            string filename = Console.ReadLine();

            FileFather ff = GetFileName(filename, path + filename);

            ff.Openfile();
        }
示例#2
0
        public static FileFather GetFileName(string filename, string fullPath)
        {
            string     extention = Path.GetExtension(filename);
            FileFather ff        = null;

            switch (extention)
            {
            case ".txt":
                ff = new TxtPath(fullPath);
                break;

            case ".jpg":
                ff = new JpgPath(fullPath);
                break;
            }
            return(ff);
        }