mirror of
https://github.com/ShareX/ShareX.git
synced 2024-07-02 21:20:28 +12:00
Merge branch 'master' of https://github.com/ShareX/ShareX
This commit is contained in:
commit
299eb31bd9
|
@ -1526,9 +1526,9 @@ public static Bitmap Slice(Bitmap bmp, int minSliceHeight, int maxSliceHeight, i
|
|||
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)
|
||||
{
|
||||
|
@ -1538,7 +1538,7 @@ public static string OpenImageFileDialog(Form form = 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())
|
||||
{
|
||||
|
@ -1547,6 +1547,11 @@ public static string[] OpenImageFileDialog(bool multiselect, Form form = null)
|
|||
|
||||
ofd.Multiselect = multiselect;
|
||||
|
||||
if (!string.IsNullOrEmpty(initialDirectory))
|
||||
{
|
||||
ofd.InitialDirectory = initialDirectory;
|
||||
}
|
||||
|
||||
if (ofd.ShowDialog(form) == DialogResult.OK)
|
||||
{
|
||||
return ofd.FileNames;
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.IO;
|
||||
using System.Windows.Forms.Design;
|
||||
|
||||
namespace ShareX.HelpersLib
|
||||
|
@ -38,7 +39,21 @@ public override object EditValue(ITypeDescriptorContext context, IServiceProvide
|
|||
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))
|
||||
{
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
|
||||
namespace ShareX.ImageEffectsLib
|
||||
{
|
||||
[Description("Image watermark")]
|
||||
[Description("Image")]
|
||||
public class DrawImage : ImageEffect
|
||||
{
|
||||
[DefaultValue(""), Editor(typeof(ImageFileNameEditor), typeof(UITypeEditor))]
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
|
||||
namespace ShareX.ImageEffectsLib
|
||||
{
|
||||
[Description("Text watermark")]
|
||||
[Description("Text")]
|
||||
public class DrawText : ImageEffect
|
||||
{
|
||||
[DefaultValue(ContentAlignment.BottomRight)]
|
||||
|
|
|
@ -99,7 +99,7 @@ public static string ExtractPackage(string packageFilePath, string destination)
|
|||
}
|
||||
|
||||
return false;
|
||||
}, 20000000);
|
||||
}, 20_000_000);
|
||||
}
|
||||
|
||||
return configJson;
|
||||
|
|
Loading…
Reference in a new issue