Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/ClusterM/hakchi2.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexey 'Cluster' Avdyukhin <clusterrr@clusterrr.com>2017-03-18 18:28:00 +0300
committerAlexey 'Cluster' Avdyukhin <clusterrr@clusterrr.com>2017-03-18 18:28:00 +0300
commitf52b78bce52621a78520dbdbb658b51774f4fd2d (patch)
treed7df5672fac5a5abcb322eb8c4ebe6555ce2e207 /MainForm.cs
parent29c4fc248d95d4d0b614c84d0c1c3bec25754721 (diff)
It's possible to drag&drop cover art now
Diffstat (limited to 'MainForm.cs')
-rw-r--r--MainForm.cs26
1 files changed, 20 insertions, 6 deletions
diff --git a/MainForm.cs b/MainForm.cs
index 5b7a6cd0..525e4943 100644
--- a/MainForm.cs
+++ b/MainForm.cs
@@ -362,16 +362,21 @@ namespace com.clusterrr.hakchi_gui
ShowSelected();
}
+ void SetImageForSelectedGame(string fileName)
+ {
+ var selected = checkedListBoxGames.SelectedItem;
+ if (selected == null || !(selected is NesMiniApplication)) return;
+ var game = (selected as NesMiniApplication);
+ game.Image = NesMiniApplication.LoadBitmap(fileName);
+ ShowSelected();
+ timerCalculateGames.Enabled = true;
+ }
+
private void buttonBrowseImage_Click(object sender, EventArgs e)
{
if (openFileDialogImage.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
- var selected = checkedListBoxGames.SelectedItem;
- if (selected == null || !(selected is NesMiniApplication)) return;
- var game = (selected as NesMiniApplication);
- game.Image = NesMiniApplication.LoadBitmap(openFileDialogImage.FileName);
- ShowSelected();
- timerCalculateGames.Enabled = true;
+ SetImageForSelectedGame(openFileDialogImage.FileName);
}
}
@@ -1046,6 +1051,15 @@ namespace com.clusterrr.hakchi_gui
private void checkedListBoxGames_DragDrop(object sender, DragEventArgs e)
{
var files = (string[])e.Data.GetData(DataFormats.FileDrop);
+ if (files.Length == 1) // Maybe it's cover art drag&dropped?
+ {
+ var ext = Path.GetExtension(files[0]).ToLower();
+ if (ext == ".jpg" || ext == ".png")
+ {
+ SetImageForSelectedGame(files[0]);
+ return;
+ }
+ }
var allFilesToAdd = new List<string>();
foreach (var file in files)
if (Directory.Exists(file))