Merge branch 'develop' of https://github.com/EricTetz/ShareX into develop

This commit is contained in:
Eric Tetz 2022-01-31 18:06:33 -07:00
commit 992e462383
25 changed files with 814 additions and 32 deletions

View file

@ -177,4 +177,7 @@
<data name="tsbShowStats.Text" xml:space="preserve">
<value>Показать статистику...</value>
</data>
<data name="btnAdvancedSearchClose.Text" xml:space="preserve">
<value>Закрыть</value>
</data>
</root>

View file

@ -230,20 +230,19 @@ public DirectShowDevices GetDirectShowDevices()
string output = Output.ToString();
string[] lines = output.Lines();
bool isVideo = true;
Regex regex = new Regex(@"\[dshow @ \w+\] ""(.+)""", RegexOptions.Compiled | RegexOptions.CultureInvariant);
bool isAudio = false;
Regex regex = new Regex(@"\[dshow @ \w+\] +""(.+)""", RegexOptions.Compiled | RegexOptions.CultureInvariant);
foreach (string line in lines)
{
if (line.Contains("] DirectShow video devices", StringComparison.InvariantCulture))
if (line.Contains("] DirectShow video devices"))
{
isVideo = true;
isAudio = false;
continue;
}
if (line.Contains("] DirectShow audio devices", StringComparison.InvariantCulture))
else if (line.Contains("] DirectShow audio devices"))
{
isVideo = false;
isAudio = true;
continue;
}
@ -251,15 +250,24 @@ public DirectShowDevices GetDirectShowDevices()
if (match.Success)
{
string value = match.Groups[1].Value;
if (isVideo)
if (line.EndsWith("\" (video)"))
{
devices.VideoDevices.Add(value);
isAudio = false;
}
else if (line.EndsWith("\" (audio)"))
{
isAudio = true;
}
string deviceName = match.Groups[1].Value;
if (isAudio)
{
devices.AudioDevices.Add(deviceName);
}
else
{
devices.AudioDevices.Add(value);
devices.VideoDevices.Add(deviceName);
}
}
}

View file

@ -138,4 +138,7 @@
<data name="btnCancel.Text" xml:space="preserve">
<value>Отменить</value>
</data>
<data name="cbtnCanvasColor.Text" xml:space="preserve">
<value>Цвет полотна...</value>
</data>
</root>

View file

