예제 #1
0
    private void StartDownLoad(GameResFileInfo resInfo)
    {
        if (IsLoading)
        {
            return;
        }
        IsLoading   = true;
        IsDone      = false;
        Progress    = 0;
        gameResInfo = resInfo;

        string localfolderPath = URLFactory.GetLocalGameResSaveFolder(resInfo.gameName);
        string tagfolderPath   = URLFactory.GetLocalGameTagFolder(resInfo.gameName);

        if (!Directory.Exists(localfolderPath))
        {
            Directory.CreateDirectory(localfolderPath);
        }
        if (!Directory.Exists(tagfolderPath))
        {
            Directory.CreateDirectory(tagfolderPath);
        }

        TotalBytesKB = 0;
        foreach (DownLoadFileInfo info in resInfo.infoList)
        {
            if (DownLoadManager.CheckOnceFileInfo(info) != GameVersionState.NewestVersion)
            {
                DownLoadThread downLoadThread = new DownLoadThread();
                downLoadThreadList.Add(downLoadThread);
                downLoadThread.StartDownLoad(info);
                TotalBytesKB += info.size;
            }
        }
    }
예제 #2
0
    private void UnZipFile()
    {
        string fileName = CurDownLoadFileInfo.fileName;

        if (fileName.EndsWith(".zip"))
        {
            string fullPath             = URLFactory.GetLocalGameResSavePath(CurDownLoadFileInfo);
            string unZipToDirectoryPath = URLFactory.GetLocalGameResSaveFolder(CurDownLoadFileInfo.GameName);
            if (!Directory.Exists(unZipToDirectoryPath))
            {
                Directory.CreateDirectory(unZipToDirectoryPath);
            }
            UtilsZipHelper.UnZipFile(fullPath, unZipToDirectoryPath);
            File.Delete(fullPath);
        }
    }