mirror of
https://github.com/SabreTools/SabreTools.RedumpLib.git
synced 2026-09-22 06:54:32 +00:00
Sort subpages into categories
This commit is contained in:
@@ -1145,6 +1145,8 @@ namespace SabreTools.RedumpLib.Web
|
||||
// Create ID subdirectory
|
||||
Directory.CreateDirectory(paddedIdDir);
|
||||
|
||||
#region Pages
|
||||
|
||||
// View Edit History
|
||||
if (discPage.Contains($"<a href=\"/disc/{id}/changes/\""))
|
||||
{
|
||||
@@ -1161,18 +1163,6 @@ namespace SabreTools.RedumpLib.Web
|
||||
sw.Flush();
|
||||
}
|
||||
|
||||
// CUE
|
||||
if (discPage.Contains($"<a href=\"/disc/{id}/cue/\""))
|
||||
{
|
||||
string uri = UrlBuilder.BuildDiscUrl(id, DiscSubpath.Cuesheet);
|
||||
string? remoteName = await DownloadFile(uri, Path.Combine(paddedIdDir, $"{paddedId}.cue"));
|
||||
if (!IgnoreErrors && remoteName is null)
|
||||
{
|
||||
if (Debug) Console.Error.WriteLine($"DEBUG: Downloading cuesheet for {id} failed!");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Edit disc
|
||||
if (discPage.Contains($"<a href=\"/disc/{id}/edit/\""))
|
||||
{
|
||||
@@ -1189,6 +1179,42 @@ namespace SabreTools.RedumpLib.Web
|
||||
sw.Flush();
|
||||
}
|
||||
|
||||
// Review WIP entry
|
||||
if (Constants.NewDiscRegex.IsMatch(discPage))
|
||||
{
|
||||
var match = Constants.NewDiscRegex.Match(discPage);
|
||||
if (int.TryParse(match.Groups[2].Value, out int newDiscId))
|
||||
{
|
||||
string uri = UrlBuilder.BuildNewDiscUrl(newDiscId);
|
||||
string? wipPage = await DownloadString(uri);
|
||||
if (!IgnoreErrors && wipPage is null)
|
||||
{
|
||||
if (Debug) Console.Error.WriteLine($"DEBUG: Downloading WIP entry for {id} failed!");
|
||||
return false;
|
||||
}
|
||||
|
||||
using var sw = File.CreateText(Path.Combine(paddedIdDir, "newdisc.html"));
|
||||
sw.Write(wipPage);
|
||||
sw.Flush();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Files
|
||||
|
||||
// CUE
|
||||
if (discPage.Contains($"<a href=\"/disc/{id}/cue/\""))
|
||||
{
|
||||
string uri = UrlBuilder.BuildDiscUrl(id, DiscSubpath.Cuesheet);
|
||||
string? remoteName = await DownloadFile(uri, Path.Combine(paddedIdDir, $"{paddedId}.cue"));
|
||||
if (!IgnoreErrors && remoteName is null)
|
||||
{
|
||||
if (Debug) Console.Error.WriteLine($"DEBUG: Downloading cuesheet for {id} failed!");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// GDI
|
||||
if (discPage.Contains($"<a href=\"/disc/{id}/gdi/\""))
|
||||
{
|
||||
@@ -1237,26 +1263,6 @@ namespace SabreTools.RedumpLib.Web
|
||||
}
|
||||
}
|
||||
|
||||
// Review WIP entry
|
||||
if (Constants.NewDiscRegex.IsMatch(discPage))
|
||||
{
|
||||
var match = Constants.NewDiscRegex.Match(discPage);
|
||||
if (int.TryParse(match.Groups[2].Value, out int newDiscId))
|
||||
{
|
||||
string uri = UrlBuilder.BuildNewDiscUrl(newDiscId);
|
||||
string? wipPage = await DownloadString(uri);
|
||||
if (!IgnoreErrors && wipPage is null)
|
||||
{
|
||||
if (Debug) Console.Error.WriteLine($"DEBUG: Downloading WIP entry for {id} failed!");
|
||||
return false;
|
||||
}
|
||||
|
||||
using var sw = File.CreateText(Path.Combine(paddedIdDir, "newdisc.html"));
|
||||
sw.Write(wipPage);
|
||||
sw.Flush();
|
||||
}
|
||||
}
|
||||
|
||||
// SBI
|
||||
if (discPage.Contains($"<a href=\"/disc/{id}/sbi/\""))
|
||||
{
|
||||
@@ -1293,6 +1299,8 @@ namespace SabreTools.RedumpLib.Web
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
// HTML (Last in case of errors)
|
||||
using (var discStreamWriter = File.CreateText(Path.Combine(paddedIdDir, "disc.html")))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user