Skip to content

Commit

Permalink
v2.1 Update
Browse files Browse the repository at this point in the history
  • Loading branch information
AKASGaming committed Feb 17, 2024
1 parent 1c93e45 commit 635c09f
Show file tree
Hide file tree
Showing 5 changed files with 194 additions and 31 deletions.
6 changes: 3 additions & 3 deletions Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("AKAS Gaming")]
[assembly: AssemblyProduct("Tinfoil Resource Downloader")]
[assembly: AssemblyCopyright("Copyright © 2023")]
[assembly: AssemblyCopyright("Copyright © 2024")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

Expand All @@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("2.0.2")]
[assembly: AssemblyFileVersion("2.0.2")]
[assembly: AssemblyVersion("2.1.0")]
[assembly: AssemblyFileVersion("2.1.0")]
4 changes: 2 additions & 2 deletions Tinfoil Resource Downloader.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -137,13 +137,13 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="AngleSharp">
<Version>1.0.3</Version>
<Version>1.1.0</Version>
</PackageReference>
<PackageReference Include="Downloader">
<Version>3.0.6</Version>
</PackageReference>
<PackageReference Include="HtmlAgilityPack">
<Version>1.11.46</Version>
<Version>1.11.59</Version>
</PackageReference>
<PackageReference Include="MvvmScarletToolkit">
<Version>3.0.58</Version>
Expand Down
160 changes: 151 additions & 9 deletions Windows/MainWindow.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

51 changes: 36 additions & 15 deletions Windows/MainWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -93,23 +93,44 @@ private void LoadData(OBJData filtered)
var reggex = ("<a href=" + '"' + "/Title/" + GameID + '"' + ">");
var GameNameFormatted = GameName.Replace(reggex, String.Empty);
var GameNameFolderFormat = CharachterCleaner(GameNameFormatted);
var GameRelease = filtered.ReleaseDate;
var GameRelease = filtered.release_date;
var GamePub = filtered.Publisher;
var GameSize = filtered.Size;
var GameIcon = "https://tinfoil.media/ti/" + filtered.ID + "/200/200/";
var GameIcon = "https://tinfoil.media/ti/" + filtered.ID + "/0/0/";
var GameBanner = "https://tinfoil.media/thi/" + filtered.ID + "/0/0/";
var baseURL = "https://tinfoil.io/Title/";
var GameURL = baseURL + GameID;
//Output.WriteLine(GameIcon);

gameNameLabel.Text = GameNameFormatted;
gameNameLabel.Text = ("Game Name: " + GameNameFormatted);
gameIdLabel.Text = ("Game ID: " + GameID);
gameRelease.Text = ("Release Date: " + GameRelease);
gameBan1.Text = (GameBanner);
gameIco1.Text = (GameIcon);
gameSize.Text = ("Game Size: " + GameSize);
gamePublisher.Text = ("Publisher: " + GamePub);
gameURL1.Text = (GameURL);

Output.WriteLine("Game Name Formatted: " + GameNameFormatted);
Output.WriteLine("Game Name Folder Formatted: " + GameNameFolderFormat);
Output.WriteLine(reggex);
gameIdLabel.Text = GameID;
Output.WriteLine(GameRelease);
filtered.FormattedName = GameNameFormatted;
filtered.FolderFormatName = GameNameFolderFormat;
filtered.TinfoilSite = baseURL + GameID;

//Downloaded Folder Check
var dir = Environment.GetFolderPath(Environment.SpecialFolder.MyPictures) + @"\Tinfoil Resource Downloader\" + filtered.FolderFormatName;
if (!Directory.Exists(dir))
{
YN.Text = "No";
YN.ForeColor = System.Drawing.Color.Red;
}
else
{
YN.Text = "Yes (Downloading again will overwrite data!)";
YN.ForeColor = System.Drawing.Color.Green;
}
}

private async Task LoadImages(OBJData filtered)
Expand All @@ -125,15 +146,15 @@ private async Task LoadImages(OBJData filtered)

//Icon

var iconRequest = await client.GetAsync(imageURL + filtered.ID + "/200/200/");
var iconRequest = await client.GetAsync(imageURL + filtered.ID + "/0/0/");

