Пример #1
0
        /// <summary>
        /// 检查题目数据文件是否正确
        /// </summary>
        /// <param name="stream">题目数据文件流</param>
        /// <returns>题目数据文件是否正确</returns>
        public static Boolean CheckProblemDataFile(Stream stream)
        {
            try
            {
                ProblemDataReader reader = new ProblemDataReader(stream);

                if (String.Equals(reader.LastModified, ProblemData.NO_PROBLEM_DATA_VERSION))
                {
                    return(false);
                }

                return(true);
            }
            catch
            {
                return(false);
            }
        }
Пример #2
0
        /// <summary>
        /// 检查题目数据文件是否正确
        /// </summary>
        /// <param name="stream">题目数据文件流</param>
        /// <returns>题目数据文件是否正确</returns>
        public static Boolean CheckProblemDataFile(Stream stream)
        {
            try
            {
                ProblemDataReader reader = new ProblemDataReader(stream);

                if (String.Equals(reader.LastModified, ProblemData.NO_PROBLEM_DATA_VERSION))
                {
                    return false;
                }

                return true;
            }
            catch
            {
                return false;
            }
        }
Пример #3
0
        /// <summary>
        /// 获取题目数据最后更新日期
        /// </summary>
        /// <param name="pid">题目ID</param>
        /// <returns>最后更新日期</returns>
        public static String GetProblemDataVersion(Int32 pid)
        {
            String version = ProblemDataCache.GetProblemDataVersionCache(pid);

            if (String.IsNullOrEmpty(version))
            {
                String filePath = GetProblemDataRealPath(pid);

                if (!String.IsNullOrEmpty(filePath))
                {
                    try
                    {
                        ProblemDataReader reader = new ProblemDataReader(filePath);
                        version = reader.LastModified;
                    }
                    catch { }
                }
            }

            return version;
        }