Skip to content

Commit 3572428

Browse files
authored
Merge pull request #34 from martial-god/Dev
update the -u method wording
2 parents 9378071 + bb2e471 commit 3572428

File tree

3 files changed

+11
-12
lines changed

3 files changed

+11
-12
lines changed

Benny-Scraper/Benny-Scraper.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<ImplicitUsings>enable</ImplicitUsings>
88
<Nullable>enable</Nullable>
99
<ApplicationManifest>app.manifest</ApplicationManifest>
10-
<Version>1.1.0</Version>
10+
<Version>1.1.1</Version>
1111
</PropertyGroup>
1212

1313
<ItemGroup>

Benny-Scraper/Program.cs

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using System.Diagnostics;
22
using System.IO.Compression;
33
using System.Text;
4+
using System.Xml;
45
using Autofac;
56
using Benny_Scraper.BusinessLogic;
67
using Benny_Scraper.BusinessLogic.Config;
@@ -33,7 +34,10 @@ internal class Program
3334
private static IContainer Container { get; set; }
3435
private const string AreYouSure = "Are you sure you want to {0}? (y/n)";
3536
private const int MaxTitleWidth = 50;
36-
private const string ProgramVersion = "v1.1.0";
37+
private const string ProgramVersion = "v1.1.1";
38+
private const string ReleaseUrl = "https://api.github.com/repos/martial-god/Benny-Scraper/releases/latest";
39+
private const string MainProject = "Benny-Scraper.csproj";
40+
3741
public static IConfiguration Configuration { get; set; }
3842

3943
// Added Task to Main in order to avoid "Program does not contain a static 'Main method suitable for an entry point"
@@ -655,7 +659,6 @@ public static async Task DisplayNovelInformationAsync(Guid novelId)
655659
};
656660

657661
Console.WriteLine("NOVEL INFORMATION:");
658-
Console.WriteLine();
659662
Console.WriteLine("-------------------");
660663
foreach (var detail in details)
661664
{
@@ -667,16 +670,17 @@ public static async Task DisplayNovelInformationAsync(Guid novelId)
667670
private static async Task CheckAndUpgrade()
668671
{
669672
using HttpClient client = new HttpClient();
670-
string url = "https://api.github.com/repos/martial-god/Benny-Scraper/releases/latest";
671-
client.DefaultRequestHeaders.Add("User-Agent", "Benny-Scraper"); // GitHub API requires a User-Agent
673+
string url = ReleaseUrl;
674+
client.DefaultRequestHeaders.Add("User-Agent", "Benny-Scraper");
672675

673676
try
674677
{
675678
var response = await client.GetStringAsync(url);
676679
var jsonResponse = Newtonsoft.Json.Linq.JObject.Parse(response);
677680

678681
string latestVersion = jsonResponse["tag_name"].ToString();
679-
string currentVersion = ProgramVersion; // figure out how to get the current version from csproj
682+
string currentVersion = ProgramVersion;
683+
Console.WriteLine($"Current version: {currentVersion}");
680684

681685
if (string.Compare(latestVersion, currentVersion, StringComparison.InvariantCultureIgnoreCase) > 0)
682686
{
@@ -715,15 +719,13 @@ private static async Task<bool> DownloadAndUpgradeApp(string downloadUrl, string
715719

716720
try
717721
{
718-
// Extract the ZIP
719722
string tempDirectory = Path.Combine(Path.GetTempPath(), "appUpdate");
720723
if (Directory.Exists(tempDirectory))
721724
Directory.Delete(tempDirectory, true);
722725
ZipFile.ExtractToDirectory(tempFile, tempDirectory);
723726

724727
// Stop services or processes if necessary
725728

726-
// Replace files
727729
foreach (var file in Directory.GetFiles(tempDirectory))
728730
{
729731
string destFile = Path.Combine(installDirectory, Path.GetFileName(file));
@@ -738,12 +740,9 @@ private static async Task<bool> DownloadAndUpgradeApp(string downloadUrl, string
738740
Directory.Move(dir, destDir);
739741
}
740742

741-
// Clean up
742743
File.Delete(tempFile);
743744
Directory.Delete(tempDirectory, true);
744745

745-
// Restart services or application if necessary
746-
747746
return true;
748747
}
749748
catch (Exception ex)
@@ -790,7 +789,6 @@ private static async Task UpdateNovelFileType(Guid id)
790789
Logger.Error($"Exception when trying to update novel file type. {ex.Message}");
791790
}
792791
}
793-
794792
#endregion
795793

796794
#region Setup

Benny-Scraper/Properties/launchSettings.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
},
77
"Benny-Scraper": {
88
"commandName": "Project",
9+
"commandLineArgs": "-u",
910
"nativeDebugging": true
1011
}
1112
}

0 commit comments

Comments
 (0)