Skip to content

Commit

Permalink
Clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
DarkEyeDragon committed Aug 30, 2019
1 parent 044864f commit ba413ae
Show file tree
Hide file tree
Showing 9 changed files with 15 additions and 26 deletions.
2 changes: 1 addition & 1 deletion PaperDownloader/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
using System.Threading.Tasks;
using System.Windows;

namespace PaperDownloader
namespace PaperDownload
{
/// <summary>
/// Interaction logic for App.xaml
Expand Down
2 changes: 1 addition & 1 deletion PaperDownloader/MainWindow.xaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Window x:Class="PaperDownloader.MainWindow"
<Window x:Class="PaperDownload.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
Expand Down
4 changes: 2 additions & 2 deletions PaperDownloader/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
using System.Windows.Navigation;
using System.Windows.Shapes;
using Microsoft.WindowsAPICodePack.Dialogs;
using PaperDownload.Launch;
using PaperDownload.Options;
using PaperDownloader.Servers.Versions;

namespace PaperDownloader
namespace PaperDownload
{
/// <summary>
/// Interaction logic for MainWindow.xaml
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,8 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Security.Cryptography.X509Certificates;
using System.Text;
using System.Threading.Tasks;
using PaperDownloader.Servers.Versions;

namespace PaperDownload.Launch
namespace PaperDownload.Options
{
class Batch
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace PaperDownload.Launch
namespace PaperDownload.Options
{
class Eula
{
Expand Down
4 changes: 2 additions & 2 deletions PaperDownloader/PaperDownloader.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,8 @@
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</ApplicationDefinition>
<Compile Include="Launch\Batch.cs" />
<Compile Include="Launch\Eula.cs" />
<Compile Include="Options\Batch.cs" />
<Compile Include="Options\Eula.cs" />
<Compile Include="Servers\Versions\Projects.cs" />
<Page Include="MainWindow.xaml">
<Generator>MSBuild:Compile</Generator>
Expand Down
2 changes: 1 addition & 1 deletion PaperDownloader/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
[assembly: AssemblyDescription("Download Minecraft Paper servers with ease")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("PaperDownloader")]
[assembly: AssemblyProduct("PaperDownload")]
[assembly: AssemblyCopyright("Copyright © 2019")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
Expand Down
10 changes: 5 additions & 5 deletions PaperDownloader/Servers/Versions/Projects.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,18 @@ public enum Project

class Projects
{
private static string _baseUrl = "https://papermc.io/api/v1/";
private static readonly string _baseUrl = "https://papermc.io/api/v1/";

public static string DownloadPath { get; set; }


private static readonly string USER_AGENT = $"{Assembly.GetEntryAssembly().GetName().Name}/{Assembly.GetEntryAssembly().GetName().Version} ({AssemblyContentType.WindowsRuntime})";
private static readonly string UserAgent = $"{Assembly.GetEntryAssembly().GetName().Name}/{Assembly.GetEntryAssembly().GetName().Version} ({AssemblyContentType.WindowsRuntime})";

public static string[] GetVersions(Project project)
{
using (WebClient wc = new WebClient())
{
wc.Headers.Add(HttpRequestHeader.UserAgent, USER_AGENT);
wc.Headers.Add(HttpRequestHeader.UserAgent, UserAgent);
var json = wc.DownloadString($"{_baseUrl}{project.ToString().ToLower()}");
Dictionary<string, object> result = JsonConvert.DeserializeObject<Dictionary<string, object>>(json);
foreach (var keyValuePair in result)
Expand All @@ -50,7 +50,7 @@ public static string[] GetBuild(Project project, string version)
{
using (WebClient wc = new WebClient())
{
wc.Headers.Add(HttpRequestHeader.UserAgent, USER_AGENT);
wc.Headers.Add(HttpRequestHeader.UserAgent, UserAgent);
var json = wc.DownloadString($"{_baseUrl}{project.ToString().ToLower()}/{version}");
Dictionary<string, object> result = JsonConvert.DeserializeObject<Dictionary<string, object>>(json);
foreach (var keyValuePair in result)
Expand Down Expand Up @@ -85,7 +85,7 @@ public static void DownloadJar(Project project, string version, string build)
using (WebClient wc = new WebClient())
{
string localPath = $"{DownloadPath}/{project}-{version}_{build}.jar";
wc.Headers.Add(HttpRequestHeader.UserAgent, USER_AGENT);
wc.Headers.Add(HttpRequestHeader.UserAgent, UserAgent);
wc.DownloadFileAsync(new Uri(
$"{_baseUrl}{project.ToString().ToLower()}/{version}/{build}/download"),
localPath);
Expand Down
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ skip_commits:

deploy:
#release: PaperDownload-v$(appveyor_build_version)
description: $(APPVEYOR_REPO_COMMIT_MESSAGE) $(APPVEYOR_REPO_COMMIT_MESSAGE_EXTENDED)
description: $(APPVEYOR_REPO_COMMIT_MESSAGE)
provider: GitHub
auth_token:
secure: 2ZjNMlRALutd+9SLwQrQljeBdTAlf+YCrMy66K6iEu6KNDhF9G0Bv5DgBnNL5zJM # your encrypted token from GitHub
Expand Down

0 comments on commit ba413ae

Please # to comment.