// Decompiled with JetBrains decompiler // Type: Rei.Fs.Webdav.DavResourceOptions // Assembly: Rei.Fs.Webdav, Version=1.13.2.18288, Culture=neutral, PublicKeyToken=null // MVID: D30DD1E3-8520-48B5-AAE5-C87970350A82 // Assembly location: F:\Eigene Dateien\Dropbox\portable Collection\Progs\CarotDAV\Rei.Fs.Webdav.dll using Microsoft.VisualBasic.CompilerServices; using System; using System.Net; using System.Reflection; using System.Runtime.CompilerServices; namespace Rei.Fs.Webdav { public class DavResourceOptions { private HttpWebResponse pResponse2; private Uri pResUri; private Version pVersion; private string pAllowHeader; private string pDAVHeader; private string pSSLVersionString; internal DavResourceOptions(Uri responseuri, HttpWebResponse response) { this.pResUri = responseuri; this.pVersion = response.ProtocolVersion; this.pAllowHeader = response.Headers["Allow"]; this.pDAVHeader = response.Headers["DAV"]; this.pSSLVersionString = ""; FieldInfo field1 = typeof (HttpWebResponse).GetField("m_ConnectStream", BindingFlags.Instance | BindingFlags.NonPublic); if (field1 == null) return; object objectValue1 = RuntimeHelpers.GetObjectValue(field1.GetValue((object) response)); FieldInfo field2 = objectValue1.GetType().GetField("m_Connection", BindingFlags.Instance | BindingFlags.NonPublic); if (field2 == null) return; object objectValue2 = RuntimeHelpers.GetObjectValue(field2.GetValue(RuntimeHelpers.GetObjectValue(objectValue1))); FieldInfo field3 = objectValue2.GetType().BaseType.GetField("m_NetworkStream", BindingFlags.Instance | BindingFlags.NonPublic); if (field3 == null) return; object objectValue3 = RuntimeHelpers.GetObjectValue(field3.GetValue(RuntimeHelpers.GetObjectValue(objectValue2))); FieldInfo field4 = objectValue3.GetType().GetField("m_Worker", BindingFlags.Instance | BindingFlags.NonPublic); if (field4 == null) return; object objectValue4 = RuntimeHelpers.GetObjectValue(field4.GetValue(RuntimeHelpers.GetObjectValue(objectValue3))); PropertyInfo property = objectValue4.GetType().GetProperty("SslProtocol", BindingFlags.Instance | BindingFlags.NonPublic); if (property == null) return; this.pSSLVersionString = RuntimeHelpers.GetObjectValue(property.GetValue(RuntimeHelpers.GetObjectValue(objectValue4), (object[]) null)).ToString().ToUpperInvariant(); } public Uri ResponseUri { get { return this.pResUri; } } public Version ProtocolVersion { get { return this.pVersion; } } public bool MethodAllowed(string method) { if (this.pAllowHeader == null) return false; string[] strArray1 = this.pAllowHeader.ToUpper().Split(','); method = method.ToUpper(); string[] strArray2 = strArray1; int index = 0; while (index < strArray2.Length) { if (Operators.CompareString(strArray2[index].Trim(), method, false) == 0) return true; checked { ++index; } } return false; } public string AllowedMethods { get { if (this.pAllowHeader == null) return ""; return this.pAllowHeader; } } public bool DAVSupported(string version) { if (this.ProtocolVersion.CompareTo(HttpVersion.Version11) < 0 || this.pDAVHeader == null) return false; string[] strArray1 = this.pDAVHeader.ToUpper().Split(new char[1] { ',' }, StringSplitOptions.RemoveEmptyEntries); version = version.Trim().ToUpper(); string[] strArray2 = strArray1; int index = 0; while (index < strArray2.Length) { if (Operators.CompareString(strArray2[index].Trim(), version, false) == 0) return true; checked { ++index; } } return false; } public bool CanRead { get { return this.MethodAllowed("GET"); } } public bool CanWrite { get { return this.MethodAllowed("PUT"); } } public bool CanDelete { get { return this.MethodAllowed("DELETE"); } } public bool CanCreateCollection { get { return this.MethodAllowed("MKCOL"); } } public bool CanGetProperty { get { return this.MethodAllowed("PROPFIND"); } } public bool CanSetProperty { get { return this.MethodAllowed("PROPPATCH"); } } public bool CanMove { get { return this.MethodAllowed("MOVE"); } } public bool CanCopy { get { return this.MethodAllowed("COPY"); } } public string SSLVersionString { get { return this.pSSLVersionString; } } } }