This commit is contained in:
stam 2021-01-13 15:52:47 +03:00
parent 2a98e13a26
commit f333eb5e4c
2 changed files with 33 additions and 4 deletions

View File

@ -4,6 +4,25 @@
<OutputType>Exe</OutputType>
<TargetFramework>net5.0</TargetFramework>
<ApplicationIcon>favicon.ico</ApplicationIcon>
<PackageId>Atlassian Downloader</PackageId>
<Authors>Atlassian Downloader</Authors>
<Description>Atlassian Downloader by EpicMorg, code by kasthack</Description>
<PackageProjectUrl>https://github.com/EpicMorg/atlassian-downloader</PackageProjectUrl>
<PackageIcon>favicon.png</PackageIcon>
<FileVersion>1.0.0.2</FileVersion>
<RepositoryType>git</RepositoryType>
<RepositoryUrl>https://github.com/EpicMorg/atlassian-downloader</RepositoryUrl>
<PackageTags>atlassian, donwloader, epicmorg</PackageTags>
<AssemblyVersion>1.0.0.2</AssemblyVersion>
<Version>1.0.0.2</Version>
<Copyright>EpicMorg 20201</Copyright>
</PropertyGroup>
<ItemGroup>
<None Include="favicon.png">
<Pack>True</Pack>
<PackagePath></PackagePath>
</None>
</ItemGroup>
</Project>

View File

@ -1,9 +1,14 @@
using System;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Net.Http;
using System.Text.Json;
var appTitle = System.Reflection.Assembly.GetExecutingAssembly().GetName().Name;
var appVersion = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version;
var appStartupDate = DateTime.Now;
var outputDir = "output";
var feedUrls =
new[] {
@ -29,7 +34,8 @@ var feedUrls =
"https://my.atlassian.com/download/feeds/current/stash.json"
};
Console.Title = $"{appTitle} {appVersion}";
Console.WriteLine($"Download started at {appStartupDate}.");
var client = new HttpClient();
foreach (var feedUrl in feedUrls)
@ -64,18 +70,22 @@ foreach (var feedUrl in feedUrls)
using var outputStream = File.OpenWrite(outputFile);
using var request = await client.GetStreamAsync(file.ZipUrl).ConfigureAwait(false);
await request.CopyToAsync(outputStream).ConfigureAwait(false);
Console.WriteLine($"Downloaded {outputFile}");
Console.ForegroundColor = ConsoleColor.Green;
Console.WriteLine($"File \"{file.ZipUrl}\" downloaded to \"{outputFile}\".");
Console.ResetColor();
}
else
{
Console.WriteLine($"File for {file.ZipUrl} already exists");
Console.ForegroundColor = ConsoleColor.Yellow;
Console.WriteLine($"[WARN] File \"{outputFile}\" for \"{file.ZipUrl}\" already exists. Skip.");
Console.ResetColor();
}
}
}
Console.WriteLine($"Downloaded all files from " +
$"{feedUrl}");
}
Console.WriteLine("Download complete");
Console.WriteLine("Download complete.");
public partial class ResponseArray