mirror of
https://github.com/ShareX/ShareX.git
synced 2024-10-01 09:47:22 +13:00
fixed #161: Picture box error issue
fixed #233: FTP name parsing consistency
This commit is contained in:
parent
ad3fe1f167
commit
3b8ea5379d
9 changed files with 71 additions and 13 deletions
|
@ -144,6 +144,7 @@ public MyPictureBox()
|
|||
InitializeComponent();
|
||||
Text = string.Empty;
|
||||
pbMain.InitialImage = Resources.Loading;
|
||||
pbMain.ErrorImage = Resources.cross;
|
||||
pbMain.LoadProgressChanged += pbMain_LoadProgressChanged;
|
||||
pbMain.LoadCompleted += pbMain_LoadCompleted;
|
||||
pbMain.Resize += pbMain_Resize;
|
||||
|
@ -237,13 +238,23 @@ private void LoadImageAsync(string path)
|
|||
|
||||
public void Reset()
|
||||
{
|
||||
if (!isImageLoading)
|
||||
if (!isImageLoading && Image != null)
|
||||
{
|
||||
if (Image != null)
|
||||
Image temp = null;
|
||||
|
||||
try
|
||||
{
|
||||
Image.Dispose();
|
||||
temp = Image;
|
||||
Image = null;
|
||||
}
|
||||
finally
|
||||
{
|
||||
// If error happened in previous image load then PictureBox set image as error image and if we dispose it then error happens.
|
||||
if (temp != null && temp != pbMain.ErrorImage)
|
||||
{
|
||||
temp.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (FullscreenOnClick && Cursor != Cursors.Default)
|
||||
|
|
|
@ -430,6 +430,9 @@
|
|||
<ItemGroup>
|
||||
<None Include="Resources\ShareX_Logo.png" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Resources\cross.png" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
|
|
10
HelpersLib/Properties/Resources.Designer.cs
generated
10
HelpersLib/Properties/Resources.Designer.cs
generated
|
@ -60,6 +60,16 @@ internal Resources() {
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
internal static System.Drawing.Bitmap cross {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("cross", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.Byte[].
|
||||
/// </summary>
|
||||
|
|
|
@ -112,12 +112,12 @@
|
|||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<data name="Loading" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\Loading.gif;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
|
@ -133,4 +133,7 @@
|
|||
<data name="ShareX_Logo" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\ShareX_Logo.png;System.Drawing.Bitmap, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="cross" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\cross.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
</root>
|
BIN
HelpersLib/Resources/cross.png
Normal file
BIN
HelpersLib/Resources/cross.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.1 KiB |
|
@ -1,4 +1,29 @@
|
|||
using HelpersLib;
|
||||
#region License Information (GPL v3)
|
||||
|
||||
/*
|
||||
ShareX - A program that allows you to take screenshots and share any file type
|
||||
Copyright (C) 2007-2014 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;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
|
|
|
@ -110,7 +110,8 @@ public override UploadResult Upload(Stream stream, string fileName)
|
|||
UploadResult result = new UploadResult();
|
||||
|
||||
fileName = Helpers.GetValidURL(fileName);
|
||||
string path = Account.GetSubFolderPath(fileName);
|
||||
string subFolderPath = Account.GetSubFolderPath();
|
||||
string path = subFolderPath.CombineURL(fileName);
|
||||
bool uploadResult;
|
||||
|
||||
try
|
||||
|
@ -126,7 +127,7 @@ public override UploadResult Upload(Stream stream, string fileName)
|
|||
|
||||
if (uploadResult && !StopUploadRequested && !IsError)
|
||||
{
|
||||
result.URL = Account.GetUriPath(fileName);
|
||||
result.URL = Account.GetUriPath(fileName, subFolderPath);
|
||||
}
|
||||
|
||||
return result;
|
||||
|
|
|
@ -158,7 +158,7 @@ public string GetHttpHomePath()
|
|||
return NameParser.Parse(NameParserType.URL, HttpHomePath.Replace("%host", Host));
|
||||
}
|
||||
|
||||
public string GetUriPath(string filename)
|
||||
public string GetUriPath(string filename, string subFolderPath = null)
|
||||
{
|
||||
if (string.IsNullOrEmpty(Host))
|
||||
{
|
||||
|
@ -172,7 +172,11 @@ public string GetUriPath(string filename)
|
|||
|
||||
filename = URLHelpers.URLEncode(filename);
|
||||
|
||||
string subFolderPath = GetSubFolderPath();
|
||||
if (subFolderPath == null)
|
||||
{
|
||||
subFolderPath = GetSubFolderPath();
|
||||
}
|
||||
|
||||
subFolderPath = URLHelpers.URLPathEncode(subFolderPath);
|
||||
|
||||
string httpHomePath = GetHttpHomePath();
|
||||
|
|
|
@ -68,7 +68,8 @@ public override UploadResult Upload(Stream stream, string fileName)
|
|||
UploadResult result = new UploadResult();
|
||||
|
||||
fileName = Helpers.GetValidURL(fileName);
|
||||
string path = Account.GetSubFolderPath(fileName);
|
||||
string subFolderPath = Account.GetSubFolderPath();
|
||||
string path = subFolderPath.CombineURL(fileName);
|
||||
bool uploadResult;
|
||||
|
||||
try
|
||||
|
@ -84,7 +85,7 @@ public override UploadResult Upload(Stream stream, string fileName)
|
|||
|
||||
if (uploadResult && !StopUploadRequested && !IsError)
|
||||
{
|
||||
result.URL = Account.GetUriPath(fileName);
|
||||
result.URL = Account.GetUriPath(fileName, subFolderPath);
|
||||
}
|
||||
|
||||
return result;
|
||||
|
|
Loading…
Reference in a new issue