mirror of
https://github.com/ShareX/ShareX.git
synced 2024-10-01 09:47:22 +13:00
fixed #2088: Check file exists before combine images
This commit is contained in:
parent
3adc1de4e1
commit
37d40d8b98
2 changed files with 24 additions and 5 deletions
|
@ -28,6 +28,7 @@ You should have received a copy of the GNU General Public License
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Windows.Forms;
|
||||
|
||||
|
@ -103,13 +104,31 @@ private void btnCombine_Click(object sender, EventArgs e)
|
|||
{
|
||||
if (lvImages.Items.Count > 0)
|
||||
{
|
||||
IEnumerable<Image> images = null;
|
||||
List<Image> images = new List<Image>();
|
||||
|
||||
try
|
||||
{
|
||||
images = lvImages.Items.Cast<ListViewItem>().Select(x => ImageHelpers.LoadImage(x.Text)).Where(x => x != null);
|
||||
Image output = ImageHelpers.CombineImages(images, Options.Orientation, Options.Space);
|
||||
OnProcessRequested(output);
|
||||
foreach (ListViewItem lvi in lvImages.Items)
|
||||
{
|
||||
string filePath = lvi.Text;
|
||||
|
||||
if (File.Exists(filePath))
|
||||
{
|
||||
Image img = ImageHelpers.LoadImage(filePath);
|
||||
|
||||
if (img != null)
|
||||
{
|
||||
images.Add(img);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (images.Count > 1)
|
||||
{
|
||||
Image output = ImageHelpers.CombineImages(images, Options.Orientation, Options.Space);
|
||||
|
||||
OnProcessRequested(output);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
|
|
@ -247,7 +247,7 @@
|
|||
<value>6</value>
|
||||
</data>
|
||||
<data name="btnCombine.Anchor" type="System.Windows.Forms.AnchorStyles, System.Windows.Forms">
|
||||
<value>Bottom, Left</value>
|
||||
<value>Bottom, Left, Right</value>
|
||||
</data>
|
||||
<data name="btnCombine.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>8, 472</value>
|
||||
|
|
Loading…
Reference in a new issue