mirror of
https://github.com/ShareX/ShareX.git
synced 2024-06-28 19:20:27 +12:00
Automatically migrate old custom uploader syntax to new syntax
This commit is contained in:
parent
76ec7f2593
commit
9e808d0489
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Package xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10" xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10" xmlns:uap2="http://schemas.microsoft.com/appx/manifest/uap/windows10/2" xmlns:uap3="http://schemas.microsoft.com/appx/manifest/uap/windows10/3" xmlns:rescap="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities" xmlns:desktop="http://schemas.microsoft.com/appx/manifest/desktop/windows10" xmlns:desktop2="http://schemas.microsoft.com/appx/manifest/desktop/windows10/2" IgnorableNamespaces="desktop2">
|
||||
<Identity Name="19568ShareX.ShareX" ProcessorArchitecture="x64" Publisher="CN=366A5DE5-2EC7-43FD-B559-05986578C4CC" Version="13.7.0.0" />
|
||||
<Identity Name="19568ShareX.ShareX" ProcessorArchitecture="x64" Publisher="CN=366A5DE5-2EC7-43FD-B559-05986578C4CC" Version="13.7.2.0" />
|
||||
<Properties>
|
||||
<DisplayName>ShareX</DisplayName>
|
||||
<PublisherDisplayName>ShareX Team</PublisherDisplayName>
|
||||
|
|
|
@ -30,6 +30,8 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Collections.Specialized;
|
||||
using System.ComponentModel;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace ShareX.UploadersLib
|
||||
|
@ -409,10 +411,74 @@ public void CheckBackwardCompatibility()
|
|||
|
||||
ResponseType = ResponseType.Text;
|
||||
|
||||
Version = "13.7.1";
|
||||
}
|
||||
|
||||
if (Helpers.CompareVersion(Version, "13.7.1") <= 0)
|
||||
{
|
||||
RequestURL = MigrateOldSyntax(RequestURL);
|
||||
|
||||
if (Parameters != null)
|
||||
{
|
||||
foreach (string key in Parameters.Keys.ToList())
|
||||
{
|
||||
Parameters[key] = MigrateOldSyntax(Parameters[key]);
|
||||
}
|
||||
}
|
||||
|
||||
if (Headers != null)
|
||||
{
|
||||
foreach (string key in Headers.Keys.ToList())
|
||||
{
|
||||
Headers[key] = MigrateOldSyntax(Headers[key]);
|
||||
}
|
||||
}
|
||||
|
||||
if (Arguments != null)
|
||||
{
|
||||
foreach (string key in Arguments.Keys.ToList())
|
||||
{
|
||||
Arguments[key] = MigrateOldSyntax(Arguments[key]);
|
||||
}
|
||||
}
|
||||
|
||||
Data = MigrateOldSyntax(Data);
|
||||
URL = MigrateOldSyntax(URL);
|
||||
ThumbnailURL = MigrateOldSyntax(ThumbnailURL);
|
||||
DeletionURL = MigrateOldSyntax(DeletionURL);
|
||||
ErrorMessage = MigrateOldSyntax(ErrorMessage);
|
||||
|
||||
Version = Application.ProductVersion;
|
||||
}
|
||||
}
|
||||
|
||||
private string MigrateOldSyntax(string input)
|
||||
{
|
||||
if (string.IsNullOrEmpty(input))
|
||||
{
|
||||
return input;
|
||||
}
|
||||
|
||||
StringBuilder sbInput = new StringBuilder(input);
|
||||
|
||||
bool start = true;
|
||||
|
||||
for (int i = 0; i < input.Length; i++)
|
||||
{
|
||||
if (input[i] == '$')
|
||||
{
|
||||
sbInput[i] = start ? '{' : '}';
|
||||
start = !start;
|
||||
}
|
||||
else if (input[i] == '\\')
|
||||
{
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
return sbInput.ToString();
|
||||
}
|
||||
|
||||
private void CheckRequestURL()
|
||||
{
|
||||
if (!string.IsNullOrEmpty(RequestURL))
|
||||
|
|
|
@ -30,5 +30,5 @@
|
|||
[assembly: AssemblyProduct("ShareX")]
|
||||
[assembly: AssemblyCopyright("Copyright (c) 2007-2022 ShareX Team")]
|
||||
[assembly: ComVisible(false)]
|
||||
[assembly: AssemblyVersion("13.7.1")]
|
||||
[assembly: AssemblyFileVersion("13.7.1")]
|
||||
[assembly: AssemblyVersion("13.7.2")]
|
||||
[assembly: AssemblyFileVersion("13.7.2")]
|
Loading…
Reference in a new issue