using (var response = iconRequest.Content)
using (var stream = await response.ReadAsStreamAsync())
{
gameIcon.SizeMode = PictureBoxSizeMode.StretchImage;
gameIcon.Image = Image.FromStream(stream);
}
filtered.NewIcon = imageURL + filtered.ID + "/2000/2000/";
filtered.NewIcon = imageURL + filtered.ID + "/0/0/";

//Banner
var bannerRequest = await client.GetAsync(bannerURL + filtered.ID + "/1920/1080/");
Expand Down Expand Up @@ -167,7 +188,7 @@ private async Task LoadImages(OBJData filtered)
gameScreenshots.Image = Image.FromStream(stream);
}

screenshotPosition.Text = "1 / " + filtered.Screenshots.Count;
screenshotPosition.Text = "1 / " + (filtered.Screenshots.Count - 1);

//Output.WriteLine(filtered.Screenshots.ToArray().ToString());
}
Expand All @@ -176,7 +197,7 @@ private async void NextImage(OBJData filtered)
{
if (Initial == (filtered.Screenshots.Count - 1)) Initial = 0;
var newImage = filtered.Screenshots[Initial++];
screenshotPosition.Text = Initial + " / " + filtered.Screenshots.Count;
screenshotPosition.Text = Initial + " / " + (filtered.Screenshots.Count - 1);

var client = new HttpClient();
var ssRequest = await client.GetAsync(newImage);
Expand Down Expand Up @@ -225,24 +246,24 @@ public async Task<bool> ConnectionsCheck(string ID)

if (checkedConn1 == false)
{
MessageBox.Show("Your device was unable to connect to one of the APIs: \r\n" + apiURL, "Error");
MessageBox.Show("Your device was unable to connect to one of the APIs: \r\n" + apiURL + "\r\n\r\nIs your device connected to the internet? Is Tinfoil.io/Title down?", "Error");
return false;
} else if (checkedConn2 == false)
{
MessageBox.Show("Your device was unable to connect to one of the APIs: \r\n" + imageURL, "Error");
MessageBox.Show("Your device was unable to connect to one of the APIs: \r\n" + imageURL + "\r\n\r\nIs your device connected to the internet? Is Tinfoil.io/Title down?", "Error");
return false;
} else if (checkedConn3 == false)
{
MessageBox.Show("Your device was unable to connect to one of the APIs: \r\n" + bannerURL, "Error");
MessageBox.Show("Your device was unable to connect to one of the APIs: \r\n" + bannerURL + "\r\n\r\nIs your device connected to the internet? Is Tinfoil.io/Title down?", "Error");
return false;
} else if (checkedConn4 == false)
{
MessageBox.Show("Your device was unable to connect to one of the APIs: \r\n" + mainURL, "Error");
MessageBox.Show("Your device was unable to connect to one of the APIs: \r\n" + mainURL + "\r\n\r\nIs your device connected to the internet? Is Tinfoil.io/Title down?", "Error");
return false;
}
else if (checkedConn1 && checkedConn2 && checkedConn3 && checkedConn4 == false)
{
MessageBox.Show("Your device was unable to connect to one or more of the APIs: \r\n" + apiURL + "\r\n" + imageURL + "\r\n" + bannerURL + "\r\n" + mainURL, "Error");
MessageBox.Show("Your device was unable to connect to one or more of the APIs: \r\n" + apiURL + "\r\n" + imageURL + "\r\n" + bannerURL + "\r\n" + mainURL + "\r\n\r\nIs your device connected to the internet? Is Tinfoil.io/Title down?", "Error");
return false;
} else return true;
}
Expand Down Expand Up @@ -292,7 +313,7 @@ private async void DownloadButton_Click(object sender, EventArgs e)
FolderFormatName = filteredAlt.FolderFormatName,
Size = filteredAlt.Size,
Publisher = filteredAlt.Publisher,
ReleaseDate = filteredAlt.ReleaseDate,
ReleaseDate = filteredAlt.release_date,
Icon = filteredAlt.NewIcon,
Banner = filteredAlt.Banner,
Screenshots = filteredAlt.Screenshots,
Expand Down Expand Up @@ -481,7 +502,7 @@ public class OBJData
public string FolderFormatName { get; set; }
public string NewIcon { get; set; }
public string Banner { get; set; }
public string ReleaseDate { get; set; }
public string release_date { get; set; }
public string Publisher { get; set; }
public string Size { get; set; }
public string TinfoilSite { get; set; }
Expand Down
Loading

0 comments on commit 635c09f

Please sign in to comment.