Skip to content

Commit 480c0cb

Browse files
committed
Add unused single-disc page URL builder
1 parent 1ac1cdc commit 480c0cb

1 file changed

Lines changed: 87 additions & 2 deletions

File tree

SabreTools.RedumpLib/Web/UrlBuilder.cs

Lines changed: 87 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,91 @@ namespace SabreTools.RedumpLib.Web
1111
/// </summary>
1212
public static class UrlBuilder
1313
{
14+
#region Constants
15+
16+
/// <summary>
17+
/// Redump site URL
18+
/// </summary>
19+
private const string SiteBaseUrl = "http://redump.org/";
20+
21+
#region Top-Level Paths
22+
23+
/// <summary>
24+
/// Path for individual disc pages
25+
/// </summary>
26+
private const string DiscPath = "disc/";
27+
28+
/// <summary>
29+
/// Path for multi-disc pages
30+
/// </summary>
31+
private const string DiscsPath = "discs/";
32+
33+
#endregion
34+
35+
// TODO: Add other top-level paths
36+
// TODO: Add path extensions for disc
37+
// TODO: Add filter statements for discs
38+
39+
#endregion
40+
41+
/// <summary>
42+
/// Build a /disc/ path URL
43+
/// </summary>
44+
/// <param name="id">Disc ID, required</param>
45+
/// <param name="changes">True to add changes subpath, false otherwise</param>
46+
/// <param name="cue">True to add cue subpath, false otherwise</param>
47+
/// <param name="edit">True to add edit subpath, false otherwise</param>
48+
/// <param name="gdi">True to add gdi subpath, false otherwise</param>
49+
/// <param name="key">True to add key subpath, false otherwise</param>
50+
/// <param name="lsd">True to add lsd subpath, false otherwise</param>
51+
/// <param name="md5">True to add md5 subpath, false otherwise</param>
52+
/// <param name="sbi">True to add sbi subpath, false otherwise</param>
53+
/// <param name="sfv">True to add sfv subpath, false otherwise</param>
54+
/// <param name="sha1">True to add sha1 subpath, false otherwise</param>
55+
/// <remarks>All flags are mutually-exclusive and have precedence in order of the method signature</remarks>
56+
public static string BuildDiscUrl(int id,
57+
bool changes = false,
58+
bool cue = false,
59+
bool edit = false,
60+
bool gdi = false,
61+
bool key = false,
62+
bool lsd = false,
63+
bool md5 = false,
64+
bool sbi = false,
65+
bool sfv = false,
66+
bool sha1 = false)
67+
{
68+
var sb = new StringBuilder();
69+
70+
sb.Append(SiteBaseUrl);
71+
sb.Append(DiscPath);
72+
sb.Append(+id);
73+
sb.Append("/");
74+
75+
if (changes)
76+
sb.Append("changes/");
77+
else if (cue)
78+
sb.Append("cue/");
79+
else if (edit)
80+
sb.Append("edit/");
81+
else if (gdi)
82+
sb.Append("gdi/");
83+
else if (key)
84+
sb.Append("key/");
85+
else if (lsd)
86+
sb.Append("lsd/");
87+
else if (md5)
88+
sb.Append("md5/");
89+
else if (sbi)
90+
sb.Append("sbi/");
91+
else if (sfv)
92+
sb.Append("sfv/");
93+
else if (sha1)
94+
sb.Append("sha1/");
95+
96+
return sb.ToString();
97+
}
98+
1499
/// <summary>
15100
/// Build a /discs/ path URL
16101
/// </summary>
@@ -68,8 +153,8 @@ public static string BuildDiscsUrl(bool? antimodchip = null,
68153
{
69154
var sb = new StringBuilder();
70155

71-
sb.Append(Constants.SiteBaseUrl);
72-
sb.Append("discs/");
156+
sb.Append(SiteBaseUrl);
157+
sb.Append(DiscsPath);
73158

74159
// Anti-modchip
75160
switch (antimodchip)

0 commit comments

Comments
 (0)