public void PrepareForWriting_CreatesDirectory()
    {
        var downloadDirectory = new DownloadDirectory(_dirPath);

        downloadDirectory.PrepareForWriting();

        Assert.IsTrue(Directory.Exists(_dirPath));
    }
    public void GetContentPackagePath_And_GetDiffPackagePath_ForSameVersion_ReturnsUniquePaths()
    {
        var downloadDirectory = new DownloadDirectory(_dirPath);

        string path1 = downloadDirectory.GetContentPackagePath(1);
        string path2 = downloadDirectory.GetDiffPackagePath(1);

        Assert.AreNotEqual(path1, path2);
    }
    public void GetDiffPackagePath_ForDifferentVersions_ReturnsUniquePaths()
    {
        var downloadDirectory = new DownloadDirectory(_dirPath);

        string path1 = downloadDirectory.GetDiffPackagePath(1);
        string path2 = downloadDirectory.GetDiffPackagePath(2);

        Assert.AreNotEqual(path1, path2);
    }
    public void Clear()
    {
        var downloadDirectory = new DownloadDirectory(_dirPath);

        downloadDirectory.PrepareForWriting();

        string filePath = downloadDirectory.GetContentPackagePath(1);

        File.WriteAllText(filePath, "a");

        downloadDirectory.Clear();

        Assert.IsFalse(File.Exists(filePath));
    }
Exemple #5
0
        public void Download(IGameFileDataSourceAdapter adapter, IGameFileDownloadable dlItem)
        {
            if (dlItem != null && !IsDownloading(dlItem))
            {
                try
                {
                    m_currentDownloads.Add(dlItem);
                    dlItem.DownloadProgressChanged += dlItem_DownloadProgressChanged;
                    dlItem.DownloadCompleted       += dlItem_DownloadCompleted;

                    if (DownloadView != null)
                    {
                        DownloadView.AddDownload(dlItem, dlItem.FileName);
                    }

                    dlItem.Download(adapter, Path.Combine(DownloadDirectory.GetFullPath(), dlItem.FileName));
                }
                catch
                {
                    //failed, nothing to do
                }
            }
        }