예제 #1
0
    /// <summary>
    /// 检查文件数量和记录的版本号
    /// </summary>
    /// <returns></returns>
    private List <IDownloadItem> CheckHotfixFile()
    {
        View.SetText(I18NManager.Get("Update_CheckFile"));

        int           loadedFileCount = 0;
        DirectoryInfo directoryInfo   = new DirectoryInfo(AssetLoader.ExternalHotfixPath);

        DirectoryInfo[] dirs = directoryInfo.GetDirectories();
        foreach (var dir in dirs)
        {
            loadedFileCount += dir.GetFiles("*", SearchOption.AllDirectories).Length;
        }

        indexFile = GetIndexFile();

        if (loadedFileCount >= indexFile.FileItems.Count && FileUtil.ReadFileText(FileChecker.HotfixRecordPath) ==
            _hotVersionPb.Version + "_" + _hotVersionPb.HotVersion)
        {
            //检查文件数量 核对记录文件的版本号
            return(null);
        }

        View.SetText("");
        FileChecker checker = new FileChecker();

        return(checker.GetReloadHotfixFiles(indexFile));
    }