Skip to content

Commit

Permalink
1.3
Browse files Browse the repository at this point in the history
Fixed some sort issues and file not being closed by the picturebox
  • Loading branch information
Elie authored and Elie committed Dec 14, 2018
1 parent 9b790fa commit bb031d6
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
14 changes: 12 additions & 2 deletions PSClassicTool/GameInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,16 @@ private void btnReplace_Click(object sender, EventArgs e)
Console.Write("");
try
{
pictureBox1.Image = Bitmap.FromFile(GameManager.getInstance().GetBoxArtPath(_CurrentDisc.GAME_ID, _CurrentDisc.BASENAME));
try
{
byte[] data = System.IO.File.ReadAllBytes(GameManager.getInstance().GetBoxArtPath(_gi.GAME_ID, _CurrentDisc.BASENAME));
pictureBox1.Image = Bitmap.FromStream(new System.IO.MemoryStream(data));
}
catch (Exception exc)
{
pictureBox1.Image = null;
}

}
catch (Exception exc)
{
Expand Down Expand Up @@ -209,7 +218,8 @@ private void btnReplace_Click(object sender, EventArgs e)

try
{
pictureBox1.Image = Bitmap.FromFile(GameManager.getInstance().GetBoxArtPath(_CurrentDisc.GAME_ID, _CurrentDisc.BASENAME));
byte[] dataf = System.IO.File.ReadAllBytes(GameManager.getInstance().GetBoxArtPath(_gi.GAME_ID, _CurrentDisc.BASENAME));
pictureBox1.Image = Bitmap.FromStream(new System.IO.MemoryStream(dataf));
}
catch (Exception exc)
{
Expand Down
4 changes: 4 additions & 0 deletions PSClassicTool/Managers/GameManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ public int CompareTo(DiscInfo inf)
}
public class GameInfo :IComparable<GameInfo>
{
public static bool sortByGameId = false;
public int CompareTo(GameInfo inf)
{
return GAME_TITLE_STRING.CompareTo(inf.GAME_TITLE_STRING);
Expand Down Expand Up @@ -177,6 +178,9 @@ public GameInfo[] ListGames()
ret.Add(gi);
}
}
GameInfo.sortByGameId = true;
ret.Sort();
GameInfo.sortByGameId = false;
/* string sql = "SELECT * FROM GAME";
SQLiteCommand command = new SQLiteCommand(sql, conn);
SQLiteDataReader reader = command.ExecuteReader();
Expand Down

0 comments on commit bb031d6

Please sign in to comment.