get rid of system.web and system.web.extensions #1705

This commit is contained in:
Faryan Rezagholi
2020-06-01 00:38:52 +02:00
parent 56bb513bdc
commit e39db26c13
4 changed files with 14 additions and 23 deletions

View File

@@ -1,10 +1,11 @@
using System.Collections.Generic;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Linq;
using System.Web;
using mRemoteNG.Connection;
using mRemoteNG.Tree.Root;
using System.Text;
using System.Net;
// ReSharper disable ArrangeAccessorOwnerBody
@@ -54,7 +55,7 @@ namespace mRemoteNG.Config.Putty
var currentlyKnownSessionNames = Sessions.Select(session => session.Name);
var normalizedSessionNames =
sessionNamesFromProvider.Select(name =>
HttpUtility.UrlDecode(name, Encoding.GetEncoding("iso-8859-1")));
WebUtility.UrlDecode(name));
var sessionNamesToRemove = currentlyKnownSessionNames.Except(normalizedSessionNames);
return Sessions.Where(session => sessionNamesToRemove.Contains(session.Name));
}

View File

@@ -1,6 +1,7 @@
using System;
using System;
using System.Collections.Generic;
using System.Management;
using System.Net;
using System.Security.Principal;
using System.Text;
using System.Web;
@@ -28,10 +29,8 @@ namespace mRemoteNG.Config.Putty
var sessionNames = new List<string>();
foreach (var sessionName in sessionsKey.GetSubKeyNames())
{
sessionNames.Add(raw
? sessionName
: HttpUtility.UrlDecode(sessionName.Replace("+", "%2B"),
Encoding.GetEncoding("iso-8859-1")));
sessionNames.Add(raw ? sessionName
: WebUtility.UrlDecode(sessionName.Replace("+", "%2B")));
}
if (raw && !sessionNames.Contains("Default%20Settings"))
@@ -51,7 +50,7 @@ namespace mRemoteNG.Config.Putty
var sessionKey = sessionsKey?.OpenSubKey(sessionName);
if (sessionKey == null) return null;
sessionName = HttpUtility.UrlDecode(sessionName.Replace("+", "%2B"), Encoding.GetEncoding("iso-8859-1"));
sessionName = WebUtility.UrlDecode(sessionName.Replace("+", "%2B"));
var sessionInfo = new PuttySessionInfo
{

View File

@@ -9,6 +9,7 @@ using System.Linq;
using System.Text.RegularExpressions;
using mRemoteNG.Tree.Root;
using System.Web;
using System.Net;
namespace mRemoteNG.Config.Putty
{
@@ -40,31 +41,23 @@ namespace mRemoteNG.Config.Putty
{
var sessionFileName = Path.GetFileName(sessionName);
// ReSharper disable once ConstantConditionalAccessQualifier
sessionNames.Add(raw
? sessionFileName
: System.Web.HttpUtility.UrlDecode(sessionFileName?.Replace("+", "%2B")));
sessionNames.Add(raw ? sessionFileName
: WebUtility.UrlDecode(sessionFileName?.Replace("+", "%2B")));
}
if (raw)
{
if (!sessionNames.Contains("Default%20Settings")) // Do not localize
{
sessionNames.Insert(0, "Default%20Settings");
}
}
else
{
if (!sessionNames.Contains("Default Settings"))
{
sessionNames.Insert(0, "Default Settings");
}
}
var registrySessionNames = PuttySessionsRegistryProvider.GetSessionNames(raw)
.Select(sessionName =>
string
.Format(RegistrySessionNameFormat,
sessionName)).ToList();
var registrySessionNames =
PuttySessionsRegistryProvider.GetSessionNames(raw).Select(sessionName => string.Format(RegistrySessionNameFormat, sessionName)).ToList();
sessionNames.AddRange(registrySessionNames);
sessionNames.Sort();
@@ -92,7 +85,7 @@ namespace mRemoteNG.Config.Putty
return null;
}
sessionName = HttpUtility.UrlDecode(sessionName.Replace("+", "%2B"));
sessionName = WebUtility.UrlDecode(sessionName.Replace("+", "%2B"));
var sessionFileReader = new SessionFileReader(sessionFile);
var sessionInfo = new PuttySessionInfo

View File

@@ -1565,8 +1565,6 @@
<Reference Include="System" />
<Reference Include="System.Configuration" />
<Reference Include="System.Drawing" />
<Reference Include="System.Web" />
<Reference Include="System.Web.Extensions" />
<Reference Include="VncSharp">
<HintPath>References\VncSharp.dll</HintPath>
</Reference>