コード例 #1
0
        public void GetIntakeTimetable()
        {
            string folderCombine       = Path.Combine(GlobalData.FileLocationBase, GlobalData.FolderName);
            string fileCombine         = Path.Combine(folderCombine, Path.GetFileName(GlobalData.FileName));
            string folderExportCombine = Path.Combine(folderCombine, GlobalData.ExtractFolderName);
            string xmlfileCombine      = Path.Combine(folderExportCombine, GlobalData.XmlFileName);
            string cacheCombine        = Path.Combine(folderCombine, GlobalData.CacheFileName);

            //Before Download, create the directory first, if not exist
            //If Exist just leave it alone
            Directory.CreateDirectory(Path.Combine(folderCombine));

            //Delete everything on that folder
            ClearFolder(folderCombine);

            //Download the File

            DownloadData download = new DownloadData();

            download.IntakeTimeTable(GlobalData.IntakeCodeUrl, fileCombine);

            //Extract the File
            ZipFile.ExtractToDirectory(fileCombine, folderExportCombine);

            //Store Cache File
            DataParsing dataParsing = new DataParsing();

            dataParsing.SerializingCache(cacheCombine, new Cache("Cache", GlobalData.IntakeCode, GlobalData.IntakeCodeUrl));

            //Read XML File and Convert to List of TimeTable
            _intakeTimetable = new DataParsing().ParseTimeTable(new DownloadLocalData().XmlFile(xmlfileCombine));

            DataParsing.ParseTimeTableByDay(_intakeTimetable);
        }