Esempio n. 1
0
        static BaseFile GetFile(string filePath, string fileName)
        {
            BaseFile bf           = null;
            string   strExtension = Path.GetExtension(fileName);//3.txt

            switch (strExtension)
            {
            case ".txt":
                bf = new TxtFile(filePath, fileName);
                break;

            case ".avi":
                bf = new AviFile(filePath, fileName);
                break;

            case ".mp4":
                bf = new MP4File(filePath, fileName);
                break;

            case ".png":
                bf = new PngFile(filePath, fileName);
                break;
            }
            return(bf);
        }
Esempio n. 2
0
        static BaseFile OpenFile(string filePath, string fileName)
        {
            BaseFile bf        = null;
            string   extension = Path.GetExtension(fileName);

            switch (extension)
            {
            case ".txt":
                bf = new TxtFile(filePath, fileName);
                break;

            case ".mp4":
                bf = new Mp4File(filePath, fileName);
                break;

            case ".avi":
                bf = new AviFile(filePath, fileName);
                break;
            }
            return(bf);
        }