コード例 #1
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);
        }
    }
コード例 #2
0
    public void StartDownLoad(DownLoadFileInfo info)
    {
        if (IsDownLoading)
        {
            return;
        }
        Init();
        CurDownLoadFileInfo = info;
        Progress            = 0;
        IsDone        = false;
        IsDownLoading = true;
        string serverGameResPath = URLFactory.GetServerGameResPath(info);
        string localSavePath     = URLFactory.GetLocalGameResSavePath(info);

        if (File.Exists(localSavePath))
        {
            File.Delete(localSavePath);
        }
        _myWebClient.DownloadFileAsync(new Uri(serverGameResPath), localSavePath);
    }