예제 #1
0
        public static FIleFather GetFile(String FileName, String fullpath)
        {
            FIleFather ff        = null;
            String     exetesion = Path.GetExtension(FileName);

            switch (exetesion)
            {
            case ".txt": ff = new TxtFile(fullpath); break;

            case ".jpg": ff = new JpgFile(fullpath); break;

            case ".exe": ff = new ExeFile(fullpath); break;
            }
            return(ff);
        }
예제 #2
0
 static void Main(string[] args)
 {
     while (true)
     {
         try
         {
             Console.WriteLine("请输入你要到的文件路径");
             String paht = Console.ReadLine();         //D:\
             Console.WriteLine("请输入你要打开的文件夹");
             String     fileName = Console.ReadLine(); //1.txt
             FIleFather ff       = GetFile(fileName, paht + fileName);
             ff.FullPath = paht + fileName;
             ff.OpenFile();
         }
         catch { }
     }
 }