mirror of
https://github.com/ShareX/ShareX.git
synced 2024-06-30 20:20:34 +12:00
Merge branch 'master' of github.com:ShareX/ShareX
This commit is contained in:
commit
85d20a0673
|
@ -289,4 +289,26 @@ public enum ColorFormat
|
|||
{
|
||||
RGB, RGBA, ARGB
|
||||
}
|
||||
|
||||
public enum PositionType
|
||||
{
|
||||
[Description("Top - Left")]
|
||||
Top_Left,
|
||||
[Description("Top - Center")]
|
||||
Top,
|
||||
[Description("Top - Right")]
|
||||
Top_Right,
|
||||
[Description("Center - Left")]
|
||||
Left,
|
||||
[Description("Center")]
|
||||
Center,
|
||||
[Description("Center - Right")]
|
||||
Right,
|
||||
[Description("Bottom - Left")]
|
||||
Bottom_Left,
|
||||
[Description("Bottom - Center")]
|
||||
Bottom,
|
||||
[Description("Bottom - Right")]
|
||||
Bottom_Right
|
||||
}
|
||||
}
|
|
@ -440,5 +440,11 @@ public static float Remap(this float value, float from1, float to1, float from2,
|
|||
{
|
||||
return (value - from1) / (to1 - from1) * (to2 - from2) + from2;
|
||||
}
|
||||
|
||||
public static string GetDescription(this Type type)
|
||||
{
|
||||
DescriptionAttribute[] attributes = (DescriptionAttribute[])type.GetCustomAttributes(typeof(DescriptionAttribute), false);
|
||||
return (attributes.Length > 0) ? attributes[0].Description : type.Name;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -31,15 +31,23 @@ namespace HelpersLib
|
|||
public static class GraphicsExtensions
|
||||
{
|
||||
public static void DrawRectangleProper(this Graphics g, Pen pen, Rectangle rect)
|
||||
{
|
||||
if (pen.Width == 1)
|
||||
{
|
||||
rect = rect.SizeOffset(-1);
|
||||
}
|
||||
|
||||
if (rect.Width > 1 && rect.Height > 1)
|
||||
if (rect.Width > 0 && rect.Height > 0)
|
||||
{
|
||||
g.DrawRectangle(pen, rect);
|
||||
}
|
||||
}
|
||||
|
||||
public static void DrawRectangleProper(this Graphics g, Pen pen, int x, int y, int width, int height)
|
||||
{
|
||||
DrawRectangleProper(g, pen, new Rectangle(x, y, width, height));
|
||||
}
|
||||
|
||||
public static void DrawCrossRectangle(this Graphics g, Pen pen, Rectangle rect, int crossSize)
|
||||
{
|
||||
rect = rect.SizeOffset(-1);
|
||||
|
|
|
@ -38,7 +38,8 @@ public override object EditValue(ITypeDescriptorContext context, IServiceProvide
|
|||
{
|
||||
return base.EditValue(context, provider, value);
|
||||
}
|
||||
OpenFileDialog dlg = new OpenFileDialog();
|
||||
using (OpenFileDialog dlg = new OpenFileDialog())
|
||||
{
|
||||
dlg.FileName = "Default.css";
|
||||
dlg.Title = "Browse for a Cascading Style Sheet...";
|
||||
dlg.Filter = "Cascading Style Sheets (*.css)|*.css";
|
||||
|
@ -46,6 +47,7 @@ public override object EditValue(ITypeDescriptorContext context, IServiceProvide
|
|||
{
|
||||
value = dlg.FileName;
|
||||
}
|
||||
}
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,13 +38,15 @@ public override object EditValue(ITypeDescriptorContext context, IServiceProvide
|
|||
{
|
||||
return base.EditValue(context, provider, value);
|
||||
}
|
||||
OpenFileDialog dlg = new OpenFileDialog();
|
||||
using (OpenFileDialog dlg = new OpenFileDialog())
|
||||
{
|
||||
dlg.Title = "Browse for executable...";
|
||||
dlg.Filter = "Applications (*.exe)|*.exe";
|
||||
if (dlg.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
value = dlg.FileName;
|
||||
}
|
||||
}
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,25 +23,31 @@
|
|||
|
||||
#endregion License Information (GPL v3)
|
||||
|
||||
using HelpersLib;
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
using System.Windows.Forms.Design;
|
||||
|
||||
namespace ImageEffectsLib
|
||||
namespace HelpersLib
|
||||
{
|
||||
internal class Background : ImageEffect
|
||||
public class ImageFileNameEditor : FileNameEditor
|
||||
{
|
||||
[DefaultValue(typeof(Color), "White")]
|
||||
public Color Color { get; set; }
|
||||
|
||||
public Background()
|
||||
public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
|
||||
{
|
||||
this.ApplyDefaultPropertyValues();
|
||||
if (context == null || provider == null)
|
||||
{
|
||||
return base.EditValue(context, provider, value);
|
||||
}
|
||||
|
||||
public override Image Apply(Image img)
|
||||
using (OpenFileDialog dlg = new OpenFileDialog())
|
||||
{
|
||||
return ImageHelpers.FillImageBackground(img, Color);
|
||||
dlg.Title = "Browse for images...";
|
||||
dlg.Filter = "Image files (*.jpg, *.jpeg, *.png, *.gif, *.bmp)|*.jpg;*.jpeg;*.png;*.gif;*.bmp";
|
||||
if (dlg.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
value = dlg.FileName;
|
||||
}
|
||||
}
|
||||
return value;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -724,5 +724,32 @@ public static string HtmlEncode(string text)
|
|||
|
||||
return result.ToString();
|
||||
}
|
||||
|
||||
public static Point GetPosition(PositionType positionType, int offset, Size img, Size img2, int add = 0)
|
||||
{
|
||||
switch (positionType)
|
||||
{
|
||||
case PositionType.Top_Left:
|
||||
return new Point(offset, offset);
|
||||
case PositionType.Top:
|
||||
return new Point(img.Width / 2 - img2.Width / 2 - add, offset);
|
||||
case PositionType.Top_Right:
|
||||
return new Point(img.Width - img2.Width - offset - add, offset);
|
||||
case PositionType.Left:
|
||||
return new Point(offset, img.Height / 2 - img2.Height / 2 - add);
|
||||
case PositionType.Center:
|
||||
return new Point(img.Width / 2 - img2.Width / 2 - add, img.Height / 2 - img2.Height / 2 - add);
|
||||
case PositionType.Right:
|
||||
return new Point(img.Width - img2.Width - offset - add, img.Height / 2 - img2.Height / 2 - add);
|
||||
case PositionType.Bottom_Left:
|
||||
return new Point(offset, img.Height - img2.Height - offset - add);
|
||||
case PositionType.Bottom:
|
||||
return new Point(img.Width / 2 - img2.Width / 2 - add, img.Height - img2.Height - offset - add);
|
||||
case PositionType.Bottom_Right:
|
||||
return new Point(img.Width - img2.Width - offset - add, img.Height - img2.Height - offset - add);
|
||||
default:
|
||||
return Point.Empty;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -201,38 +201,6 @@ public static Image CropImage(Image img, Rectangle rect, GraphicsPath gp)
|
|||
return null;
|
||||
}
|
||||
|
||||
public static Image DrawBorder(Image img, BorderType borderType, Color borderColor, int borderSize)
|
||||
{
|
||||
Bitmap bmp;
|
||||
|
||||
using (Pen borderPen = new Pen(borderColor, borderSize) { Alignment = PenAlignment.Inset })
|
||||
{
|
||||
if (borderType == BorderType.Inside)
|
||||
{
|
||||
bmp = (Bitmap)img;
|
||||
|
||||
using (Graphics g = Graphics.FromImage(bmp))
|
||||
{
|
||||
g.DrawRectangleProper(borderPen, new Rectangle(0, 0, img.Width, img.Height));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
bmp = img.CreateEmptyBitmap(borderSize * 2, borderSize * 2);
|
||||
|
||||
using (Graphics g = Graphics.FromImage(bmp))
|
||||
using (img)
|
||||
{
|
||||
g.SetHighQuality();
|
||||
g.DrawImage(img, borderSize, borderSize, img.Width, img.Height);
|
||||
g.DrawRectangleProper(borderPen, new Rectangle(0, 0, img.Width + borderSize * 2, img.Height + borderSize * 2));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return bmp;
|
||||
}
|
||||
|
||||
public static Image DrawOutline(Image img, GraphicsPath gp)
|
||||
{
|
||||
if (img != null && gp != null)
|
||||
|
@ -345,27 +313,83 @@ public static Bitmap AddReflection(Image img, int percentage, int maxAlpha, int
|
|||
return reflection;
|
||||
}
|
||||
|
||||
public static Bitmap FillImageBackground(Image img, Color color)
|
||||
public static Image DrawBorder(Image img, Color borderColor, int borderSize, BorderType borderType)
|
||||
{
|
||||
Bitmap result = img.CreateEmptyBitmap();
|
||||
using (Pen borderPen = new Pen(borderColor, borderSize) { Alignment = PenAlignment.Inset })
|
||||
{
|
||||
return DrawBorder(img, borderPen, borderType);
|
||||
}
|
||||
}
|
||||
|
||||
using (Graphics g = Graphics.FromImage(result))
|
||||
public static Image DrawBorder(Image img, Color fromBorderColor, Color toBorderColor, LinearGradientMode gradientType, int borderSize, BorderType borderType)
|
||||
{
|
||||
int width = img.Width;
|
||||
int height = img.Height;
|
||||
|
||||
if (borderType == BorderType.Outside)
|
||||
{
|
||||
width += borderSize * 2;
|
||||
height += borderSize * 2;
|
||||
}
|
||||
|
||||
using (LinearGradientBrush brush = new LinearGradientBrush(new Rectangle(0, 0, width, height), fromBorderColor, toBorderColor, gradientType))
|
||||
using (Pen borderPen = new Pen(brush, borderSize) { Alignment = PenAlignment.Inset })
|
||||
{
|
||||
return DrawBorder(img, borderPen, borderType);
|
||||
}
|
||||
}
|
||||
|
||||
public static Image DrawBorder(Image img, Pen borderPen, BorderType borderType)
|
||||
{
|
||||
Bitmap bmp;
|
||||
|
||||
if (borderType == BorderType.Inside)
|
||||
{
|
||||
bmp = (Bitmap)img;
|
||||
|
||||
using (Graphics g = Graphics.FromImage(bmp))
|
||||
{
|
||||
g.DrawRectangleProper(borderPen, 0, 0, img.Width, img.Height);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
int borderSize = (int)borderPen.Width;
|
||||
bmp = img.CreateEmptyBitmap(borderSize * 2, borderSize * 2, PixelFormat.Format32bppArgb);
|
||||
|
||||
using (Graphics g = Graphics.FromImage(bmp))
|
||||
using (img)
|
||||
{
|
||||
g.Clear(color);
|
||||
g.DrawRectangleProper(borderPen, 0, 0, bmp.Width, bmp.Height);
|
||||
g.SetHighQuality();
|
||||
g.DrawImage(img, 0, 0, result.Width, result.Height);
|
||||
g.DrawImage(img, borderSize, borderSize, img.Width, img.Height);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
return bmp;
|
||||
}
|
||||
|
||||
public static Bitmap FillImageBackground(Image img, Color fromColor, Color toColor, LinearGradientMode gradientType)
|
||||
public static Bitmap FillBackground(Image img, Color color)
|
||||
{
|
||||
Bitmap result = img.CreateEmptyBitmap();
|
||||
using (Brush brush = new SolidBrush(color))
|
||||
{
|
||||
return FillBackground(img, brush);
|
||||
}
|
||||
}
|
||||
|
||||
public static Bitmap FillBackground(Image img, Color fromColor, Color toColor, LinearGradientMode gradientType)
|
||||
{
|
||||
using (LinearGradientBrush brush = new LinearGradientBrush(new Rectangle(0, 0, img.Width, img.Height), fromColor, toColor, gradientType))
|
||||
{
|
||||
return FillBackground(img, brush);
|
||||
}
|
||||
}
|
||||
|
||||
public static Bitmap FillBackground(Image img, Brush brush)
|
||||
{
|
||||
Bitmap result = img.CreateEmptyBitmap(PixelFormat.Format32bppArgb);
|
||||
|
||||
using (Graphics g = Graphics.FromImage(result))
|
||||
using (LinearGradientBrush brush = new LinearGradientBrush(new Rectangle(0, 0, result.Width, result.Height), fromColor, toColor, gradientType))
|
||||
using (img)
|
||||
{
|
||||
g.FillRectangle(brush, 0, 0, result.Width, result.Height);
|
||||
|
|
|
@ -86,6 +86,7 @@
|
|||
<Compile Include="Colors\RGBA.cs" />
|
||||
<Compile Include="ConvolutionMatrix.cs" />
|
||||
<Compile Include="ConvolutionMatrixManager.cs" />
|
||||
<Compile Include="FileNameEditors\ImageFileNameEditor.cs" />
|
||||
<Compile Include="Helpers\ClipboardHelpers.cs" />
|
||||
<Compile Include="ColorBgra.cs" />
|
||||
<Compile Include="Cryptographic\Crc32.cs" />
|
||||
|
|
|
@ -31,10 +31,10 @@ namespace ImageEffectsLib
|
|||
{
|
||||
internal class Alpha : ImageEffect
|
||||
{
|
||||
[DefaultValue(1f)]
|
||||
[DefaultValue(1f), Description("Pixel alpha = Pixel alpha * Value\r\nExample 0.5 will decrease alpha of pixel 50%")]
|
||||
public float Value { get; set; }
|
||||
|
||||
[DefaultValue(0f)]
|
||||
[DefaultValue(0f), Description("Pixel alpha = Pixel alpha + Addition\r\nExample 0.5 will increase alpha of pixel 127.5")]
|
||||
public float Addition { get; set; }
|
||||
|
||||
public Alpha()
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
|
||||
namespace ImageEffectsLib
|
||||
{
|
||||
[Description("Black & white")]
|
||||
internal class BlackWhite : ImageEffect
|
||||
{
|
||||
public override Image Apply(Image img)
|
||||
|
|
|
@ -31,7 +31,7 @@ namespace ImageEffectsLib
|
|||
{
|
||||
internal class Brightness : ImageEffect
|
||||
{
|
||||
[DefaultValue(0f)]
|
||||
[DefaultValue(0f), Description("Pixel color = Pixel color + Value\r\nExample 0.5 will increase color of pixel 127.5")]
|
||||
public float Value { get; set; }
|
||||
|
||||
public Brightness()
|
||||
|
|
|
@ -31,7 +31,7 @@ namespace ImageEffectsLib
|
|||
{
|
||||
internal class Contrast : ImageEffect
|
||||
{
|
||||
[DefaultValue(1f)]
|
||||
[DefaultValue(1f), Description("Pixel color = Pixel color * Value\r\nExample 1.5 will increase color of pixel 50%")]
|
||||
public float Value { get; set; }
|
||||
|
||||
public Contrast()
|
||||
|
|
|
@ -31,7 +31,7 @@ namespace ImageEffectsLib
|
|||
{
|
||||
internal class Hue : ImageEffect
|
||||
{
|
||||
[DefaultValue(0f)]
|
||||
[DefaultValue(0f), Description("From 0 to 360")]
|
||||
public float Angle { get; set; }
|
||||
|
||||
public Hue()
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
|
||||
namespace ImageEffectsLib
|
||||
{
|
||||
[Description("Color matrix")]
|
||||
internal class MatrixColor : ImageEffect
|
||||
{
|
||||
[DefaultValue(1f), Description("Red = (Red * Rr) + (Green * Rg) + (Blue * Rb) + (Alpha * Ra) + Ro")]
|
||||
|
|
|
@ -30,10 +30,14 @@
|
|||
|
||||
namespace ImageEffectsLib
|
||||
{
|
||||
internal class BackgroundGradient : ImageEffect
|
||||
[Description("Background")]
|
||||
internal class DrawBackground : ImageEffect
|
||||
{
|
||||
[DefaultValue(typeof(Color), "White")]
|
||||
public Color FromColor { get; set; }
|
||||
public Color Color { get; set; }
|
||||
|
||||
[DefaultValue(false)]
|
||||
public bool UseGradient { get; set; }
|
||||
|
||||
[DefaultValue(typeof(Color), "Black")]
|
||||
public Color ToColor { get; set; }
|
||||
|
@ -41,14 +45,21 @@ internal class BackgroundGradient : ImageEffect
|
|||
[DefaultValue(LinearGradientMode.ForwardDiagonal)]
|
||||
public LinearGradientMode GradientType { get; set; }
|
||||
|
||||
public BackgroundGradient()
|
||||
public DrawBackground()
|
||||
{
|
||||
this.ApplyDefaultPropertyValues();
|
||||
}
|
||||
|
||||
public override Image Apply(Image img)
|
||||
{
|
||||
return ImageHelpers.FillImageBackground(img, FromColor, ToColor, GradientType);
|
||||
if (UseGradient)
|
||||
{
|
||||
return ImageHelpers.FillBackground(img, Color, ToColor, GradientType);
|
||||
}
|
||||
else
|
||||
{
|
||||
return ImageHelpers.FillBackground(img, Color);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -26,28 +26,46 @@
|
|||
using HelpersLib;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
|
||||
namespace ImageEffectsLib
|
||||
{
|
||||
internal class Border : ImageEffect
|
||||
[Description("Border")]
|
||||
internal class DrawBorder : ImageEffect
|
||||
{
|
||||
[DefaultValue(BorderType.Outside)]
|
||||
public BorderType Type { get; set; }
|
||||
|
||||
[DefaultValue(typeof(Color), "DodgerBlue")]
|
||||
public Color Color { get; set; }
|
||||
|
||||
[DefaultValue(1)]
|
||||
public int Size { get; set; }
|
||||
|
||||
public Border()
|
||||
[DefaultValue(typeof(Color), "DodgerBlue")]
|
||||
public Color Color { get; set; }
|
||||
|
||||
[DefaultValue(false)]
|
||||
public bool UseGradient { get; set; }
|
||||
|
||||
[DefaultValue(typeof(Color), "Black")]
|
||||
public Color ToColor { get; set; }
|
||||
|
||||
[DefaultValue(LinearGradientMode.ForwardDiagonal)]
|
||||
public LinearGradientMode GradientType { get; set; }
|
||||
|
||||
public DrawBorder()
|
||||
{
|
||||
this.ApplyDefaultPropertyValues();
|
||||
}
|
||||
|
||||
public override Image Apply(Image img)
|
||||
{
|
||||
return ImageHelpers.DrawBorder(img, Type, Color, Size);
|
||||
if (UseGradient)
|
||||
{
|
||||
return ImageHelpers.DrawBorder(img, Color, ToColor, GradientType, Size, Type);
|
||||
}
|
||||
else
|
||||
{
|
||||
return ImageHelpers.DrawBorder(img, Color, Size, Type);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
79
ImageEffectsLib/Drawings/DrawImage.cs
Normal file
79
ImageEffectsLib/Drawings/DrawImage.cs
Normal file
|
@ -0,0 +1,79 @@
|
|||
#region License Information (GPL v3)
|
||||
|
||||
/*
|
||||
ShareX - A program that allows you to take screenshots and share any file type
|
||||
Copyright (C) 2008-2013 ShareX Developers
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
Optionally you can also view the license at <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#endregion License Information (GPL v3)
|
||||
|
||||
using HelpersLib;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Design;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.IO;
|
||||
|
||||
namespace ImageEffectsLib
|
||||
{
|
||||
[Description("Image")]
|
||||
internal class DrawImage : ImageEffect
|
||||
{
|
||||
[DefaultValue(""), Editor(typeof(ImageFileNameEditor), typeof(UITypeEditor))]
|
||||
public string ImageLocation { get; set; }
|
||||
|
||||
[DefaultValue(PositionType.Bottom_Right)]
|
||||
public PositionType Position { get; set; }
|
||||
|
||||
[DefaultValue(5)]
|
||||
public int Offset { get; set; }
|
||||
|
||||
[DefaultValue(false), Description("If image size bigger than source image then don't draw it.")]
|
||||
public bool AutoHide { get; set; }
|
||||
|
||||
public DrawImage()
|
||||
{
|
||||
this.ApplyDefaultPropertyValues();
|
||||
}
|
||||
|
||||
public override Image Apply(Image img)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(ImageLocation) && File.Exists(ImageLocation))
|
||||
{
|
||||
using (Image img2 = Helpers.GetImageFromFile(ImageLocation))
|
||||
{
|
||||
if (AutoHide && ((img2.Width + Offset > img.Width) || (img2.Height + Offset > img.Height)))
|
||||
{
|
||||
return img;
|
||||
}
|
||||
|
||||
Point pos = Helpers.GetPosition(Position, Offset, img.Size, img2.Size);
|
||||
|
||||
using (Graphics g = Graphics.FromImage(img))
|
||||
{
|
||||
g.SetHighQuality();
|
||||
g.DrawImage(img2, pos.X, pos.Y, img2.Width, img2.Height);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return img;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -29,6 +29,7 @@
|
|||
|
||||
namespace ImageEffectsLib
|
||||
{
|
||||
[Description("Edge detect")]
|
||||
internal class EdgeDetect : ImageEffect
|
||||
{
|
||||
public override Image Apply(Image img)
|
||||
|
|
|
@ -29,21 +29,14 @@
|
|||
|
||||
namespace ImageEffectsLib
|
||||
{
|
||||
[Description("Gaussian blur")]
|
||||
internal class GaussianBlur : ImageEffect
|
||||
{
|
||||
[DefaultValue(4)]
|
||||
public int Weight { get; set; }
|
||||
|
||||
public GaussianBlur()
|
||||
{
|
||||
this.ApplyDefaultPropertyValues();
|
||||
}
|
||||
|
||||
public override Image Apply(Image img)
|
||||
{
|
||||
using (img)
|
||||
{
|
||||
return ConvolutionMatrixManager.GaussianBlur(Weight).Apply(img);
|
||||
return ConvolutionMatrixManager.GaussianBlur().Apply(img);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
|
||||
namespace ImageEffectsLib
|
||||
{
|
||||
[Description("Convolution matrix")]
|
||||
internal class MatrixConvolution : ImageEffect
|
||||
{
|
||||
[DefaultValue(0)]
|
||||
|
|
|
@ -29,21 +29,14 @@
|
|||
|
||||
namespace ImageEffectsLib
|
||||
{
|
||||
[Description("Mean removal")]
|
||||
internal class MeanRemoval : ImageEffect
|
||||
{
|
||||
[DefaultValue(9)]
|
||||
public int Weight { get; set; }
|
||||
|
||||
public MeanRemoval()
|
||||
{
|
||||
this.ApplyDefaultPropertyValues();
|
||||
}
|
||||
|
||||
public override Image Apply(Image img)
|
||||
{
|
||||
using (img)
|
||||
{
|
||||
return ConvolutionMatrixManager.MeanRemoval(Weight).Apply(img);
|
||||
return ConvolutionMatrixManager.MeanRemoval().Apply(img);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,21 +31,13 @@ namespace ImageEffectsLib
|
|||
{
|
||||
internal class Sharpen : ImageEffect
|
||||
{
|
||||
[DefaultValue(11)]
|
||||
public int Weight { get; set; }
|
||||
|
||||
public Sharpen()
|
||||
{
|
||||
this.ApplyDefaultPropertyValues();
|
||||
}
|
||||
|
||||
public override Image Apply(Image img)
|
||||
{
|
||||
//return ImageHelpers.Sharpen(img, Strength);
|
||||
|
||||
using (img)
|
||||
{
|
||||
return ConvolutionMatrixManager.Sharpen(Weight).Apply(img);
|
||||
return ConvolutionMatrixManager.Sharpen().Apply(img);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,19 +31,11 @@ namespace ImageEffectsLib
|
|||
{
|
||||
internal class Smooth : ImageEffect
|
||||
{
|
||||
[DefaultValue(1)]
|
||||
public int Weight { get; set; }
|
||||
|
||||
public Smooth()
|
||||
{
|
||||
this.ApplyDefaultPropertyValues();
|
||||
}
|
||||
|
||||
public override Image Apply(Image img)
|
||||
{
|
||||
using (img)
|
||||
{
|
||||
return ConvolutionMatrixManager.Smooth(Weight).Apply(img);
|
||||
return ConvolutionMatrixManager.Smooth().Apply(img);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
|
||||
namespace ImageEffectsLib
|
||||
{
|
||||
[Description("Torn edge")]
|
||||
internal class TornEdge : ImageEffect
|
||||
{
|
||||
[DefaultValue(12)]
|
||||
|
|
38
ImageEffectsLib/ImageEffectsForm.Designer.cs
generated
38
ImageEffectsLib/ImageEffectsForm.Designer.cs
generated
|
@ -41,10 +41,10 @@ private void InitializeComponent()
|
|||
this.btnMoveDown = new System.Windows.Forms.Button();
|
||||
this.btnDuplicate = new System.Windows.Forms.Button();
|
||||
this.lblStatus = new System.Windows.Forms.Label();
|
||||
this.btnTest = new System.Windows.Forms.Button();
|
||||
this.btnRefresh = new System.Windows.Forms.Button();
|
||||
this.btnLoadImage = new System.Windows.Forms.Button();
|
||||
this.pbResult = new HelpersLib.MyPictureBox();
|
||||
this.btnSaveImage = new System.Windows.Forms.Button();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// tvEffects
|
||||
|
@ -189,18 +189,6 @@ private void InitializeComponent()
|
|||
this.lblStatus.TabIndex = 12;
|
||||
this.lblStatus.Text = "Status";
|
||||
//
|
||||
// btnTest
|
||||
//
|
||||
this.btnTest.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.btnTest.Location = new System.Drawing.Point(708, 734);
|
||||
this.btnTest.Name = "btnTest";
|
||||
this.btnTest.Size = new System.Drawing.Size(72, 24);
|
||||
this.btnTest.TabIndex = 13;
|
||||
this.btnTest.Text = "Test";
|
||||
this.btnTest.UseVisualStyleBackColor = true;
|
||||
this.btnTest.Visible = false;
|
||||
this.btnTest.Click += new System.EventHandler(this.btnTest_Click);
|
||||
//
|
||||
// btnRefresh
|
||||
//
|
||||
this.btnRefresh.Location = new System.Drawing.Point(408, 8);
|
||||
|
@ -214,11 +202,12 @@ private void InitializeComponent()
|
|||
//
|
||||
// btnLoadImage
|
||||
//
|
||||
this.btnLoadImage.Location = new System.Drawing.Point(618, 734);
|
||||
this.btnLoadImage.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.btnLoadImage.Location = new System.Drawing.Point(576, 734);
|
||||
this.btnLoadImage.Name = "btnLoadImage";
|
||||
this.btnLoadImage.Size = new System.Drawing.Size(84, 24);
|
||||
this.btnLoadImage.Size = new System.Drawing.Size(99, 24);
|
||||
this.btnLoadImage.TabIndex = 15;
|
||||
this.btnLoadImage.Text = "Load image";
|
||||
this.btnLoadImage.Text = "Load image...";
|
||||
this.btnLoadImage.UseVisualStyleBackColor = true;
|
||||
this.btnLoadImage.Visible = false;
|
||||
this.btnLoadImage.Click += new System.EventHandler(this.btnLoadImage_Click);
|
||||
|
@ -231,20 +220,33 @@ private void InitializeComponent()
|
|||
this.pbResult.BackColor = System.Drawing.Color.White;
|
||||
this.pbResult.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
||||
this.pbResult.DrawCheckeredBackground = true;
|
||||
this.pbResult.EnableRightClickMenu = true;
|
||||
this.pbResult.FullscreenOnClick = true;
|
||||
this.pbResult.Location = new System.Drawing.Point(248, 280);
|
||||
this.pbResult.Name = "pbResult";
|
||||
this.pbResult.Size = new System.Drawing.Size(688, 448);
|
||||
this.pbResult.TabIndex = 11;
|
||||
//
|
||||
// btnSaveImage
|
||||
//
|
||||
this.btnSaveImage.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.btnSaveImage.Location = new System.Drawing.Point(681, 734);
|
||||
this.btnSaveImage.Name = "btnSaveImage";
|
||||
this.btnSaveImage.Size = new System.Drawing.Size(99, 24);
|
||||
this.btnSaveImage.TabIndex = 16;
|
||||
this.btnSaveImage.Text = "Save image...";
|
||||
this.btnSaveImage.UseVisualStyleBackColor = true;
|
||||
this.btnSaveImage.Visible = false;
|
||||
this.btnSaveImage.Click += new System.EventHandler(this.btnSaveImage_Click);
|
||||
//
|
||||
// ImageEffectsForm
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(944, 766);
|
||||
this.Controls.Add(this.btnSaveImage);
|
||||
this.Controls.Add(this.btnLoadImage);
|
||||
this.Controls.Add(this.btnRefresh);
|
||||
this.Controls.Add(this.btnTest);
|
||||
this.Controls.Add(this.lblStatus);
|
||||
this.Controls.Add(this.btnDuplicate);
|
||||
this.Controls.Add(this.btnMoveDown);
|
||||
|
@ -283,9 +285,9 @@ private void InitializeComponent()
|
|||
private System.Windows.Forms.Button btnMoveDown;
|
||||
private System.Windows.Forms.Button btnDuplicate;
|
||||
private System.Windows.Forms.Label lblStatus;
|
||||
private System.Windows.Forms.Button btnTest;
|
||||
private System.Windows.Forms.Button btnRefresh;
|
||||
private System.Windows.Forms.Button btnLoadImage;
|
||||
private System.Windows.Forms.Button btnSaveImage;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Imaging;
|
||||
using System.Linq;
|
||||
using System.Windows.Forms;
|
||||
|
||||
|
@ -54,19 +55,21 @@ public ImageEffectsForm(Image img, List<ImageEffect> effects = null)
|
|||
UpdatePreview();
|
||||
}
|
||||
|
||||
public void Test()
|
||||
public void EditorMode()
|
||||
{
|
||||
btnRefresh.Visible = true;
|
||||
btnLoadImage.Visible = true;
|
||||
btnTest.Visible = true;
|
||||
btnSaveImage.Visible = true;
|
||||
}
|
||||
|
||||
private void AddAllEffectsToTreeView()
|
||||
{
|
||||
AddEffectToTreeView("Drawings",
|
||||
typeof(DrawBackground),
|
||||
typeof(DrawBorder),
|
||||
typeof(DrawImage));
|
||||
|
||||
AddEffectToTreeView("Manipulations",
|
||||
typeof(Background),
|
||||
typeof(BackgroundGradient),
|
||||
typeof(Border),
|
||||
typeof(Crop),
|
||||
typeof(Canvas),
|
||||
typeof(Flip),
|
||||
|
@ -113,7 +116,7 @@ private void AddEffectToTreeView(string groupName, params Type[] imageEffects)
|
|||
|
||||
foreach (Type imageEffect in imageEffects)
|
||||
{
|
||||
TreeNode childNode = parentNode.Nodes.Add(imageEffect.Name);
|
||||
TreeNode childNode = parentNode.Nodes.Add(imageEffect.GetDescription());
|
||||
childNode.Tag = imageEffect;
|
||||
}
|
||||
}
|
||||
|
@ -178,7 +181,7 @@ private void ClearEffects()
|
|||
|
||||
private void AddEffect(ImageEffect imageEffect)
|
||||
{
|
||||
ListViewItem lvi = new ListViewItem(imageEffect.GetType().Name);
|
||||
ListViewItem lvi = new ListViewItem(imageEffect.GetType().GetDescription());
|
||||
lvi.Tag = imageEffect;
|
||||
|
||||
if (lvEffects.SelectedIndices.Count > 0)
|
||||
|
@ -320,11 +323,21 @@ private void btnLoadImage_Click(object sender, EventArgs e)
|
|||
}
|
||||
}
|
||||
|
||||
private void btnTest_Click(object sender, EventArgs e)
|
||||
private void btnSaveImage_Click(object sender, EventArgs e)
|
||||
{
|
||||
AddEffect(new Background { Color = Color.Black });
|
||||
AddEffect(new Border { Color = Color.Red });
|
||||
UpdatePreview();
|
||||
using (SaveFileDialog sfd = new SaveFileDialog())
|
||||
{
|
||||
sfd.DefaultExt = ".png";
|
||||
sfd.Filter = "PNG image (*.png)|*.png";
|
||||
|
||||
if (sfd.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
using (Image preview = ApplyEffects())
|
||||
{
|
||||
preview.Save(sfd.FileName, ImageFormat.Png);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void btnOK_Click(object sender, EventArgs e)
|
||||
|
|
|
@ -58,6 +58,7 @@
|
|||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Design" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xml.Linq">
|
||||
|
@ -75,6 +76,7 @@
|
|||
<Compile Include="Adjustments\Polaroid.cs" />
|
||||
<Compile Include="Adjustments\Sepia.cs" />
|
||||
<Compile Include="Adjustments\MatrixColor.cs" />
|
||||
<Compile Include="Drawings\DrawImage.cs" />
|
||||
<Compile Include="Filters\EdgeDetect.cs" />
|
||||
<Compile Include="Filters\Emboss.cs" />
|
||||
<Compile Include="Filters\GaussianBlur.cs" />
|
||||
|
@ -84,7 +86,6 @@
|
|||
<Compile Include="Filters\Sharpen.cs" />
|
||||
<Compile Include="Filters\Smooth.cs" />
|
||||
<Compile Include="ImageEffectManager.cs" />
|
||||
<Compile Include="Manipulations\BackgroundGradient.cs" />
|
||||
<Compile Include="Adjustments\Brightness.cs" />
|
||||
<Compile Include="Adjustments\Colorize.cs" />
|
||||
<Compile Include="Adjustments\Contrast.cs" />
|
||||
|
@ -99,7 +100,7 @@
|
|||
<Compile Include="Filters\Shadow.cs" />
|
||||
<Compile Include="Filters\TornEdge.cs" />
|
||||
<Compile Include="Manipulations\Canvas.cs" />
|
||||
<Compile Include="Manipulations\Background.cs" />
|
||||
<Compile Include="Drawings\DrawBackground.cs" />
|
||||
<Compile Include="Manipulations\Flip.cs" />
|
||||
<Compile Include="Manipulations\Scale.cs" />
|
||||
<Compile Include="ImageEffect.cs" />
|
||||
|
@ -109,7 +110,7 @@
|
|||
<Compile Include="ImageEffectsForm.Designer.cs">
|
||||
<DependentUpon>ImageEffectsForm.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Manipulations\Border.cs" />
|
||||
<Compile Include="Drawings\DrawBorder.cs" />
|
||||
<Compile Include="Filters\Reflection.cs" />
|
||||
<Compile Include="Manipulations\Resize.cs" />
|
||||
<Compile Include="Manipulations\Rotate.cs" />
|
||||
|
|
39
ShareX/Forms/MainForm.Designer.cs
generated
39
ShareX/Forms/MainForm.Designer.cs
generated
|
@ -91,6 +91,7 @@ private void InitializeComponent()
|
|||
this.tsmiScreenColorPicker = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.tsmiHashCheck = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.tsmiIndexFolder = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.tsmiImageEffects = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.tsbScreenshotsFolder = new System.Windows.Forms.ToolStripButton();
|
||||
this.tsbHistory = new System.Windows.Forms.ToolStripButton();
|
||||
this.tsbImageHistory = new System.Windows.Forms.ToolStripButton();
|
||||
|
@ -105,7 +106,6 @@ private void InitializeComponent()
|
|||
this.tsmiTestURLShortener = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.tsmiTestUploaders = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.tsmiTestShapeCapture = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.tsmiTestImageEffects = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.scMain = new HelpersLib.SplitContainerCustomSplitter();
|
||||
this.lblDragAndDropTip = new System.Windows.Forms.Label();
|
||||
this.lblSplitter = new System.Windows.Forms.Label();
|
||||
|
@ -208,6 +208,7 @@ private void InitializeComponent()
|
|||
this.tssTray3 = new System.Windows.Forms.ToolStripSeparator();
|
||||
this.tsmiTrayExit = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.ssToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.tsmiTrayImageEffects = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.tsMain.SuspendLayout();
|
||||
this.scMain.Panel1.SuspendLayout();
|
||||
this.scMain.Panel2.SuspendLayout();
|
||||
|
@ -530,7 +531,8 @@ private void InitializeComponent()
|
|||
this.tsddbTools.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.tsmiScreenColorPicker,
|
||||
this.tsmiHashCheck,
|
||||
this.tsmiIndexFolder});
|
||||
this.tsmiIndexFolder,
|
||||
this.tsmiImageEffects});
|
||||
this.tsddbTools.Image = global::ShareX.Properties.Resources.toolbox;
|
||||
this.tsddbTools.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||
this.tsddbTools.ImageTransparentColor = System.Drawing.Color.Magenta;
|
||||
|
@ -562,6 +564,14 @@ private void InitializeComponent()
|
|||
this.tsmiIndexFolder.Text = "Index folder...";
|
||||
this.tsmiIndexFolder.Click += new System.EventHandler(this.tsmiIndexFolder_Click);
|
||||
//
|
||||
// tsmiImageEffects
|
||||
//
|
||||
this.tsmiImageEffects.Image = global::ShareX.Properties.Resources.image_saturation;
|
||||
this.tsmiImageEffects.Name = "tsmiImageEffects";
|
||||
this.tsmiImageEffects.Size = new System.Drawing.Size(183, 22);
|
||||
this.tsmiImageEffects.Text = "Image effects...";
|
||||
this.tsmiImageEffects.Click += new System.EventHandler(this.tsmiImageEffects_Click);
|
||||
//
|
||||
// tsbScreenshotsFolder
|
||||
//
|
||||
this.tsbScreenshotsFolder.Image = global::ShareX.Properties.Resources.folder_open_image;
|
||||
|
@ -634,8 +644,7 @@ private void InitializeComponent()
|
|||
this.tsmiTestFileUpload,
|
||||
this.tsmiTestURLShortener,
|
||||
this.tsmiTestUploaders,
|
||||
this.tsmiTestShapeCapture,
|
||||
this.tsmiTestImageEffects});
|
||||
this.tsmiTestShapeCapture});
|
||||
this.tsmiDebug.Image = global::ShareX.Properties.Resources.block;
|
||||
this.tsmiDebug.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||
this.tsmiDebug.ImageTransparentColor = System.Drawing.Color.Magenta;
|
||||
|
@ -699,14 +708,6 @@ private void InitializeComponent()
|
|||
this.tsmiTestShapeCapture.Text = "Test shape capture...";
|
||||
this.tsmiTestShapeCapture.Click += new System.EventHandler(this.tsmiTestShapeCapture_Click);
|
||||
//
|
||||
// tsmiTestImageEffects
|
||||
//
|
||||
this.tsmiTestImageEffects.Image = global::ShareX.Properties.Resources.image_saturation;
|
||||
this.tsmiTestImageEffects.Name = "tsmiTestImageEffects";
|
||||
this.tsmiTestImageEffects.Size = new System.Drawing.Size(182, 22);
|
||||
this.tsmiTestImageEffects.Text = "Test image effects...";
|
||||
this.tsmiTestImageEffects.Click += new System.EventHandler(this.tsmiTestImageEffects_Click);
|
||||
//
|
||||
// scMain
|
||||
//
|
||||
this.scMain.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
|
@ -1463,7 +1464,8 @@ private void InitializeComponent()
|
|||
this.tsmiTrayTools.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.tsmiTrayScreenColorPicker,
|
||||
this.tsmiTrayHashCheck,
|
||||
this.tsmiTrayIndexFolder});
|
||||
this.tsmiTrayIndexFolder,
|
||||
this.tsmiTrayImageEffects});
|
||||
this.tsmiTrayTools.Image = global::ShareX.Properties.Resources.toolbox;
|
||||
this.tsmiTrayTools.Name = "tsmiTrayTools";
|
||||
this.tsmiTrayTools.Size = new System.Drawing.Size(188, 22);
|
||||
|
@ -1552,6 +1554,14 @@ private void InitializeComponent()
|
|||
this.ssToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
|
||||
this.ssToolStripMenuItem.Text = "ss";
|
||||
//
|
||||
// tsmiTrayImageEffects
|
||||
//
|
||||
this.tsmiTrayImageEffects.Image = global::ShareX.Properties.Resources.image_saturation;
|
||||
this.tsmiTrayImageEffects.Name = "tsmiTrayImageEffects";
|
||||
this.tsmiTrayImageEffects.Size = new System.Drawing.Size(183, 22);
|
||||
this.tsmiTrayImageEffects.Text = "Image effects...";
|
||||
this.tsmiTrayImageEffects.Click += new System.EventHandler(this.tsmiImageEffects_Click);
|
||||
//
|
||||
// MainForm
|
||||
//
|
||||
this.AllowDrop = true;
|
||||
|
@ -1736,7 +1746,8 @@ private void InitializeComponent()
|
|||
private System.Windows.Forms.ToolStripSeparator tssTray3;
|
||||
private System.Windows.Forms.ToolStripMenuItem tsmiIndexFolder;
|
||||
private System.Windows.Forms.ToolStripMenuItem tsmiTrayIndexFolder;
|
||||
private System.Windows.Forms.ToolStripMenuItem tsmiTestImageEffects;
|
||||
public System.Windows.Forms.Label lblDragAndDropTip;
|
||||
private System.Windows.Forms.ToolStripMenuItem tsmiImageEffects;
|
||||
private System.Windows.Forms.ToolStripMenuItem tsmiTrayImageEffects;
|
||||
}
|
||||
}
|
|
@ -679,13 +679,6 @@ private void tsmiTestShapeCapture_Click(object sender, EventArgs e)
|
|||
new RegionCapturePreview(Program.DefaultTaskSettings.CaptureSettings.SurfaceOptions).Show();
|
||||
}
|
||||
|
||||
private void tsmiTestImageEffects_Click(object sender, EventArgs e)
|
||||
{
|
||||
ImageEffectsForm form = new ImageEffectsForm(ShareXResources.Logo);
|
||||
form.Test();
|
||||
form.Show();
|
||||
}
|
||||
|
||||
private void tsmiScreenRecorderGIF_Click(object sender, EventArgs e)
|
||||
{
|
||||
DoScreenRecorder();
|
||||
|
@ -762,6 +755,13 @@ private void tsmiIndexFolder_Click(object sender, EventArgs e)
|
|||
OpenIndexFolder();
|
||||
}
|
||||
|
||||
private void tsmiImageEffects_Click(object sender, EventArgs e)
|
||||
{
|
||||
ImageEffectsForm form = new ImageEffectsForm(ShareXResources.Logo);
|
||||
form.EditorMode();
|
||||
form.Show();
|
||||
}
|
||||
|
||||
private void tsbScreenshotsFolder_Click(object sender, EventArgs e)
|
||||
{
|
||||
Helpers.OpenFolder(Program.ScreenshotsPath);
|
||||
|
|
|
@ -135,31 +135,30 @@
|
|||
</data>
|
||||
<data name="tsmiIndexFolder.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
|
||||
YQUAAAAZdEVYdFNvZnR3YXJlAEFkb2JlIEltYWdlUmVhZHlxyWU8AAABcElEQVQ4T5WSvUsDQRDFZysr
|
||||
/4EQEQMWwU5tBDEoKUWsBC0C50cUrDzxAxQ0xV0MFiJRSFDQQkGQQCBoI1jYCIkg2iiIgoWFFoFIiGjA
|
||||
cWYvJ+d6xeXBb2eZ5T22eICIEtIkH7bycYvCGsCVAu/4TfocAT7pJE2E/wRoRExBcwuYlu6a2gMAl4bE
|
||||
wHIWv0sZCd95x29qgF86HdJ6AS5isF59O8Svl30J33l3vgINasAMwSG/MxIC/9kybH4872D5YQsrTyl8
|
||||
LZjIO2JODWjiwylzGCC3AKn3uw0s3sSR5/2pjp/VKvJeDViUrpraKO5Yl+yVbhNYvDaQZ/5oHJOPFeS9
|
||||
GtAsnaSBToDdKYt0FMztMThRoX2PGrAq3TXl6D9Mdh4gM/sfCrF8joAWPoQQEA2L+ntAxgSbbToCor4e
|
||||
kKnVGcCM9gnvPSDDEhEkDuwZCYmg5x64MdItvPfADVKj5x64QfLp/ZBUO8AMdcEgIsIPf0PbCdPaFycA
|
||||
AAAASUVORK5CYII=
|
||||
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAABl0RVh0U29m
|
||||
dHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAFwSURBVDhPlZK9SwNBEMVnKyv/gRARAxbBTm0EMSgp
|
||||
RawELQLnRxSsPPEDFDTFXQwWIlFIUNBCQZBAIGgjWNgIiSDaKIiChYUWgUiIaMBxZi8n53rF5cFvZ5nl
|
||||
PbZ4gIgS0iQftvJxi8IawJUC7/hN+hwBPukkTYT/BGhETEFzC5iW7praAwCXhsTAcha/SxkJ33nHb2qA
|
||||
Xzod0noBLmKwXn07xK+XfQnfeXe+Ag1qwAzBIb8zEgL/2TJsfjzvYPlhCytPKXwtmMg7Yk4NaOLDKXMY
|
||||
ILcAqfe7DSzexJHn/amOn9Uq8l4NWJSumtoo7liX7JVuE1i8NpBn/mgck48V5L0a0CydpIFOgN0pi3QU
|
||||
zO0xOFGhfY8asCrdNeXoP0x2HiAz+x8KsXyOgBY+hBAQDYv6e0DGBJttOgKivh6QqdUZwIz2Ce89IMMS
|
||||
ESQO7BkJiaDnHrgx0i2898ANUqPnHrhB8un9kFQ7wAx1wSAiwg9/Q9sJ09oXJwAAAABJRU5ErkJggg==
|
||||
</value>
|
||||
</data>
|
||||
<data name="tsmiShowDebugLog.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
|
||||
YQUAAAAZdEVYdFNvZnR3YXJlAEFkb2JlIEltYWdlUmVhZHlxyWU8AAACQUlEQVQ4T6WTTWsaURiFBf+A
|
||||
+BOycZ9NFBq1RBydOGZmdMRvMX7Exqh1rLHQTaHtulDopohIpSIIIggiuuimMZZYqBBpA3bbZbddnr53
|
||||
pikUsmjSxZn7cu89z33P3BkDgP+SQVGULVKElL+lmGfLIMtybD6fX242G1xdfcV6vcZq9RnL5RKLxQK0
|
||||
hrMzpo9Uf8L5+QoXF18wmXy4ZF6DKIoPZrMZptMpTU4wHo8xGo0wHA4xGAzQ7/fR6/XQ7XbR6XTQbrfR
|
||||
arXQbDZhNBrzLMKR1WqFIAiafD4feJ6H1+uFx+OB2+2Gy+WCw+HAzo4NNtsudnfv03hPB0iSVGDGRqOB
|
||||
er0OVVVRLpdx1HmFbDaLVCoFSZKxt8dgDC7D7w8TlNcBZD5mp9ZqNVQqFRSLReTzeeTev0M8HqfNorbZ
|
||||
4xGpwxDB4giF0tShqAOo1RPWcqlUQqFQQCaTQTKZRP7bDAcHEjhOwP5+gOoIgsEUwuEcgY8JrOgAylfm
|
||||
OA65XA7Z9kvEYjE6IaQBeF5CoFrR6tQbtlagSCUcHlYhy1EdYLfbq9wzFelpG9HXz7XN1wrVVG0MBpO0
|
||||
/larn35fYvTzB80ldADdQI294UAgQPmk3zfAI6iWNUOkUadTyxTrBInEMY26FCWpA7a3t0+dTidl8mtm
|
||||
FkcQAohGjxB9fIp0+iHdxiN6sY2/9AdgsViesO+AdUFxNHGcjyBBiGKYssao3TgZEprpWoIgwWw2qwZ6
|
||||
ZE0m04u7iHlv/MNuoxsn/10w/AIK+CkgW3XoRQAAAABJRU5ErkJggg==
|
||||
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAABl0RVh0U29m
|
||||
dHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAJBSURBVDhPpZNNaxpRGIUF/4D4E7Jxn00UGrVEHJ04
|
||||
ZmZ0xG8xfsTGqHWssdBNoe26UOimiEilIggiCCK66KYxllioEGkDdttlt12evnemKRSyaNLFmfty7z3P
|
||||
fc/cGQOA/5JBUZQtUoSUv6WYZ8sgy3JsPp9fbjYbXF19xXq9xmr1GcvlEovFArSGszOmj1R/wvn5ChcX
|
||||
XzCZfLhkXoMoig9msxmm0ylNTjAejzEajTAcDjEYDNDv99Hr9dDtdtHpdNBut9FqtdBsNmE0GvMswpHV
|
||||
aoUgCJp8Ph94nofX64XH44Hb7YbL5YLD4cDOjg022y52d+/TeE8HSJJUYMZGo4F6vQ5VVVEul3HUeYVs
|
||||
NotUKgVJkrG3x2AMLsPvDxOU1wFkPman1mo1VCoVFItF5PN55N6/Qzwep82ittnjEanDEMHiCIXS1KGo
|
||||
A6jVE9ZyqVRCoVBAJpNBMplE/tsMBwcSOE7A/n6A6giCwRTC4RyBjwms6ADKV+Y4DrlcDtn2S8RiMToh
|
||||
pAF4XkKgWtHq1Bu2VqBIJRweViHLUR1gt9ur3DMV6Wkb0dfPtc3XCtVUbQwGk7T+Vquffl9i9PMHzSV0
|
||||
AN1Ajb3hQCBA+aTfN8AjqJY1Q6RRp1PLFOsEicQxjboUJakDtre3T51OJ2Xya2YWRxACiEaPEH18inT6
|
||||
Id3GI3qxjb/0B2CxWJ6w74B1QXE0cZyPIEGIYpiyxqjdOBkSmulagiDBbDarBnpkTSbTi7uIeW/8w26j
|
||||
Gyf/XTD8Agr4KSBbdehFAAAAAElFTkSuQmCC
|
||||
</value>
|
||||
</data>
|
||||
<metadata name="cmsUploadInfo.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
|
@ -173,15 +172,14 @@
|
|||
</metadata>
|
||||
<data name="tsmiTrayIndexFolder.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>
|
||||
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
|
||||
YQUAAAAZdEVYdFNvZnR3YXJlAEFkb2JlIEltYWdlUmVhZHlxyWU8AAABcElEQVQ4T5WSvUsDQRDFZysr
|
||||
/4EQEQMWwU5tBDEoKUWsBC0C50cUrDzxAxQ0xV0MFiJRSFDQQkGQQCBoI1jYCIkg2iiIgoWFFoFIiGjA
|
||||
cWYvJ+d6xeXBb2eZ5T22eICIEtIkH7bycYvCGsCVAu/4TfocAT7pJE2E/wRoRExBcwuYlu6a2gMAl4bE
|
||||
wHIWv0sZCd95x29qgF86HdJ6AS5isF59O8Svl30J33l3vgINasAMwSG/MxIC/9kybH4872D5YQsrTyl8
|
||||
LZjIO2JODWjiwylzGCC3AKn3uw0s3sSR5/2pjp/VKvJeDViUrpraKO5Yl+yVbhNYvDaQZ/5oHJOPFeS9
|
||||
GtAsnaSBToDdKYt0FMztMThRoX2PGrAq3TXl6D9Mdh4gM/sfCrF8joAWPoQQEA2L+ntAxgSbbToCor4e
|
||||
kKnVGcCM9gnvPSDDEhEkDuwZCYmg5x64MdItvPfADVKj5x64QfLp/ZBUO8AMdcEgIsIPf0PbCdPaFycA
|
||||
AAAASUVORK5CYII=
|
||||
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAABl0RVh0U29m
|
||||
dHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAFwSURBVDhPlZK9SwNBEMVnKyv/gRARAxbBTm0EMSgp
|
||||
RawELQLnRxSsPPEDFDTFXQwWIlFIUNBCQZBAIGgjWNgIiSDaKIiChYUWgUiIaMBxZi8n53rF5cFvZ5nl
|
||||
PbZ4gIgS0iQftvJxi8IawJUC7/hN+hwBPukkTYT/BGhETEFzC5iW7praAwCXhsTAcha/SxkJ33nHb2qA
|
||||
Xzod0noBLmKwXn07xK+XfQnfeXe+Ag1qwAzBIb8zEgL/2TJsfjzvYPlhCytPKXwtmMg7Yk4NaOLDKXMY
|
||||
ILcAqfe7DSzexJHn/amOn9Uq8l4NWJSumtoo7liX7JVuE1i8NpBn/mgck48V5L0a0CydpIFOgN0pi3QU
|
||||
zO0xOFGhfY8asCrdNeXoP0x2HiAz+x8KsXyOgBY+hBAQDYv6e0DGBJttOgKivh6QqdUZwIz2Ce89IMMS
|
||||
ESQO7BkJiaDnHrgx0i2898ANUqPnHrhB8un9kFQ7wAx1wSAiwg9/Q9sJ09oXJwAAAABJRU5ErkJggg==
|
||||
</value>
|
||||
</data>
|
||||
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
|
|
34
ShareX/Forms/TaskSettingsForm.Designer.cs
generated
34
ShareX/Forms/TaskSettingsForm.Designer.cs
generated
|
@ -44,6 +44,8 @@ private void InitializeComponent()
|
|||
this.cmsTask = new System.Windows.Forms.ContextMenuStrip(this.components);
|
||||
this.tcHotkeySettings = new System.Windows.Forms.TabControl();
|
||||
this.tpTask = new System.Windows.Forms.TabPage();
|
||||
this.chkOverrideFTP = new System.Windows.Forms.CheckBox();
|
||||
this.cboFTPaccounts = new System.Windows.Forms.ComboBox();
|
||||
this.btnAfterCapture = new HelpersLib.MenuButton();
|
||||
this.btnAfterUpload = new HelpersLib.MenuButton();
|
||||
this.btnImageUploaders = new HelpersLib.MenuButton();
|
||||
|
@ -224,7 +226,7 @@ private void InitializeComponent()
|
|||
// cbUseDefaultAfterCaptureSettings
|
||||
//
|
||||
this.cbUseDefaultAfterCaptureSettings.AutoSize = true;
|
||||
this.cbUseDefaultAfterCaptureSettings.Location = new System.Drawing.Point(6, 69);
|
||||
this.cbUseDefaultAfterCaptureSettings.Location = new System.Drawing.Point(6, 70);
|
||||
this.cbUseDefaultAfterCaptureSettings.Name = "cbUseDefaultAfterCaptureSettings";
|
||||
this.cbUseDefaultAfterCaptureSettings.Size = new System.Drawing.Size(193, 17);
|
||||
this.cbUseDefaultAfterCaptureSettings.TabIndex = 3;
|
||||
|
@ -235,7 +237,7 @@ private void InitializeComponent()
|
|||
// cbUseDefaultAfterUploadSettings
|
||||
//
|
||||
this.cbUseDefaultAfterUploadSettings.AutoSize = true;
|
||||
this.cbUseDefaultAfterUploadSettings.Location = new System.Drawing.Point(6, 125);
|
||||
this.cbUseDefaultAfterUploadSettings.Location = new System.Drawing.Point(6, 126);
|
||||
this.cbUseDefaultAfterUploadSettings.Name = "cbUseDefaultAfterUploadSettings";
|
||||
this.cbUseDefaultAfterUploadSettings.Size = new System.Drawing.Size(189, 17);
|
||||
this.cbUseDefaultAfterUploadSettings.TabIndex = 5;
|
||||
|
@ -246,7 +248,7 @@ private void InitializeComponent()
|
|||
// cbUseDefaultDestinationSettings
|
||||
//
|
||||
this.cbUseDefaultDestinationSettings.AutoSize = true;
|
||||
this.cbUseDefaultDestinationSettings.Location = new System.Drawing.Point(6, 181);
|
||||
this.cbUseDefaultDestinationSettings.Location = new System.Drawing.Point(6, 182);
|
||||
this.cbUseDefaultDestinationSettings.Name = "cbUseDefaultDestinationSettings";
|
||||
this.cbUseDefaultDestinationSettings.Size = new System.Drawing.Size(185, 17);
|
||||
this.cbUseDefaultDestinationSettings.TabIndex = 7;
|
||||
|
@ -296,6 +298,8 @@ private void InitializeComponent()
|
|||
//
|
||||
// tpTask
|
||||
//
|
||||
this.tpTask.Controls.Add(this.chkOverrideFTP);
|
||||
this.tpTask.Controls.Add(this.cboFTPaccounts);
|
||||
this.tpTask.Controls.Add(this.tbDescription);
|
||||
this.tpTask.Controls.Add(this.btnAfterCapture);
|
||||
this.tpTask.Controls.Add(this.btnAfterUpload);
|
||||
|
@ -317,6 +321,28 @@ private void InitializeComponent()
|
|||
this.tpTask.Text = "Task";
|
||||
this.tpTask.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// chkOverrideFTP
|
||||
//
|
||||
this.chkOverrideFTP.AutoSize = true;
|
||||
this.chkOverrideFTP.Location = new System.Drawing.Point(6, 332);
|
||||
this.chkOverrideFTP.Name = "chkOverrideFTP";
|
||||
this.chkOverrideFTP.Size = new System.Drawing.Size(169, 17);
|
||||
this.chkOverrideFTP.TabIndex = 14;
|
||||
this.chkOverrideFTP.Text = "Override default FTP account:";
|
||||
this.chkOverrideFTP.UseVisualStyleBackColor = true;
|
||||
this.chkOverrideFTP.CheckedChanged += new System.EventHandler(this.chkOverrideFTP_CheckedChanged);
|
||||
//
|
||||
// cboFTPaccounts
|
||||
//
|
||||
this.cboFTPaccounts.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.cboFTPaccounts.Enabled = false;
|
||||
this.cboFTPaccounts.FormattingEnabled = true;
|
||||
this.cboFTPaccounts.Location = new System.Drawing.Point(181, 330);
|
||||
this.cboFTPaccounts.Name = "cboFTPaccounts";
|
||||
this.cboFTPaccounts.Size = new System.Drawing.Size(330, 21);
|
||||
this.cboFTPaccounts.TabIndex = 13;
|
||||
this.cboFTPaccounts.SelectedIndexChanged += new System.EventHandler(this.cboFTPaccounts_SelectedIndexChanged);
|
||||
//
|
||||
// btnAfterCapture
|
||||
//
|
||||
this.btnAfterCapture.Location = new System.Drawing.Point(6, 93);
|
||||
|
@ -1799,6 +1825,8 @@ private void InitializeComponent()
|
|||
private System.Windows.Forms.CheckBox cbImageEffectOnlyRegionCapture;
|
||||
private System.Windows.Forms.GroupBox gbImageEffects;
|
||||
private System.Windows.Forms.CheckBox chkShowImageEffectsWindowAfterCapture;
|
||||
private System.Windows.Forms.CheckBox chkOverrideFTP;
|
||||
private System.Windows.Forms.ComboBox cboFTPaccounts;
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -92,6 +92,18 @@ public TaskSettingsForm(TaskSettings hotkeySetting, bool isDefault = false)
|
|||
SetEnumChecked(TaskSettings.URLShortenerDestination, cmsURLShorteners);
|
||||
SetEnumChecked(TaskSettings.SocialNetworkingServiceDestination, cmsSocialNetworkingServices);
|
||||
|
||||
// FTP
|
||||
if (Program.UploadersConfig != null)
|
||||
{
|
||||
chkOverrideFTP.Checked = TaskSettings.OverrideFTP;
|
||||
cboFTPaccounts.Items.Clear();
|
||||
if (Program.UploadersConfig.FTPAccountList.Count > 0)
|
||||
{
|
||||
cboFTPaccounts.Items.AddRange(Program.UploadersConfig.FTPAccountList.ToArray());
|
||||
cboFTPaccounts.SelectedIndex = TaskSettings.FTPIndex.BetweenOrDefault(0, Program.UploadersConfig.FTPAccountList.Count);
|
||||
}
|
||||
}
|
||||
|
||||
UpdateDestinationStates();
|
||||
UpdateUploaderMenuNames();
|
||||
|
||||
|
@ -210,6 +222,7 @@ private void UpdateDestinationStates()
|
|||
EnableDisableToolStripMenuItems<FileDestination>(cmsFileUploaders);
|
||||
EnableDisableToolStripMenuItems<UrlShortenerType>(cmsURLShorteners);
|
||||
EnableDisableToolStripMenuItems<SocialNetworkingService>(cmsSocialNetworkingServices);
|
||||
chkOverrideFTP.Visible = cboFTPaccounts.Visible = Program.UploadersConfig.FTPAccountList.Count > 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -361,6 +374,17 @@ private void cbUseDefaultDestinationSettings_CheckedChanged(object sender, Event
|
|||
btnSocialNetworkingServices.Enabled = !TaskSettings.UseDefaultDestinations;
|
||||
}
|
||||
|
||||
private void chkOverrideFTP_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
TaskSettings.OverrideFTP = chkOverrideFTP.Checked;
|
||||
cboFTPaccounts.Enabled = TaskSettings.OverrideFTP;
|
||||
}
|
||||
|
||||
private void cboFTPaccounts_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
TaskSettings.FTPIndex = cboFTPaccounts.SelectedIndex;
|
||||
}
|
||||
|
||||
#endregion Task
|
||||
|
||||
#region General
|
||||
|
|
|
@ -48,7 +48,7 @@ public static ImageData PrepareImage(Image img, TaskSettings taskSettings)
|
|||
|
||||
if (taskSettings.ImageSettings.ImageFormat == EImageFormat.JPEG)
|
||||
{
|
||||
img = ImageHelpers.FillImageBackground(img, Color.White);
|
||||
img = ImageHelpers.FillBackground(img, Color.White);
|
||||
}
|
||||
|
||||
ImageHelpers.AddMetadata(img, PropertyTagSoftwareUsed, Program.ApplicationName);
|
||||
|
@ -61,7 +61,7 @@ public static ImageData PrepareImage(Image img, TaskSettings taskSettings)
|
|||
{
|
||||
if (taskSettings.ImageSettings.ImageFormat2 == EImageFormat.JPEG)
|
||||
{
|
||||
img = ImageHelpers.FillImageBackground(img, Color.White);
|
||||
img = ImageHelpers.FillBackground(img, Color.White);
|
||||
}
|
||||
|
||||
imageData.ImageStream = SaveImage(img, taskSettings.ImageSettings.ImageFormat2, taskSettings);
|
||||
|
|
|
@ -51,6 +51,8 @@ public class TaskSettings
|
|||
public FileDestination FileDestination = FileDestination.Dropbox;
|
||||
public UrlShortenerType URLShortenerDestination = UrlShortenerType.BITLY;
|
||||
public SocialNetworkingService SocialNetworkingServiceDestination = SocialNetworkingService.Twitter;
|
||||
public bool OverrideFTP = false;
|
||||
public int FTPIndex = 0;
|
||||
|
||||
public bool UseDefaultGeneralSettings = true;
|
||||
public TaskSettingsGeneral GeneralSettings = new TaskSettingsGeneral();
|
||||
|
|
|
@ -755,7 +755,7 @@ public UploadResult UploadFile(Stream stream, string fileName)
|
|||
}
|
||||
break;
|
||||
case FileDestination.FTP:
|
||||
int index = Program.UploadersConfig.GetFTPIndex(Info.DataType);
|
||||
int index = Info.TaskSettings.OverrideFTP ? Info.TaskSettings.FTPIndex : Program.UploadersConfig.GetFTPIndex(Info.DataType);
|
||||
|
||||
FTPAccount account = Program.UploadersConfig.FTPAccountList.ReturnIfValidIndex(index);
|
||||
|
||||
|
|
|
@ -52,7 +52,7 @@ public class Jira : FileUploader, IOAuth
|
|||
|
||||
private static readonly X509Certificate2 _jiraCertificate;
|
||||
|
||||
private readonly Uri _jiraHost;
|
||||
private readonly string _jiraBaseAddress;
|
||||
private readonly string _jiraIssuePrefix;
|
||||
|
||||
private Uri _jiraRequestToken;
|
||||
|
@ -150,9 +150,9 @@ private static void CalculateAndAppendLength(ref List<byte> binaryData)
|
|||
|
||||
#endregion Keypair
|
||||
|
||||
public Jira(string jiraHost, OAuthInfo oauth, string jiraIssuePrefix = null)
|
||||
public Jira(string jiraBaseAddress, OAuthInfo oauth, string jiraIssuePrefix = null)
|
||||
{
|
||||
_jiraHost = new Uri(jiraHost);
|
||||
_jiraBaseAddress = jiraBaseAddress;
|
||||
AuthInfo = oauth;
|
||||
_jiraIssuePrefix = jiraIssuePrefix;
|
||||
|
||||
|
@ -200,7 +200,7 @@ public override UploadResult Upload(Stream stream, string fileName)
|
|||
};
|
||||
}
|
||||
|
||||
Uri uri = new Uri(_jiraHost, string.Format(PathIssueAttachments, up.IssueId));
|
||||
Uri uri = this.Combine(_jiraBaseAddress, string.Format(PathIssueAttachments, up.IssueId));
|
||||
string query = OAuthManager.GenerateQuery(uri.ToString(), null, HttpMethod.Post, AuthInfo);
|
||||
|
||||
NameValueCollection headers = new NameValueCollection();
|
||||
|
@ -217,7 +217,7 @@ public override UploadResult Upload(Stream stream, string fileName)
|
|||
var anonType = new[] { new { thumbnail = "" } };
|
||||
var anonObject = JsonConvert.DeserializeAnonymousType(res.Response, anonType);
|
||||
res.ThumbnailURL = anonObject[0].thumbnail;
|
||||
res.URL = new Uri(_jiraHost, string.Format(PathBrowseIssue, up.IssueId)).ToString();
|
||||
res.URL = this.Combine(_jiraBaseAddress, string.Format(PathBrowseIssue, up.IssueId)).ToString();
|
||||
}
|
||||
|
||||
return res;
|
||||
|
@ -248,10 +248,15 @@ private string GetSummary(string issueId)
|
|||
|
||||
private void InitUris()
|
||||
{
|
||||
_jiraRequestToken = new Uri(_jiraHost, PathRequestToken);
|
||||
_jiraAuthorize = new Uri(_jiraHost, PathAuthorize);
|
||||
_jiraAccessToken = new Uri(_jiraHost, PathAccessToken);
|
||||
_jiraPathSearch = new Uri(_jiraHost, PathSearch);
|
||||
_jiraRequestToken = this.Combine(_jiraBaseAddress, PathRequestToken);
|
||||
_jiraAuthorize = this.Combine(_jiraBaseAddress, PathAuthorize);
|
||||
_jiraAccessToken = this.Combine(_jiraBaseAddress, PathAccessToken);
|
||||
_jiraPathSearch = this.Combine(_jiraBaseAddress, PathSearch);
|
||||
}
|
||||
|
||||
private Uri Combine(string path1, string path2)
|
||||
{
|
||||
return new Uri(path1.TrimEnd('/') + path2);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -38,13 +38,15 @@ public override object EditValue(ITypeDescriptorContext context, IServiceProvide
|
|||
{
|
||||
return base.EditValue(context, provider, value);
|
||||
}
|
||||
OpenFileDialog dlg = new OpenFileDialog();
|
||||
using (OpenFileDialog dlg = new OpenFileDialog())
|
||||
{
|
||||
dlg.Title = "Browse for a certificate file...";
|
||||
dlg.Filter = "Certification (*.cer)|*.cer";
|
||||
if (dlg.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
value = dlg.FileName;
|
||||
}
|
||||
}
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,13 +38,15 @@ public override object EditValue(ITypeDescriptorContext context, IServiceProvide
|
|||
{
|
||||
return base.EditValue(context, provider, value);
|
||||
}
|
||||
OpenFileDialog dlg = new OpenFileDialog();
|
||||
using (OpenFileDialog dlg = new OpenFileDialog())
|
||||
{
|
||||
dlg.Title = "Browse for a key File...";
|
||||
dlg.Filter = "Keyfile (*.*)|*.*";
|
||||
if (dlg.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
value = dlg.FileName;
|
||||
}
|
||||
}
|
||||
return value;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue