116 lines
4.4 KiB
C#
116 lines
4.4 KiB
C#
// Decompiled with JetBrains decompiler
|
|
// Type: Rei.Fs.UriParserFixer
|
|
// Assembly: Rei.Fs, Version=1.13.2.8796, Culture=neutral, PublicKeyToken=null
|
|
// MVID: D8B08A8B-697C-4439-9CFF-1BE4EE46F7B0
|
|
// Assembly location: F:\Eigene Dateien\Dropbox\portable Collection\Progs\CarotDAV\Rei.Fs.dll
|
|
|
|
using Microsoft.VisualBasic.CompilerServices;
|
|
using System;
|
|
using System.Reflection;
|
|
using System.Runtime.CompilerServices;
|
|
using System.Security.Permissions;
|
|
using System.Threading;
|
|
|
|
namespace Rei.Fs
|
|
{
|
|
public class UriParserFixer
|
|
{
|
|
private static object @lock = RuntimeHelpers.GetObjectValue(new object());
|
|
private static bool m_registered;
|
|
private const int ConvertPathSlashes = 4194304;
|
|
private const int UnEscapeDotsAndSlashes = 33554432;
|
|
|
|
public static void Register()
|
|
{
|
|
try
|
|
{
|
|
object Expression = UriParserFixer.@lock;
|
|
ObjectFlowControl.CheckForSyncLockOnValueType(Expression);
|
|
Monitor.Enter(Expression);
|
|
try
|
|
{
|
|
if (UriParserFixer.m_registered)
|
|
return;
|
|
ReflectionPermission reflectionPermission = new ReflectionPermission(ReflectionPermissionFlag.AllFlags);
|
|
SecurityPermission securityPermission = new SecurityPermission(SecurityPermissionFlag.AllFlags);
|
|
reflectionPermission.Demand();
|
|
securityPermission.Demand();
|
|
FieldInfo field1 = typeof (UriParser).GetField("HttpUri", BindingFlags.Static | BindingFlags.NonPublic);
|
|
FieldInfo field2 = typeof (UriParser).GetField("m_Flags", BindingFlags.Instance | BindingFlags.NonPublic);
|
|
UriParser uriParser1 = (UriParser) field1.GetValue((object) null);
|
|
int num1 = Conversions.ToInteger(field2.GetValue((object) uriParser1)) & -4194305 & -33554433;
|
|
field2.SetValue((object) uriParser1, (object) num1);
|
|
FieldInfo field3 = typeof (UriParser).GetField("HttpsUri", BindingFlags.Static | BindingFlags.NonPublic);
|
|
FieldInfo field4 = typeof (UriParser).GetField("m_Flags", BindingFlags.Instance | BindingFlags.NonPublic);
|
|
UriParser uriParser2 = (UriParser) field3.GetValue((object) null);
|
|
int num2 = Conversions.ToInteger(field4.GetValue((object) uriParser2)) & -4194305 & -33554433;
|
|
field4.SetValue((object) uriParser2, (object) num2);
|
|
UriParserFixer.m_registered = true;
|
|
}
|
|
finally
|
|
{
|
|
Monitor.Exit(Expression);
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
ProjectData.SetProjectError(ex);
|
|
ProjectData.ClearProjectError();
|
|
}
|
|
}
|
|
|
|
public static void UnRegister()
|
|
{
|
|
try
|
|
{
|
|
object Expression = UriParserFixer.@lock;
|
|
ObjectFlowControl.CheckForSyncLockOnValueType(Expression);
|
|
Monitor.Enter(Expression);
|
|
try
|
|
{
|
|
if (!UriParserFixer.m_registered)
|
|
return;
|
|
FieldInfo field1 = typeof (UriParser).GetField("HttpUri", BindingFlags.Static | BindingFlags.NonPublic);
|
|
FieldInfo field2 = typeof (UriParser).GetField("m_Flags", BindingFlags.Instance | BindingFlags.NonPublic);
|
|
UriParser uriParser1 = (UriParser) field1.GetValue((object) null);
|
|
int num1 = Conversions.ToInteger(field2.GetValue((object) uriParser1)) | 4194304 | 33554432;
|
|
field2.SetValue((object) uriParser1, (object) num1);
|
|
FieldInfo field3 = typeof (UriParser).GetField("HttpsUri", BindingFlags.Static | BindingFlags.NonPublic);
|
|
FieldInfo field4 = typeof (UriParser).GetField("m_Flags", BindingFlags.Instance | BindingFlags.NonPublic);
|
|
UriParser uriParser2 = (UriParser) field3.GetValue((object) null);
|
|
int num2 = Conversions.ToInteger(field4.GetValue((object) uriParser2)) | 4194304 | 33554432;
|
|
field4.SetValue((object) uriParser2, (object) num2);
|
|
UriParserFixer.m_registered = false;
|
|
}
|
|
finally
|
|
{
|
|
Monitor.Exit(Expression);
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
ProjectData.SetProjectError(ex);
|
|
ProjectData.ClearProjectError();
|
|
}
|
|
}
|
|
|
|
public static bool IsRegister
|
|
{
|
|
get
|
|
{
|
|
object Expression = UriParserFixer.@lock;
|
|
ObjectFlowControl.CheckForSyncLockOnValueType(Expression);
|
|
Monitor.Enter(Expression);
|
|
try
|
|
{
|
|
return UriParserFixer.m_registered;
|
|
}
|
|
finally
|
|
{
|
|
Monitor.Exit(Expression);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|