@ -629,6 +629,15 @@ internal class Resources {
}
}
/// <summary>
/// Looks up a localized string similar to FPS limit:.
/// </summary>
internal static string FPSLimit {
get {
return ResourceManager.GetString("FPSLimit", resourceCulture);
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>

View file

@ -792,4 +792,7 @@ X: {4} Y: {5}</value>
<data name="AutoCopyImageToClipboard" xml:space="preserve">
<value>Auto copy image to clipboard</value>
</data>
<data name="FPSLimit" xml:space="preserve">
<value>FPS limit:</value>
</data>
</root>

View file

@ -478,4 +478,7 @@
<data name="AutoCopyImageToClipboard" xml:space="preserve">
<value>Автоматически копировать изображение в буфер обмена</value>
</data>
<data name="FPSLimit" xml:space="preserve">
<value>Лимит FPS:</value>
</data>
</root>

View file

@ -989,8 +989,7 @@ internal void CreateToolbar()
};
tsddbOptions.DropDownItems.Add(tsmiShowFPS);
// TODO: Translate
ToolStripLabeledNumericUpDown tslnudFPSLimit = new ToolStripLabeledNumericUpDown("FPS limit:");
ToolStripLabeledNumericUpDown tslnudFPSLimit = new ToolStripLabeledNumericUpDown(Resources.FPSLimit);
tslnudFPSLimit.Content.Minimum = 0;
tslnudFPSLimit.Content.Maximum = 300;
tslnudFPSLimit.Content.Value = Options.FPSLimit;

View file

@ -0,0 +1,134 @@
#region License Information (GPL v3)
/*
ShareX - A program that allows you to take screenshots and share any file type
Copyright (c) 2007-2022 ShareX Team
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 ShareX.HelpersLib;
using System;
using System.Collections.Generic;
using System.Text;
namespace ShareX.UploadersLib
{
public class CustomUploaderParser2
{
private static IEnumerable<CustomUploaderFunction> Functions = Helpers.GetInstances<CustomUploaderFunction>();
public char SyntaxStart { get; private set; } = '{';
public char SyntaxEnd { get; private set; } = '}';
public char SyntaxParameterStart { get; private set; } = ':';
public char SyntaxParameterDelimiter { get; private set; } = '|';
public char SyntaxEscape { get; private set; } = '\\';
public string FileName { get; set; }
public string Input { get; set; }
public ResponseInfo ResponseInfo { get; set; }
public List<string> RegexList { get; set; }
public bool URLEncode { get; set; } // Only URL encodes file name and input
public string Parse(string text)
{
return ParseSyntax(text, 0, out _);
}
private string ParseSyntax(string text, int startPosition, out int endPosition)
{
endPosition = startPosition;
if (string.IsNullOrEmpty(text))
{
return "";
}
StringBuilder sbResult = new StringBuilder();
bool escape = false;
for (int i = startPosition; i < text.Length; i++)
{
if (!escape)
{
if (text[i] == SyntaxStart)
{
string parsed = ParseSyntax(text, i + 1, out i);
parsed = ParseFunction(parsed);
sbResult.Append(parsed);
continue;
}
else if (text[i] == SyntaxEnd)
{
endPosition = i;
return sbResult.ToString();
}
else if (text[i] == SyntaxEscape)
{
escape = true;
continue;
}
}
else
{
escape = false;
}
sbResult.Append(text[i]);
}
return sbResult.ToString();
}
private string ParseFunction(string text)
{
string functionName;
string[] parameterArray = null;
int parameterPosition = text.IndexOf(SyntaxParameterStart);
if (parameterPosition >= 0)
{
functionName = text.Remove(parameterPosition);
string parameters = text.Substring(parameterPosition + 1);
// TODO: Support delimiter escape
parameterArray = parameters.Split(SyntaxParameterDelimiter);
}
else
{
functionName = text;
}
return CallFunction(functionName, parameterArray);
}
private string CallFunction(string functionName, string[] parameters)
{
foreach (CustomUploaderFunction function in Functions)
{
if (function.Name.Equals(functionName, StringComparison.InvariantCultureIgnoreCase))
{
return function.Call(this, parameters);
}
}
throw new Exception("Invalid function name: " + functionName);
}
}
}

View file

@ -0,0 +1,34 @@
#region License Information (GPL v3)
/*
ShareX - A program that allows you to take screenshots and share any file type
Copyright (c) 2007-2022 ShareX Team
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)
namespace ShareX.UploadersLib
{
internal abstract class CustomUploaderFunction
{
public abstract string Name { get; }
public abstract string Call(CustomUploaderParser2 parser, string[] parameters);
}
}

View file

@ -0,0 +1,46 @@
#region License Information (GPL v3)
/*
ShareX - A program that allows you to take screenshots and share any file type
Copyright (c) 2007-2022 ShareX Team
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 ShareX.HelpersLib;
namespace ShareX.UploadersLib
{
internal class CustomUploaderFunctionBase64 : CustomUploaderFunction
{
public override string Name { get; } = "base64";
public override string Call(CustomUploaderParser2 parser, string[] parameters)
{
string text = parameters[0];
if (!string.IsNullOrEmpty(text))
{
return TranslatorHelper.TextToBase64(text);
}
return null;
}
}
}

View file

@ -0,0 +1,44 @@
#region License Information (GPL v3)
/*
ShareX - A program that allows you to take screenshots and share any file type
Copyright (c) 2007-2022 ShareX Team
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 ShareX.HelpersLib;
namespace ShareX.UploadersLib
{
internal class CustomUploaderFunctionFileName : CustomUploaderFunction
{
public override string Name { get; } = "filename";
public override string Call(CustomUploaderParser2 parser, string[] parameters)
{
if (parser.URLEncode)
{
return URLHelpers.URLEncode(parser.FileName);
}
return parser.FileName;
}
}
}

View file

@ -0,0 +1,44 @@
#region License Information (GPL v3)
/*
ShareX - A program that allows you to take screenshots and share any file type
Copyright (c) 2007-2022 ShareX Team
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)
namespace ShareX.UploadersLib
{
internal class CustomUploaderFunctionHeader : CustomUploaderFunction
{
public override string Name { get; } = "header";
public override string Call(CustomUploaderParser2 parser, string[] parameters)
{
string header = parameters[0];
if (parser.ResponseInfo.Headers != null)
{
return parser.ResponseInfo.Headers[header];
}
return null;
}
}
}

View file

@ -0,0 +1,44 @@
#region License Information (GPL v3)
/*
ShareX - A program that allows you to take screenshots and share any file type
Copyright (c) 2007-2022 ShareX Team
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 ShareX.HelpersLib;
namespace ShareX.UploadersLib
{
internal class CustomUploaderFunctionInput : CustomUploaderFunction
{
public override string Name { get; } = "input";
public override string Call(CustomUploaderParser2 parser, string[] parameters)
{
if (parser.URLEncode)
{
return URLHelpers.URLEncode(parser.Input);
}
return parser.Input;
}
}
}

View file

@ -0,0 +1,51 @@
#region License Information (GPL v3)
/*
ShareX - A program that allows you to take screenshots and share any file type
Copyright (c) 2007-2022 ShareX Team
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 Newtonsoft.Json.Linq;
namespace ShareX.UploadersLib
{
internal class CustomUploaderFunctionJson : CustomUploaderFunction
{
public override string Name { get; } = "json";
public override string Call(CustomUploaderParser2 parser, string[] parameters)
{
string jsonPath = parameters[0];
if (!string.IsNullOrEmpty(jsonPath))
{
if (!jsonPath.StartsWith("$."))
{
jsonPath = "$." + jsonPath;
}
return (string)JToken.Parse(parser.ResponseInfo.ResponseText).SelectToken(jsonPath);
}
return null;
}
}
}

View file

@ -0,0 +1,60 @@
#region License Information (GPL v3)
/*
ShareX - A program that allows you to take screenshots and share any file type
Copyright (c) 2007-2022 ShareX Team
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 ShareX.HelpersLib;
using System.Windows.Forms;
namespace ShareX.UploadersLib
{
internal class CustomUploaderFunctionPrompt : CustomUploaderFunction
{
public override string Name { get; } = "prompt";
public override string Call(CustomUploaderParser2 parser, string[] parameters)
{
string title = "ShareX - Prompt", defaultValue = "";
if (parameters.Length > 0)
{
title = parameters[0];
if (parameters.Length > 1)
{
defaultValue = parameters[1];
}
}
using (InputBox inputBox = new InputBox(title, defaultValue))
{
if (inputBox.ShowDialog() == DialogResult.OK)
{
return inputBox.InputText;
}
}
return defaultValue;
}
}
}

View file

@ -0,0 +1,44 @@
#region License Information (GPL v3)
/*
ShareX - A program that allows you to take screenshots and share any file type
Copyright (c) 2007-2022 ShareX Team
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 ShareX.HelpersLib;
namespace ShareX.UploadersLib
{
internal class CustomUploaderFunctionRandom : CustomUploaderFunction
{
public override string Name { get; } = "random";
public override string Call(CustomUploaderParser2 parser, string[] parameters)
{
if (parameters.Length > 0)
{
return RandomFast.Pick(parameters);
}
return null;
}
}
}

View file

@ -0,0 +1,64 @@
#region License Information (GPL v3)
/*
ShareX - A program that allows you to take screenshots and share any file type
Copyright (c) 2007-2022 ShareX Team
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 System.Text.RegularExpressions;
namespace ShareX.UploadersLib
{
internal class CustomUploaderFunctionRegex : CustomUploaderFunction
{
public override string Name { get; } = "regex";
public override string Call(CustomUploaderParser2 parser, string[] parameters)
{
if (parameters.Length > 0)
{
string regexIndex = parameters[0];
if (!string.IsNullOrEmpty(regexIndex) && int.TryParse(regexIndex, out int regexIndexNumber))
{
string pattern = parser.RegexList[regexIndexNumber - 1];
Match match = Regex.Match(parser.ResponseInfo.ResponseText, pattern);
if (parameters.Length > 1)
{
string regexGroup = parameters[1];
if (!string.IsNullOrEmpty(regexGroup) && int.TryParse(regexGroup, out int regexGroupNumber))
{
return match.Groups[regexGroupNumber].Value;
}
return match.Groups[regexGroup].Value;
}
return match.Value;
}
}
return null;
}
}
}

View file

@ -0,0 +1,37 @@
#region License Information (GPL v3)
/*
ShareX - A program that allows you to take screenshots and share any file type
Copyright (c) 2007-2022 ShareX Team
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)
namespace ShareX.UploadersLib
{
internal class CustomUploaderFunctionResponse : CustomUploaderFunction
{
public override string Name { get; } = "response";
public override string Call(CustomUploaderParser2 parser, string[] parameters)
{
return parser.ResponseInfo.ResponseText;
}
}
}

View file

@ -0,0 +1,37 @@
#region License Information (GPL v3)
/*
ShareX - A program that allows you to take screenshots and share any file type
Copyright (c) 2007-2022 ShareX Team
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)
namespace ShareX.UploadersLib
{
internal class CustomUploaderFunctionResponseURL : CustomUploaderFunction
{
public override string Name { get; } = "responseurl";
public override string Call(CustomUploaderParser2 parser, string[] parameters)
{
return parser.ResponseInfo.ResponseURL;
}
}
}

View file

@ -0,0 +1,50 @@
#region License Information (GPL v3)
/*
ShareX - A program that allows you to take screenshots and share any file type
Copyright (c) 2007-2022 ShareX Team
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 System.Linq;
namespace ShareX.UploadersLib
{
internal class CustomUploaderFunctionSelect : CustomUploaderFunction
{
public override string Name { get; } = "select";
public override string Call(CustomUploaderParser2 parser, string[] parameters)
{
string[] values = parameters.Where(x => !string.IsNullOrEmpty(x)).ToArray();
if (values.Length > 0)
{
using (ParserSelectForm form = new ParserSelectForm(values))
{
form.ShowDialog();
return form.SelectedText;
}
}
return null;
}
}
}

View file

@ -0,0 +1,57 @@
#region License Information (GPL v3)
/*
ShareX - A program that allows you to take screenshots and share any file type
Copyright (c) 2007-2022 ShareX Team
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 System.IO;
using System.Xml.XPath;
namespace ShareX.UploadersLib
{
internal class CustomUploaderFunctionXml : CustomUploaderFunction
{
public override string Name { get; } = "xml";
public override string Call(CustomUploaderParser2 parser, string[] parameters)
{
string xpath = parameters[0];
if (!string.IsNullOrEmpty(xpath))
{
using (StringReader sr = new StringReader(parser.ResponseInfo.ResponseText))
{
XPathDocument doc = new XPathDocument(sr);
XPathNavigator nav = doc.CreateNavigator();
XPathNavigator node = nav.SelectSingleNode(xpath);
if (node != null)
{
return node.Value;
}
}
}
return null;
}
}
}

View file

@ -23,7 +23,6 @@
#endregion License Information (GPL v3)
using System.Collections.Generic;
using System.IO;
namespace ShareX.UploadersLib.FileUploaders
@ -42,23 +41,9 @@ public override GenericUploader CreateUploader(UploadersConfig config, TaskRefer
public class Uguu : FileUploader
{
public bool RandomName { get; set; }
public string CustomName { get; set; }
public override UploadResult Upload(Stream stream, string fileName)
{
Dictionary<string, string> arguments = new Dictionary<string, string>();
if (RandomName)
{
arguments.Add("randomname", "on");
}
else if (!string.IsNullOrEmpty(CustomName))
{
arguments.Add("name", CustomName);
}
UploadResult result = SendRequestFile("https://uguu.se/api.php?d=upload-tool", stream, fileName, "file", arguments);
UploadResult result = SendRequestFile("https://uguu.se/upload.php?output=text", stream, fileName, "files[]");
if (result.IsSuccess)
{

View file

@ -125,6 +125,20 @@
<Compile Include="BaseServices\IUploaderService.cs" />
<Compile Include="BaseUploaders\GenericUploader.cs" />
<Compile Include="BaseUploaders\URLSharer.cs" />
<Compile Include="CustomUploader\Functions\CustomUploaderFunction.cs" />
<Compile Include="CustomUploader\Functions\CustomUploaderFunctionBase64.cs" />
<Compile Include="CustomUploader\Functions\CustomUploaderFunctionFileName.cs" />
<Compile Include="CustomUploader\Functions\CustomUploaderFunctionInput.cs" />
<Compile Include="CustomUploader\Functions\CustomUploaderFunctionResponseURL.cs" />
<Compile Include="CustomUploader\Functions\CustomUploaderFunctionResponse.cs" />
<Compile Include="CustomUploader\Functions\CustomUploaderFunctionPrompt.cs" />
<Compile Include="CustomUploader\Functions\CustomUploaderFunctionSelect.cs" />
<Compile Include="CustomUploader\Functions\CustomUploaderFunctionRandom.cs" />
<Compile Include="CustomUploader\Functions\CustomUploaderFunctionXml.cs" />
<Compile Include="CustomUploader\Functions\CustomUploaderFunctionHeader.cs" />
<Compile Include="CustomUploader\Functions\CustomUploaderFunctionRegex.cs" />
<Compile Include="CustomUploader\Functions\CustomUploaderFunctionJson.cs" />
<Compile Include="CustomUploader\CustomUploaderParser2.cs" />
<Compile Include="FileUploaders\AmazonS3.cs" />
<Compile Include="FileUploaders\AmazonS3Endpoint.cs" />
<Compile Include="FileUploaders\AmazonS3Settings.cs" />

View file

@ -633,4 +633,10 @@
<data name="cbURLRegexReplace.Text" xml:space="preserve">
<value>Заменить URL результата через регулярные выражения</value>
</data>
<data name="lblRegionCaptureFPSLimit.Text" xml:space="preserve">
<value>Лимит FPS:</value>
</data>
<data name="cbToastWindowAutoHide.Text" xml:space="preserve">
<value>Автоматически прятать при захвате экрана</value>
</data>
</root>

View file

@ -561,8 +561,8 @@
<data name="ShareXIsMinimizedToTheSystemTray" xml:space="preserve">
<value>ShareX свернут в системный трей.</value>
</data>
<data name="YourAntiVirusSoftwareOrTheControlledFolderAccessFeatureInWindows10CouldBeBlockingShareX" xml:space="preserve">
<value>Ваш анитвирус или контролируемый доступ к файлам в Windows 10 могут блокировать ShareX.</value>
<data name="YourAntiVirusSoftwareOrTheControlledFolderAccessFeatureInWindowsCouldBeBlockingShareX" xml:space="preserve">
<value>Ваш анитвирус или контролируемый доступ к файлам в Windows могут блокировать ShareX.</value>
</data>
<data name="FailedToSaveSettings" xml:space="preserve">
<value>Не удалось сохранить настройки</value>
@ -646,4 +646,7 @@
<data name="YourSystemAdminDisabledTheUploadFeature" xml:space="preserve">
<value>Ваш системный администратор отключил возможность загрузки.</value>
</data>
<data name="ImageData_Write_Error_Message" xml:space="preserve">
<value>Не удалось сохранить изображение по пути:</value>
</data>
</root>