mirror of
https://github.com/ShareX/ShareX.git
synced 2024-10-04 04:06:05 +13:00
Merge branch 'master' of https://github.com/ShareX/ShareX
This commit is contained in:
commit
299eb31bd9
5 changed files with 27 additions and 7 deletions
|
@ -1526,9 +1526,9 @@ public static Bitmap Slice(Bitmap bmp, int minSliceHeight, int maxSliceHeight, i
|
||||||
return bmpResult;
|
return bmpResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string OpenImageFileDialog(Form form = null)
|
public static string OpenImageFileDialog(Form form = null, string initialDirectory = null)
|
||||||
{
|
{
|
||||||
string[] images = OpenImageFileDialog(false, form);
|
string[] images = OpenImageFileDialog(false, form, initialDirectory);
|
||||||
|
|
||||||
if (images != null && images.Length > 0)
|
if (images != null && images.Length > 0)
|
||||||
{
|
{
|
||||||
|
@ -1538,7 +1538,7 @@ public static string OpenImageFileDialog(Form form = null)
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string[] OpenImageFileDialog(bool multiselect, Form form = null)
|
public static string[] OpenImageFileDialog(bool multiselect, Form form = null, string initialDirectory = null)
|
||||||
{
|
{
|
||||||
using (OpenFileDialog ofd = new OpenFileDialog())
|
using (OpenFileDialog ofd = new OpenFileDialog())
|
||||||
{
|
{
|
||||||
|
@ -1547,6 +1547,11 @@ public static string[] OpenImageFileDialog(bool multiselect, Form form = null)
|
||||||
|
|
||||||
ofd.Multiselect = multiselect;
|
ofd.Multiselect = multiselect;
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty(initialDirectory))
|
||||||
|
{
|
||||||
|
ofd.InitialDirectory = initialDirectory;
|
||||||
|
}
|
||||||
|
|
||||||
if (ofd.ShowDialog(form) == DialogResult.OK)
|
if (ofd.ShowDialog(form) == DialogResult.OK)
|
||||||
{
|
{
|
||||||
return ofd.FileNames;
|
return ofd.FileNames;
|
||||||
|
|
|
@ -25,6 +25,7 @@ You should have received a copy of the GNU General Public License
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
|
using System.IO;
|
||||||
using System.Windows.Forms.Design;
|
using System.Windows.Forms.Design;
|
||||||
|
|
||||||
namespace ShareX.HelpersLib
|
namespace ShareX.HelpersLib
|
||||||
|
@ -38,7 +39,21 @@ public override object EditValue(ITypeDescriptorContext context, IServiceProvide
|
||||||
return base.EditValue(context, provider, value);
|
return base.EditValue(context, provider, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
string filePath = ImageHelpers.OpenImageFileDialog();
|
string filePath = value as string;
|
||||||
|
string initialDirectory = null;
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty(filePath))
|
||||||
|
{
|
||||||
|
filePath = Helpers.ExpandFolderVariables(filePath, true);
|
||||||
|
string directoryPath = Path.GetDirectoryName(filePath);
|
||||||
|
|
||||||
|
if (!string.IsNullOrEmpty(directoryPath) && Directory.Exists(directoryPath))
|
||||||
|
{
|
||||||
|
initialDirectory = directoryPath;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
filePath = ImageHelpers.OpenImageFileDialog(null, initialDirectory);
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(filePath))
|
if (!string.IsNullOrEmpty(filePath))
|
||||||
{
|
{
|
||||||
|
|
|
@ -33,7 +33,7 @@ You should have received a copy of the GNU General Public License
|
||||||
|
|
||||||
namespace ShareX.ImageEffectsLib
|
namespace ShareX.ImageEffectsLib
|
||||||
{
|
{
|
||||||
[Description("Image watermark")]
|
[Description("Image")]
|
||||||
public class DrawImage : ImageEffect
|
public class DrawImage : ImageEffect
|
||||||
{
|
{
|
||||||
[DefaultValue(""), Editor(typeof(ImageFileNameEditor), typeof(UITypeEditor))]
|
[DefaultValue(""), Editor(typeof(ImageFileNameEditor), typeof(UITypeEditor))]
|
||||||
|
|
|
@ -33,7 +33,7 @@ You should have received a copy of the GNU General Public License
|
||||||
|
|
||||||
namespace ShareX.ImageEffectsLib
|
namespace ShareX.ImageEffectsLib
|
||||||
{
|
{
|
||||||
[Description("Text watermark")]
|
[Description("Text")]
|
||||||
public class DrawText : ImageEffect
|
public class DrawText : ImageEffect
|
||||||
{
|
{
|
||||||
[DefaultValue(ContentAlignment.BottomRight)]
|
[DefaultValue(ContentAlignment.BottomRight)]
|
||||||
|
|
|
@ -99,7 +99,7 @@ public static string ExtractPackage(string packageFilePath, string destination)
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}, 20000000);
|
}, 20_000_000);
|
||||||
}
|
}
|
||||||
|
|
||||||
return configJson;
|
return configJson;
|
||||||
|
|
Loading…
Reference in a new issue