Disassembled CarotDav v1.14.7 with dotPeek 2017.2

This commit is contained in:
2017-10-06 17:20:58 +02:00
commit 2002a53fb5
191 changed files with 69359 additions and 0 deletions

53
Rei.Fs/Adler32.cs Normal file
View File

@@ -0,0 +1,53 @@
// Decompiled with JetBrains decompiler
// Type: Rei.Fs.Adler32
// 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
namespace Rei.Fs
{
public class Adler32
{
private int m_s1;
private int m_s2;
private const int modulo = 65521;
public byte[] Value
{
get
{
return new byte[4]
{
checked ((byte) (this.m_s2 >> 8)),
checked ((byte) (this.m_s2 & (int) byte.MaxValue)),
checked ((byte) (this.m_s1 >> 8)),
checked ((byte) (this.m_s1 & (int) byte.MaxValue))
};
}
}
public Adler32()
{
this.m_s1 = 1;
this.m_s2 = 0;
}
public void Calc(byte[] buf)
{
this.Calc(buf, 0, buf.Length);
}
public void Calc(byte[] buf, int index, int length)
{
int num1 = index;
int num2 = checked (index + length - 1);
int index1 = num1;
while (index1 <= num2)
{
this.m_s1 = checked (this.m_s1 + (int) buf[index1]) % 65521;
this.m_s2 = checked (this.m_s2 + this.m_s1) % 65521;
checked { ++index1; }
}
}
}
}

12
Rei.Fs/AssemblyInfo.cs Normal file
View File

@@ -0,0 +1,12 @@
using System.Reflection;
using System.Runtime.InteropServices;
[assembly: AssemblyTrademark("")]
[assembly: AssemblyProduct("Rei.Fs")]
[assembly: AssemblyCompany("Rei Software")]
[assembly: Guid("9f77af8b-75c4-4d33-96e1-421149462634")]
[assembly: AssemblyCopyright("Copyright (C) Rei HOBARA 2007-2016")]
[assembly: ComVisible(false)]
[assembly: AssemblyDescription("Fs Support Library")]
[assembly: AssemblyTitle("Rei.Fs")]
[assembly: AssemblyVersion("1.13.2.8796")]

398
Rei.Fs/AuthDialog.cs Normal file
View File

@@ -0,0 +1,398 @@
// Decompiled with JetBrains decompiler
// Type: Rei.Fs.AuthDialog
// 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.ComponentModel;
using System.Diagnostics;
using System.Drawing;
using System.Runtime.CompilerServices;
using System.Windows.Forms;
namespace Rei.Fs
{
[DesignerGenerated]
public class AuthDialog : Form
{
private IContainer components;
[AccessedThroughProperty("RememberCheckBox")]
private CheckBox _RememberCheckBox;
[AccessedThroughProperty("Label5")]
private Label _Label5;
[AccessedThroughProperty("Label4")]
private Label _Label4;
[AccessedThroughProperty("PasswordTextBox")]
private TextBox _PasswordTextBox;
[AccessedThroughProperty("UserNameTextBox")]
private TextBox _UserNameTextBox;
[AccessedThroughProperty("m_CancelButton")]
private Button _m_CancelButton;
[AccessedThroughProperty("ButtonOK")]
private Button _ButtonOK;
[AccessedThroughProperty("Label1")]
private Label _Label1;
[AccessedThroughProperty("UriTextBox")]
private TextBox _UriTextBox;
public AuthDialog()
{
this.Load += new EventHandler(this.AuthDialog_Load);
this.InitializeComponent();
}
[DebuggerNonUserCode]
protected override void Dispose(bool disposing)
{
try
{
if (!disposing || this.components == null)
return;
this.components.Dispose();
}
finally
{
base.Dispose(disposing);
}
}
[DebuggerStepThrough]
private void InitializeComponent()
{
this.RememberCheckBox = new CheckBox();
this.Label5 = new Label();
this.Label4 = new Label();
this.PasswordTextBox = new TextBox();
this.UserNameTextBox = new TextBox();
this.m_CancelButton = new Button();
this.ButtonOK = new Button();
this.Label1 = new Label();
this.UriTextBox = new TextBox();
this.SuspendLayout();
this.RememberCheckBox.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
this.RememberCheckBox.AutoSize = true;
CheckBox rememberCheckBox1 = this.RememberCheckBox;
Point point1 = new Point(8, 136);
Point point2 = point1;
rememberCheckBox1.Location = point2;
this.RememberCheckBox.Name = "RememberCheckBox";
CheckBox rememberCheckBox2 = this.RememberCheckBox;
Size size1 = new Size(214, 16);
Size size2 = size1;
rememberCheckBox2.Size = size2;
this.RememberCheckBox.TabIndex = 8;
this.RememberCheckBox.Text = "Remember User Name and Password";
this.RememberCheckBox.UseVisualStyleBackColor = true;
this.Label5.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
this.Label5.AutoSize = true;
Label label5_1 = this.Label5;
point1 = new Point(8, 88);
Point point3 = point1;
label5_1.Location = point3;
this.Label5.Name = "Label5";
Label label5_2 = this.Label5;
size1 = new Size(54, 12);
Size size3 = size1;
label5_2.Size = size3;
this.Label5.TabIndex = 4;
this.Label5.Text = "Password";
this.Label4.Anchor = AnchorStyles.Bottom | AnchorStyles.Left;
this.Label4.AutoSize = true;
Label label4_1 = this.Label4;
point1 = new Point(8, 48);
Point point4 = point1;
label4_1.Location = point4;
this.Label4.Name = "Label4";
Label label4_2 = this.Label4;
size1 = new Size(62, 12);
Size size4 = size1;
label4_2.Size = size4;
this.Label4.TabIndex = 2;
this.Label4.Text = "User Name";
this.PasswordTextBox.Anchor = AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
TextBox passwordTextBox1 = this.PasswordTextBox;
point1 = new Point(8, 104);
Point point5 = point1;
passwordTextBox1.Location = point5;
this.PasswordTextBox.Name = "PasswordTextBox";
TextBox passwordTextBox2 = this.PasswordTextBox;
size1 = new Size(272, 19);
Size size5 = size1;
passwordTextBox2.Size = size5;
this.PasswordTextBox.TabIndex = 5;
this.PasswordTextBox.UseSystemPasswordChar = true;
this.UserNameTextBox.Anchor = AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
TextBox userNameTextBox1 = this.UserNameTextBox;
point1 = new Point(8, 64);
Point point6 = point1;
userNameTextBox1.Location = point6;
this.UserNameTextBox.Name = "UserNameTextBox";
TextBox userNameTextBox2 = this.UserNameTextBox;
size1 = new Size(272, 19);
Size size6 = size1;
userNameTextBox2.Size = size6;
this.UserNameTextBox.TabIndex = 3;
this.m_CancelButton.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
this.m_CancelButton.DialogResult = DialogResult.Cancel;
Button mCancelButton1 = this.m_CancelButton;
point1 = new Point(208, 160);
Point point7 = point1;
mCancelButton1.Location = point7;
this.m_CancelButton.Name = "m_CancelButton";
Button mCancelButton2 = this.m_CancelButton;
size1 = new Size(72, 24);
Size size7 = size1;
mCancelButton2.Size = size7;
this.m_CancelButton.TabIndex = 10;
this.m_CancelButton.Text = "Cancel";
this.m_CancelButton.UseVisualStyleBackColor = true;
this.ButtonOK.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
Button buttonOk1 = this.ButtonOK;
point1 = new Point(128, 160);
Point point8 = point1;
buttonOk1.Location = point8;
this.ButtonOK.Name = "ButtonOK";
Button buttonOk2 = this.ButtonOK;
size1 = new Size(72, 24);
Size size8 = size1;
buttonOk2.Size = size8;
this.ButtonOK.TabIndex = 9;
this.ButtonOK.Text = "OK";
this.ButtonOK.UseVisualStyleBackColor = true;
this.Label1.AutoSize = true;
Label label1_1 = this.Label1;
point1 = new Point(8, 8);
Point point9 = point1;
label1_1.Location = point9;
this.Label1.Name = "Label1";
Label label1_2 = this.Label1;
size1 = new Size(90, 12);
Size size9 = size1;
label1_2.Size = size9;
this.Label1.TabIndex = 0;
this.Label1.Text = "Authorization for";
this.UriTextBox.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
TextBox uriTextBox1 = this.UriTextBox;
point1 = new Point(8, 24);
Point point10 = point1;
uriTextBox1.Location = point10;
this.UriTextBox.Multiline = true;
this.UriTextBox.Name = "UriTextBox";
this.UriTextBox.ReadOnly = true;
TextBox uriTextBox2 = this.UriTextBox;
size1 = new Size(272, 19);
Size size10 = size1;
uriTextBox2.Size = size10;
this.UriTextBox.TabIndex = 1;
this.UriTextBox.TabStop = false;
this.AcceptButton = (IButtonControl) this.ButtonOK;
this.AutoScaleDimensions = new SizeF(6f, 12f);
this.AutoScaleMode = AutoScaleMode.Font;
this.CancelButton = (IButtonControl) this.m_CancelButton;
size1 = new Size(288, 192);
this.ClientSize = size1;
this.Controls.Add((Control) this.UriTextBox);
this.Controls.Add((Control) this.Label1);
this.Controls.Add((Control) this.m_CancelButton);
this.Controls.Add((Control) this.ButtonOK);
this.Controls.Add((Control) this.RememberCheckBox);
this.Controls.Add((Control) this.Label5);
this.Controls.Add((Control) this.Label4);
this.Controls.Add((Control) this.PasswordTextBox);
this.Controls.Add((Control) this.UserNameTextBox);
size1 = new Size(304, 229);
this.MinimumSize = size1;
this.Name = nameof (AuthDialog);
this.StartPosition = FormStartPosition.CenterParent;
this.Text = "Authorization";
this.ResumeLayout(false);
this.PerformLayout();
}
internal virtual CheckBox RememberCheckBox
{
get
{
return this._RememberCheckBox;
}
[MethodImpl(MethodImplOptions.Synchronized)] set
{
this._RememberCheckBox = value;
}
}
internal virtual Label Label5
{
get
{
return this._Label5;
}
[MethodImpl(MethodImplOptions.Synchronized)] set
{
this._Label5 = value;
}
}
internal virtual Label Label4
{
get
{
return this._Label4;
}
[MethodImpl(MethodImplOptions.Synchronized)] set
{
this._Label4 = value;
}
}
internal virtual TextBox PasswordTextBox
{
get
{
return this._PasswordTextBox;
}
[MethodImpl(MethodImplOptions.Synchronized)] set
{
this._PasswordTextBox = value;
}
}
internal virtual TextBox UserNameTextBox
{
get
{
return this._UserNameTextBox;
}
[MethodImpl(MethodImplOptions.Synchronized)] set
{
this._UserNameTextBox = value;
}
}
internal virtual Button m_CancelButton
{
get
{
return this._m_CancelButton;
}
[MethodImpl(MethodImplOptions.Synchronized)] set
{
this._m_CancelButton = value;
}
}
internal virtual Button ButtonOK
{
get
{
return this._ButtonOK;
}
[MethodImpl(MethodImplOptions.Synchronized)] set
{
EventHandler eventHandler = new EventHandler(this.ButtonOK_Click);
if (this._ButtonOK != null)
this._ButtonOK.Click -= eventHandler;
this._ButtonOK = value;
if (this._ButtonOK == null)
return;
this._ButtonOK.Click += eventHandler;
}
}
internal virtual Label Label1
{
get
{
return this._Label1;
}
[MethodImpl(MethodImplOptions.Synchronized)] set
{
this._Label1 = value;
}
}
internal virtual TextBox UriTextBox
{
get
{
return this._UriTextBox;
}
[MethodImpl(MethodImplOptions.Synchronized)] set
{
this._UriTextBox = value;
}
}
public string Target
{
get
{
return this.UriTextBox.Text;
}
set
{
this.UriTextBox.Text = value;
}
}
public string UserName
{
get
{
return this.UserNameTextBox.Text;
}
set
{
this.UserNameTextBox.Text = value;
}
}
public string Password
{
get
{
return this.PasswordTextBox.Text;
}
set
{
this.PasswordTextBox.Text = value;
}
}
public bool ShowRememberCheckBox
{
get
{
return this.RememberCheckBox.Visible;
}
set
{
this.RememberCheckBox.Visible = value;
}
}
public bool Remember
{
get
{
return this.RememberCheckBox.Checked;
}
set
{
this.RememberCheckBox.Checked = value;
}
}
private void ButtonOK_Click(object sender, EventArgs e)
{
this.DialogResult = DialogResult.OK;
}
private void AuthDialog_Load(object sender, EventArgs e)
{
this.Icon = Rei.Fs.My.Resources.Resources.security;
}
}
}

120
Rei.Fs/AuthDialog.resx Normal file
View File

@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

1070
Rei.Fs/AutoSplitFs.cs Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,41 @@
// Decompiled with JetBrains decompiler
// Type: Rei.Fs.CannotProcessRequest
// 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 System;
namespace Rei.Fs
{
public class CannotProcessRequest : Exception
{
private Uri _target;
public CannotProcessRequest(Uri uri, string message)
: base(message)
{
this._target = uri;
}
public CannotProcessRequest(Uri uri, Exception innerexception)
: base("Cannot Process Request", innerexception)
{
this._target = uri;
}
public CannotProcessRequest(Uri uri, string message, Exception innerexception)
: base(message, innerexception)
{
this._target = uri;
}
public Uri TargetUri
{
get
{
return this._target;
}
}
}
}

165
Rei.Fs/ChunkedStream.cs Normal file
View File

@@ -0,0 +1,165 @@
// Decompiled with JetBrains decompiler
// Type: Rei.Fs.ChunkedStream
// 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 System;
using System.IO;
namespace Rei.Fs
{
public class ChunkedStream : Stream
{
private Stream pBaseStream;
public object Tag;
private long pChunkSize;
private long pCurrentPosition;
private long pChunkPosition;
private long pTotalLength;
private bool pDisposed;
public event EventHandler ChunkFinishedEvent;
public ChunkedStream(Stream basestream, long chunksize, long totallength)
{
this.pDisposed = false;
this.pBaseStream = basestream;
this.pChunkSize = chunksize;
this.pCurrentPosition = 0L;
this.pChunkPosition = 0L;
this.pTotalLength = totallength;
}
public void SetStream(Stream basestream)
{
this.pBaseStream = basestream;
this.pChunkPosition = 0L;
}
public Stream BaseStream
{
get
{
return this.pBaseStream;
}
}
public long ChunkSize
{
get
{
return this.pChunkSize;
}
}
public override bool CanRead
{
get
{
return false;
}
}
public override bool CanSeek
{
get
{
return false;
}
}
public override bool CanWrite
{
get
{
return this.BaseStream.CanWrite;
}
}
public override long Length
{
get
{
return this.pTotalLength;
}
}
public override long Position
{
get
{
return this.pCurrentPosition;
}
set
{
throw new NotSupportedException();
}
}
public override void SetLength(long value)
{
throw new NotSupportedException();
}
public override long Seek(long offset, SeekOrigin origin)
{
throw new NotSupportedException();
}
public override int Read(byte[] buffer, int offset, int count)
{
throw new NotSupportedException();
}
public override void Flush()
{
if (this.pBaseStream == null)
return;
this.pBaseStream.Flush();
}
public override void Write(byte[] buffer, int offset, int count)
{
if (this.pBaseStream == null)
throw new ObjectDisposedException(this.GetType().FullName);
if (count < 0)
throw new ArgumentOutOfRangeException(nameof (count));
if (offset < 0)
throw new ArgumentOutOfRangeException(nameof (offset));
int count1 = count;
if (checked ((long) count1 + this.pChunkPosition) > this.pChunkSize)
count1 = checked ((int) (this.pChunkSize - this.pChunkPosition));
if (count1 > 0)
{
this.pBaseStream.Write(buffer, offset, count1);
checked { count -= count1; }
checked { offset += count1; }
this.pChunkPosition = checked (this.pChunkPosition + (long) count1);
this.pCurrentPosition = checked (this.pCurrentPosition + (long) count1);
}
if (count <= 0)
return;
this.pBaseStream.Close();
EventHandler finishedEventEvent = this.ChunkFinishedEventEvent;
if (finishedEventEvent != null)
finishedEventEvent((object) this, EventArgs.Empty);
this.Write(buffer, offset, count);
}
protected override void Dispose(bool disposing)
{
try
{
if (!disposing || this.pDisposed)
return;
this.pDisposed = true;
this.pBaseStream.Close();
}
finally
{
base.Dispose(disposing);
}
}
}
}

198
Rei.Fs/CloseNotifyStream.cs Normal file
View File

@@ -0,0 +1,198 @@
// Decompiled with JetBrains decompiler
// Type: Rei.Fs.CloseNotifyStream
// 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 System;
using System.IO;
using System.Runtime.CompilerServices;
namespace Rei.Fs
{
public class CloseNotifyStream : Stream
{
private Stream pBaseStream;
private long pTotalWrite;
public object Tag;
private bool pDisposed;
public event EventHandler ClosedEvent;
public event EventHandler ClosingEvent;
public CloseNotifyStream(Stream basestream)
{
this.pDisposed = false;
this.pBaseStream = basestream;
this.pTotalWrite = 0L;
}
public Stream BaseStream
{
get
{
return this.pBaseStream;
}
}
public long TotalWrite
{
get
{
return this.pTotalWrite;
}
}
public override bool CanRead
{
get
{
return this.pBaseStream.CanRead;
}
}
public override bool CanSeek
{
get
{
return this.pBaseStream.CanSeek;
}
}
public override bool CanWrite
{
get
{
return this.pBaseStream.CanWrite;
}
}
public override bool CanTimeout
{
get
{
return this.pBaseStream.CanTimeout;
}
}
public override long Length
{
get
{
return this.pBaseStream.Length;
}
}
public override long Position
{
get
{
return this.pBaseStream.Position;
}
set
{
this.pBaseStream.Position = value;
}
}
public override int ReadTimeout
{
get
{
return this.pBaseStream.ReadTimeout;
}
set
{
this.pBaseStream.ReadTimeout = value;
}
}
public override int WriteTimeout
{
get
{
return this.pBaseStream.WriteTimeout;
}
set
{
this.pBaseStream.WriteTimeout = value;
}
}
public override int Read(byte[] buffer, int offset, int count)
{
return this.pBaseStream.Read(buffer, offset, count);
}
public override IAsyncResult BeginRead(byte[] buffer, int offset, int count, AsyncCallback callback, object state)
{
return base.BeginRead(buffer, offset, count, callback, RuntimeHelpers.GetObjectValue(state));
}
public override int EndRead(IAsyncResult asyncResult)
{
return base.EndRead(asyncResult);
}
public override long Seek(long offset, SeekOrigin origin)
{
return this.pBaseStream.Seek(offset, origin);
}
public override void SetLength(long value)
{
this.pBaseStream.SetLength(value);
}
public override void Write(byte[] buffer, int offset, int count)
{
this.pTotalWrite = checked (this.pTotalWrite + (long) count);
this.pBaseStream.Write(buffer, offset, count);
}
public override IAsyncResult BeginWrite(byte[] buffer, int offset, int count, AsyncCallback callback, object state)
{
this.pTotalWrite = checked (this.pTotalWrite + (long) count);
return base.BeginWrite(buffer, offset, count, callback, RuntimeHelpers.GetObjectValue(state));
}
public override void EndWrite(IAsyncResult asyncResult)
{
base.EndWrite(asyncResult);
}
public override void Flush()
{
this.pBaseStream.Flush();
}
protected override void Dispose(bool disposing)
{
try
{
if (!disposing || this.pDisposed)
return;
this.pDisposed = true;
try
{
EventHandler closingEventEvent = this.ClosingEventEvent;
if (closingEventEvent != null)
closingEventEvent((object) this, EventArgs.Empty);
}
finally
{
this.pBaseStream.Close();
}
EventHandler closedEventEvent = this.ClosedEventEvent;
if (closedEventEvent == null)
return;
closedEventEvent((object) this, EventArgs.Empty);
}
finally
{
base.Dispose(disposing);
}
}
}
}

View File

@@ -0,0 +1,635 @@
// Decompiled with JetBrains decompiler
// Type: Rei.Fs.ConnectionSettingBase
// 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.ComponentModel;
using System.Drawing;
using System.Net;
using System.Net.Security;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading;
using System.Windows.Forms;
using System.Xml.Serialization;
namespace Rei.Fs
{
[Serializable]
public abstract class ConnectionSettingBase
{
private string pName;
private Uri pTargetUri;
private string pPersistUserName;
private string pPersistPassword;
private bool pDontSave;
public string FaviconName;
public UCSNormalization DownloadFilenameNormalization;
public UCSNormalization UploadFilenameNormalization;
public ProxyType Proxy;
private Uri pProxyUri;
private string[] pProxyByPassList;
public bool ProxyByPassLocal;
public bool ProxyUseDefaultCredential;
private string pProxyUsername;
private string pProxyPassword;
public int ReadWriteTimeout;
public int ConnectTimeout;
public bool UseEncryption;
private string pEncryptionKey;
public bool AutoSplit;
public int SplitSizeMB;
public string EscapeString;
public bool HideUnencryptedFile;
public bool HideUnencryptedDirectory;
private object pSyncObject;
private bool pNeedPersist;
private string pUserName;
private string pPassword;
private CookieContainer pCookieContainer;
private SslPolicyErrors pCertErrorIgnores;
private SslPolicyErrors pLastCertError;
protected ConnectionSettingBase()
{
this.Name = string.Empty;
this.TargetUri = (Uri) null;
this.pPersistUserName = string.Empty;
this.pPersistPassword = string.Empty;
this.pDontSave = false;
this.DownloadFilenameNormalization = UCSNormalization.NFC;
this.UploadFilenameNormalization = UCSNormalization.None;
this.Proxy = ProxyType.Default;
this.ProxyUri = (Uri) null;
this.ProxyByPassList = new string[0];
this.ProxyByPassLocal = false;
this.ProxyUseDefaultCredential = false;
this.pProxyUsername = string.Empty;
this.pProxyPassword = string.Empty;
this.ReadWriteTimeout = 10000;
this.ConnectTimeout = 10000;
this.UseEncryption = false;
this.pEncryptionKey = "";
this.AutoSplit = false;
this.SplitSizeMB = 50;
this.EscapeString = "^_";
this.HideUnencryptedDirectory = false;
this.HideUnencryptedFile = false;
this.pSyncObject = RuntimeHelpers.GetObjectValue(new object());
this.pUserName = this.pPersistUserName;
this.pPassword = this.pPersistPassword;
this.pCookieContainer = new CookieContainer();
}
public abstract SecureType SecureType { get; }
public static Icon GetDefaultFavicon()
{
return Rei.Fs.My.Resources.Resources.NetFolder;
}
public string Name
{
get
{
return this.pName;
}
set
{
this.pName = value;
}
}
[XmlIgnore]
public Uri TargetUri
{
get
{
return this.pTargetUri;
}
set
{
this.pTargetUri = value;
}
}
[XmlElement("TargetUri")]
public string TargetUri_ForSerialization
{
get
{
return this.TargetUri.ToString();
}
set
{
if (value == null || value.Length == 0)
this.pTargetUri = (Uri) null;
else
this.pTargetUri = new Uri(value);
}
}
[XmlIgnore]
public string UserName
{
get
{
object syncObject = this.SyncObject;
ObjectFlowControl.CheckForSyncLockOnValueType(syncObject);
Monitor.Enter(syncObject);
try
{
return this.pUserName;
}
finally
{
Monitor.Exit(syncObject);
}
}
}
[XmlIgnore]
public string PersistUserName
{
get
{
object syncObject = this.SyncObject;
ObjectFlowControl.CheckForSyncLockOnValueType(syncObject);
Monitor.Enter(syncObject);
try
{
return this.pPersistUserName;
}
finally
{
Monitor.Exit(syncObject);
}
}
}
[XmlElement("UserName")]
[EditorBrowsable(EditorBrowsableState.Never)]
public string UserName_ForSerialization
{
get
{
if (this.DontSave)
return string.Empty;
object syncObject = this.SyncObject;
ObjectFlowControl.CheckForSyncLockOnValueType(syncObject);
Monitor.Enter(syncObject);
try
{
return this.pPersistUserName;
}
finally
{
Monitor.Exit(syncObject);
}
}
set
{
object syncObject = this.SyncObject;
ObjectFlowControl.CheckForSyncLockOnValueType(syncObject);
Monitor.Enter(syncObject);
try
{
this.pPersistUserName = value;
this.pUserName = this.pPersistUserName;
}
finally
{
Monitor.Exit(syncObject);
}
}
}
[XmlIgnore]
public string Password
{
get
{
object syncObject = this.SyncObject;
ObjectFlowControl.CheckForSyncLockOnValueType(syncObject);
Monitor.Enter(syncObject);
try
{
return this.pPassword;
}
finally
{
Monitor.Exit(syncObject);
}
}
}
[XmlIgnore]
public string PersistPassword
{
get
{
object syncObject = this.SyncObject;
ObjectFlowControl.CheckForSyncLockOnValueType(syncObject);
Monitor.Enter(syncObject);
try
{
return this.pPersistPassword;
}
finally
{
Monitor.Exit(syncObject);
}
}
}
[EditorBrowsable(EditorBrowsableState.Never)]
[XmlElement("Password")]
public string Password_ForSerialization
{
get
{
if (this.DontSave)
return string.Empty;
object syncObject = this.SyncObject;
ObjectFlowControl.CheckForSyncLockOnValueType(syncObject);
Monitor.Enter(syncObject);
try
{
return Convert.ToBase64String(Encoding.Unicode.GetBytes(this.pPersistPassword));
}
finally
{
Monitor.Exit(syncObject);
}
}
set
{
object syncObject = this.SyncObject;
ObjectFlowControl.CheckForSyncLockOnValueType(syncObject);
Monitor.Enter(syncObject);
try
{
try
{
this.pPersistPassword = Encoding.Unicode.GetString(Convert.FromBase64String(value));
}
catch (Exception ex)
{
ProjectData.SetProjectError(ex);
this.pPersistPassword = string.Empty;
ProjectData.ClearProjectError();
}
this.pPassword = this.pPersistPassword;
}
finally
{
Monitor.Exit(syncObject);
}
}
}
public bool DontSave
{
get
{
return this.pDontSave;
}
set
{
this.pDontSave = value;
}
}
[XmlIgnore]
public Uri ProxyUri
{
get
{
return this.pProxyUri;
}
set
{
this.pProxyUri = value;
}
}
[Browsable(false)]
[XmlElement("ProxyUri")]
public string ProxyUri_ForSerialization
{
get
{
if ((object) this.pProxyUri == null)
return string.Empty;
return this.pProxyUri.ToString();
}
set
{
if (value == null || value.Length == 0)
this.pProxyUri = (Uri) null;
else
this.pProxyUri = new Uri(value);
}
}
public string ProxyUserName
{
get
{
if (this.DontSave)
return string.Empty;
return this.pProxyUsername;
}
set
{
if (value == null)
value = string.Empty;
this.pProxyUsername = value;
}
}
[XmlIgnore]
public string ProxyPassword
{
get
{
if (this.DontSave)
return string.Empty;
return this.pProxyPassword;
}
set
{
if (value == null)
value = string.Empty;
this.pProxyPassword = value;
}
}
[Browsable(false)]
[XmlElement("ProxyPassword")]
public string ProxyPassword_ForSerialization
{
get
{
if (this.DontSave)
return string.Empty;
return Convert.ToBase64String(Encoding.Unicode.GetBytes(this.pProxyPassword));
}
set
{
try
{
this.pProxyPassword = Encoding.Unicode.GetString(Convert.FromBase64String(value));
}
catch (Exception ex)
{
ProjectData.SetProjectError(ex);
this.pProxyPassword = string.Empty;
ProjectData.ClearProjectError();
}
}
}
[XmlIgnore]
public string[] ProxyByPassList
{
get
{
return this.pProxyByPassList;
}
set
{
if (value == null)
value = new string[0];
this.pProxyByPassList = value;
}
}
[Browsable(false)]
[XmlElement("ProxyByPassList")]
public string ProxyByPassList_ForSerialization
{
get
{
return string.Join(",", this.pProxyByPassList);
}
set
{
this.pProxyByPassList = value.Split(new char[2]
{
' ',
','
}, StringSplitOptions.RemoveEmptyEntries);
}
}
[XmlIgnore]
public string EncryptionKey
{
get
{
return this.pEncryptionKey;
}
set
{
if (value == null)
value = string.Empty;
this.pEncryptionKey = value;
}
}
[XmlElement("EncryptionKey")]
public string EncryptionKey_ForSerialization
{
get
{
return Convert.ToBase64String(Encoding.Unicode.GetBytes(this.pEncryptionKey));
}
set
{
try
{
this.pEncryptionKey = Encoding.Unicode.GetString(Convert.FromBase64String(value));
}
catch (Exception ex)
{
ProjectData.SetProjectError(ex);
this.pEncryptionKey = string.Empty;
ProjectData.ClearProjectError();
}
}
}
[XmlIgnore]
public SslPolicyErrors CertErrorIgnores
{
get
{
return this.pCertErrorIgnores;
}
set
{
this.pCertErrorIgnores = value;
}
}
[XmlIgnore]
public SslPolicyErrors LastCertError
{
get
{
return this.pLastCertError;
}
set
{
this.pLastCertError = value;
}
}
[XmlIgnore]
public bool NeedPersist
{
get
{
object syncObject = this.SyncObject;
ObjectFlowControl.CheckForSyncLockOnValueType(syncObject);
Monitor.Enter(syncObject);
try
{
return this.pNeedPersist;
}
finally
{
Monitor.Exit(syncObject);
}
}
set
{
object syncObject = this.SyncObject;
ObjectFlowControl.CheckForSyncLockOnValueType(syncObject);
Monitor.Enter(syncObject);
try
{
this.pNeedPersist = value;
}
finally
{
Monitor.Exit(syncObject);
}
}
}
protected object SyncObject
{
get
{
return this.pSyncObject;
}
}
[XmlIgnore]
public CookieContainer CookieContainer
{
get
{
object syncObject = this.SyncObject;
ObjectFlowControl.CheckForSyncLockOnValueType(syncObject);
Monitor.Enter(syncObject);
try
{
return this.pCookieContainer;
}
finally
{
Monitor.Exit(syncObject);
}
}
}
public void SetUserPass(string username, string password)
{
object pSyncObject = this.pSyncObject;
ObjectFlowControl.CheckForSyncLockOnValueType(pSyncObject);
Monitor.Enter(pSyncObject);
try
{
if (username != null)
this.pUserName = username;
if (password == null)
return;
this.pPassword = password;
}
finally
{
Monitor.Exit(pSyncObject);
}
}
public void PersistUserPass()
{
object pSyncObject = this.pSyncObject;
ObjectFlowControl.CheckForSyncLockOnValueType(pSyncObject);
Monitor.Enter(pSyncObject);
try
{
if (this.DontSave)
{
this.pPersistUserName = "";
this.pPersistPassword = "";
}
else
{
this.pPersistUserName = this.UserName;
this.pPersistPassword = this.Password;
}
this.NeedPersist = false;
}
finally
{
Monitor.Exit(pSyncObject);
}
}
public FsBase GetClient()
{
FsBase @base = this.GetBaseClient();
if (this.UseEncryption)
@base = (FsBase) new EncryptFs(@base, this.EncryptionKey, this.EscapeString, this.HideUnencryptedFile, this.HideUnencryptedDirectory);
if (this.AutoSplit)
@base = (FsBase) new AutoSplitFs(@base, checked ((long) this.SplitSizeMB * 1024L * 1024L), this.EscapeString);
return @base;
}
public abstract FsBase GetBaseClient();
public abstract Form GetSettingForm();
public abstract bool DoAuthorization(Uri target, bool PersistSelectable);
public virtual void Reset()
{
object pSyncObject = this.pSyncObject;
ObjectFlowControl.CheckForSyncLockOnValueType(pSyncObject);
Monitor.Enter(pSyncObject);
try
{
this.pUserName = this.pPersistUserName;
this.pPassword = this.pPersistPassword;
this.pCookieContainer = new CookieContainer();
this.pNeedPersist = false;
}
finally
{
Monitor.Exit(pSyncObject);
}
}
public virtual FsSpecificContextMenuItem[] GetExtensionMethod(ResourceInfo[] ris)
{
return (FsSpecificContextMenuItem[]) null;
}
}
}

View File

@@ -0,0 +1,39 @@
// Decompiled with JetBrains decompiler
// Type: Rei.Fs.DestinationAlreadyExistsException
// 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 System;
namespace Rei.Fs
{
public class DestinationAlreadyExistsException : Exception
{
private Uri _target;
public DestinationAlreadyExistsException(Uri destination, string message, Exception innerexception)
: base(message, innerexception)
{
this._target = destination;
}
public DestinationAlreadyExistsException(Uri destination, Exception innerexception)
: this(destination, "Destination Resource Already Exists", innerexception)
{
}
public DestinationAlreadyExistsException(Uri destination)
: this(destination, "Destination Resource Already Exists", (Exception) null)
{
}
public Uri DestinationUri
{
get
{
return this._target;
}
}
}
}

1069
Rei.Fs/EncryptFs.cs Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,231 @@
// Decompiled with JetBrains decompiler
// Type: Rei.Fs.FooteredWriteStream
// 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.IO;
namespace Rei.Fs
{
public class FooteredWriteStream : Stream
{
private Stream pBaseStream;
private byte[] pfooter;
private bool pHasError;
private bool pDisposed;
public FooteredWriteStream(Stream basestream, byte[] footer)
{
this.pHasError = false;
this.pDisposed = false;
this.pBaseStream = basestream;
this.pfooter = footer;
}
public override bool CanRead
{
get
{
return this.pBaseStream.CanRead;
}
}
public override bool CanSeek
{
get
{
return this.pBaseStream.CanSeek;
}
}
public override bool CanWrite
{
get
{
return this.pBaseStream.CanWrite;
}
}
public override bool CanTimeout
{
get
{
return this.pBaseStream.CanTimeout;
}
}
public override long Length
{
get
{
return this.pBaseStream.Length;
}
}
public override long Position
{
get
{
return this.pBaseStream.Position;
}
set
{
try
{
this.pBaseStream.Position = value;
}
catch (Exception ex)
{
ProjectData.SetProjectError(ex);
this.pHasError = true;
throw;
}
}
}
public override int ReadTimeout
{
get
{
return this.pBaseStream.ReadTimeout;
}
set
{
this.pBaseStream.ReadTimeout = value;
}
}
public override int WriteTimeout
{
get
{
return this.pBaseStream.WriteTimeout;
}
set
{
this.pBaseStream.WriteTimeout = value;
}
}
public override int Read(byte[] buffer, int offset, int count)
{
try
{
return this.pBaseStream.Read(buffer, offset, count);
}
catch (Exception ex)
{
ProjectData.SetProjectError(ex);
this.pHasError = true;
throw;
}
}
public override long Seek(long offset, SeekOrigin origin)
{
try
{
return this.pBaseStream.Seek(offset, origin);
}
catch (Exception ex)
{
ProjectData.SetProjectError(ex);
this.pHasError = true;
throw;
}
}
public override void SetLength(long value)
{
try
{
this.pBaseStream.SetLength(value);
}
catch (Exception ex)
{
ProjectData.SetProjectError(ex);
this.pHasError = true;
throw;
}
}
public override void Write(byte[] buffer, int offset, int count)
{
try
{
this.pBaseStream.Write(buffer, offset, count);
}
catch (Exception ex)
{
ProjectData.SetProjectError(ex);
this.pHasError = true;
throw;
}
}
public override void Flush()
{
try
{
this.pBaseStream.Flush();
}
catch (Exception ex)
{
ProjectData.SetProjectError(ex);
this.pHasError = true;
throw;
}
}
protected override void Dispose(bool disposing)
{
try
{
if (!disposing || this.pDisposed)
return;
this.pDisposed = true;
if (this.pHasError)
{
try
{
this.pBaseStream.Close();
}
catch (Exception ex)
{
ProjectData.SetProjectError(ex);
ProjectData.ClearProjectError();
}
}
else
{
try
{
this.pBaseStream.Write(this.pfooter, 0, this.pfooter.Length);
}
catch (Exception ex1)
{
ProjectData.SetProjectError(ex1);
try
{
this.pBaseStream.Close();
}
catch (Exception ex2)
{
ProjectData.SetProjectError(ex2);
ProjectData.ClearProjectError();
}
throw;
}
this.pBaseStream.Close();
}
}
finally
{
base.Dispose(disposing);
}
}
}
}

44
Rei.Fs/FsAbility.cs Normal file
View File

@@ -0,0 +1,44 @@
// Decompiled with JetBrains decompiler
// Type: Rei.Fs.FsAbility
// 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 System;
namespace Rei.Fs
{
[Flags]
public enum FsAbility
{
None = 0,
Listing = 1,
Read = 2,
Write = 4,
Delete = 8,
CreateCollection = 16,
Copy = 32,
Move = 64,
Rename = 128,
Lock = 256,
OverWriteFile = 512,
MoveOver = 1024,
CopyOver = 2048,
LastModifiedTime = 4096,
CreationTime = 8192,
LastAccessTime = 16384,
PartialRead = 65536,
PartialWrite = 131072,
Property = 1048576,
IgnoreCase = 16777216,
IgnoreSameName = 33554432,
ForceOverwrite = 67108864,
ReadOnly = Read | Listing,
ReadWrite = ReadOnly | Write,
BaseFs = ReadWrite | CreateCollection | Delete,
AdvancedFs = BaseFs | OverWriteFile | Rename | Move | Copy,
Times = LastAccessTime | CreationTime | LastModifiedTime,
AllWithoutLock = Times | AdvancedFs | Property | PartialWrite | PartialRead | CopyOver | MoveOver,
All = AllWithoutLock | Lock,
}
}

323
Rei.Fs/FsBase.cs Normal file
View File

@@ -0,0 +1,323 @@
// Decompiled with JetBrains decompiler
// Type: Rei.Fs.FsBase
// 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.Collections.Generic;
using System.IO;
using System.Net;
using System.Reflection;
using System.Text;
namespace Rei.Fs
{
[Serializable]
public abstract class FsBase
{
private static SslProtocols pAvailableTlss = SslProtocols.None;
private static string p_DefClientName;
private const string boundarystring = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
private string p_ClientName;
private string p_GroupName;
private ConnectionSettingBase p_ConnectionSetting;
private Uri p_BaseUri;
static FsBase()
{
UriParserFixer.Register();
Assembly executingAssembly = Assembly.GetExecutingAssembly();
FsBase.p_DefClientName = ((AssemblyProductAttribute) executingAssembly.GetCustomAttributes(typeof (AssemblyProductAttribute), false)[0]).Product + executingAssembly.GetName().Version.ToString(3);
}
public static string CreateBoundary(int seed)
{
Random random = new Random(seed);
StringBuilder stringBuilder = new StringBuilder(70);
stringBuilder.Length = 0;
stringBuilder.Append("----");
while (stringBuilder.Length < 70)
stringBuilder.Append("0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"[random.Next("0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ".Length)]);
return stringBuilder.ToString();
}
public static long ParseContentRange(string range, ref long start, ref long length, bool throwonsmall = true)
{
long result1 = 0;
string str1 = range.Trim().ToLowerInvariant();
string Left1 = "";
long result2 = -1;
int length1 = str1.IndexOf(" ");
if (length1 >= 0)
{
Left1 = str1.Substring(0, length1);
if (length1 >= str1.Length)
throw new InvalidServerResponseException("Invalid Content-Range header(0).");
str1 = str1.Substring(checked (length1 + 1)).Trim();
}
if (Operators.CompareString(Left1, "", false) != 0 && Operators.CompareString(Left1, "bytes", false) != 0 && Operators.CompareString(Left1, "byte", false) != 0)
throw new InvalidServerResponseException("Invalid Content-Range header(1).");
int length2 = str1.IndexOf("/");
if (length2 < 0 || length2 >= str1.Length)
throw new InvalidServerResponseException("Invalid Content-Range header(2).");
string Left2 = str1.Substring(0, length2).Trim();
string str2 = str1.Substring(checked (length2 + 1)).Trim();
long result3;
if (Operators.CompareString(str2, "*", false) == 0)
result3 = -1L;
else if (!long.TryParse(str2, out result3) || result3 < 0L)
throw new InvalidServerResponseException("Invalid Content-Range header. Invalid instance-length.");
if (Operators.CompareString(Left2, "*", false) == 0)
throw new InvalidServerResponseException("Invalid Content-Range header. \"206 Partial Content\" must specify content range.");
int length3 = Left2.IndexOf("-");
if (length3 < 0 || length3 >= Left2.Length)
throw new InvalidServerResponseException("Invalid Content-Range header. Invalid byte-range-resp-spec.");
if (!long.TryParse(Left2.Substring(0, length3), out result1) || result1 < 0L)
throw new InvalidServerResponseException("Invalid Content-Range header. Invalid first-byte-pos.");
if (!long.TryParse(Left2.Substring(checked (length3 + 1)), out result2) || result2 < 0L)
throw new InvalidServerResponseException("Invalid Content-Range header. Invalid last-byte-pos.");
if (result2 < result1)
throw new InvalidServerResponseException("Invalid Content-Range header. Inconsistent range.");
if (result3 >= 0L && result2 > result3)
throw new InvalidServerResponseException("Invalid Content-Range header. Inconsistent range.");
if (result1 > start)
throw new InvalidServerResponseException("Invalid Content-Range header. Content-Range header unmatch to Request.");
if (length < 0L)
{
if (result3 >= 0L && result2 != checked (result3 - 1L))
throw new InvalidServerResponseException("Invalid Content-Range header. Inconsistent range.");
}
else if (throwonsmall && checked (start + length - 1L) > result2)
throw new InvalidRangeException("not enough length");
start = result1;
length = checked (result2 - result1 + 1L);
return result3;
}
public static SslProtocols AvailableTlss()
{
if (FsBase.pAvailableTlss == SslProtocols.None)
{
SslProtocols sslProtocols = SslProtocols.None;
Array values = System.Enum.GetValues(typeof (System.Security.Authentication.SslProtocols));
int num1 = 0;
int num2 = checked (values.Length - 1);
int index = num1;
while (index <= num2)
{
sslProtocols |= (SslProtocols) Conversions.ToInteger(values.GetValue(index));
checked { ++index; }
}
FsBase.pAvailableTlss = sslProtocols & (SslProtocols.Default | SslProtocols.Tls11 | SslProtocols.Tls12);
}
return FsBase.pAvailableTlss;
}
protected FsBase(ConnectionSettingBase connectionsetting)
{
ServicePointManager.SecurityProtocol = (SecurityProtocolType) FsBase.AvailableTlss();
this.p_ConnectionSetting = connectionsetting;
this.p_GroupName = "";
this.p_ClientName = FsBase.p_DefClientName;
this.p_BaseUri = connectionsetting.TargetUri;
}
public virtual string UserName
{
get
{
return this.p_ConnectionSetting.UserName;
}
}
public virtual string Password
{
get
{
return this.p_ConnectionSetting.Password;
}
}
public virtual string ClientName
{
get
{
return this.p_ClientName;
}
set
{
this.p_ClientName = value;
}
}
public virtual string GroupName
{
get
{
return this.p_GroupName;
}
set
{
this.p_GroupName = value;
}
}
public virtual SecureType LastSecureType
{
get
{
return SecureType.None;
}
}
public ConnectionSettingBase ConnectionSetting
{
get
{
return this.p_ConnectionSetting;
}
}
protected Uri BaseUri
{
get
{
return this.p_BaseUri;
}
}
public event EventHandler<LogMessageEventArgs> LogMessage;
public void OnLogMessage(string message)
{
EventHandler<LogMessageEventArgs> logMessageEvent = this.LogMessageEvent;
if (logMessageEvent == null)
return;
logMessageEvent((object) this, new LogMessageEventArgs(message));
}
public abstract FsAbility Ability { get; }
public bool IsCaseSensitiveFs
{
get
{
return (this.Ability & FsAbility.IgnoreCase) == FsAbility.None;
}
}
public virtual void ResetConnection()
{
}
public abstract ResourceInfo GetInfo(Uri targeturi);
public abstract ResourceInfo[] GetEntries(ResourceId id);
public virtual ResourceInfo GetInfo(ResourceId id)
{
return this.GetInfo(id.Uri);
}
public virtual ResourceInfo GetInfo(ResourceId parentid, string name)
{
ResourceInfo[] entries = this.GetEntries(parentid);
int num1 = 0;
int num2 = checked (entries.Length - 1);
int index = num1;
while (index <= num2)
{
if (Operators.CompareString(UriUtil.GetLastName(entries[index].Id.Uri), name, false) == 0)
return entries[index];
checked { ++index; }
}
throw new RemoteResourceNotFoundException(UriUtil.CombineName(parentid.Uri, name));
}
public virtual ResourceInfo GetParentInfo(ResourceId id)
{
return this.GetInfo(UriUtil.GetParent(id.Uri));
}
public virtual ResourceInfo[] GetInfoAndEntries(Uri targeturi)
{
List<ResourceInfo> resourceInfoList = new List<ResourceInfo>();
ResourceInfo info = this.GetInfo(targeturi);
resourceInfoList.Add(info);
if (info.IsCollection)
{
ResourceInfo[] entries = this.GetEntries(info.Id);
resourceInfoList.AddRange((IEnumerable<ResourceInfo>) entries);
}
return resourceInfoList.ToArray();
}
public virtual ResourceInfo[] GetInfoAndEntries(ResourceId id)
{
List<ResourceInfo> resourceInfoList = new List<ResourceInfo>();
ResourceInfo info = this.GetInfo(id);
resourceInfoList.Add(info);
if (info.IsCollection)
{
ResourceInfo[] entries = this.GetEntries(info.Id);
resourceInfoList.AddRange((IEnumerable<ResourceInfo>) entries);
}
return resourceInfoList.ToArray();
}
public virtual ResourceInfo[] GetParentInfoAndEntries(ResourceId childid)
{
List<ResourceInfo> resourceInfoList = new List<ResourceInfo>();
ResourceInfo parentInfo = this.GetParentInfo(childid);
resourceInfoList.Add(parentInfo);
if (parentInfo.IsCollection)
{
ResourceInfo[] entries = this.GetEntries(parentInfo.Id);
resourceInfoList.AddRange((IEnumerable<ResourceInfo>) entries);
}
return resourceInfoList.ToArray();
}
public abstract ReturnedInfo CreateCollection(ResourceId parentid, string name);
public abstract void Delete(ResourceId id);
public abstract ReturnedInfo Move(ResourceId id, ResourceId newparentid, string newname, bool overwrite);
public abstract ReturnedInfo Copy(ResourceId id, ResourceId newparentid, string newname, bool overwrite);
public abstract ReturnedInfo SetTimes(ResourceId id, DateTime lastmodifiedtime, DateTime creationtime, DateTime lastaccesstime);
public abstract ReturnedInfo SetResourceInfo(ResourceInfo info, ResourceInfo original);
public virtual Stream OpenRead(Uri targeturi)
{
ResourceId id = this.GetInfo(targeturi).Id;
long start = 0;
long length = -1;
return this.OpenRead(id, ref start, ref length);
}
public abstract Stream OpenRead(ResourceId id, ref long start, ref long length);
public abstract Stream OpenWrite(ResourceId parentid, string name, long length);
public abstract Stream OpenWriteOver(ResourceId id, long length);
public abstract Stream OpenWriteResume(ResourceId id, ref long start, ref long length);
public abstract ReturnedInfo CloseWrite(Stream st);
public abstract string GetLock(ResourceId id, string owner, int timeoutseconds, FsBase.LockScope scope);
public abstract void ReleaseLock(ResourceId id, string locktoken);
public enum LockScope
{
Exclusive,
Shared,
}
}
}

View File

@@ -0,0 +1,49 @@
// Decompiled with JetBrains decompiler
// Type: Rei.Fs.FsSpecificContextMenuItem
// 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 System.Drawing;
using System.Runtime.CompilerServices;
namespace Rei.Fs
{
public class FsSpecificContextMenuItem
{
public string Title;
public Image Image;
public System.EventHandler<ResourceInfoEventArgs> EventHandler;
public bool UseWaitCursor;
public object Tag;
public FsSpecificContextMenuItem(string title, bool usewaitcursor, System.EventHandler<ResourceInfoEventArgs> eventhandler)
: this(title, (Image) null, usewaitcursor, eventhandler, (object) null)
{
}
public FsSpecificContextMenuItem(string title, bool usewaitcursor, System.EventHandler<ResourceInfoEventArgs> eventhandler, object tag)
: this(title, (Image) null, usewaitcursor, eventhandler, RuntimeHelpers.GetObjectValue(tag))
{
}
public FsSpecificContextMenuItem(string title, Image image, bool usewaitcursor, System.EventHandler<ResourceInfoEventArgs> eventhandler)
: this(title, image, usewaitcursor, eventhandler, (object) null)
{
}
public FsSpecificContextMenuItem(string title, Image image, bool usewaitcursor, System.EventHandler<ResourceInfoEventArgs> eventhandler, object tag)
{
this.Title = title;
this.Image = image;
this.UseWaitCursor = usewaitcursor;
this.EventHandler = eventhandler;
this.Tag = RuntimeHelpers.GetObjectValue(tag);
}
public void Invoke(object sender, FsBase pfs, ResourceInfo[] ris)
{
this.EventHandler(RuntimeHelpers.GetObjectValue(sender), new ResourceInfoEventArgs(pfs, ris, RuntimeHelpers.GetObjectValue(this.Tag)));
}
}
}

View File

@@ -0,0 +1,51 @@
// Decompiled with JetBrains decompiler
// Type: Rei.Fs.HostRootedUriParser
// 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.Security.Permissions;
namespace Rei.Fs
{
public class HostRootedUriParser : GenericUriParser
{
private static readonly GenericUriParserOptions ParserOptions = GenericUriParserOptions.DontUnescapePathDotsAndSlashes | GenericUriParserOptions.Idn | GenericUriParserOptions.IriParsing;
private const int MustHaveAuthority = 1;
private const int OptionalAuthority = 2;
public static void Register(string scheme, int defaultport)
{
if (UriParser.IsKnownScheme(scheme))
return;
UriParser.Register((UriParser) new HostRootedUriParser(), scheme, defaultport);
}
public HostRootedUriParser()
: base(HostRootedUriParser.ParserOptions)
{
ReflectionPermission reflectionPermission = new ReflectionPermission(ReflectionPermissionFlag.AllFlags);
SecurityPermission securityPermission = new SecurityPermission(SecurityPermissionFlag.AllFlags);
reflectionPermission.Demand();
securityPermission.Demand();
FieldInfo field = typeof (UriParser).GetField("m_Flags", BindingFlags.Instance | BindingFlags.NonPublic);
int num = Conversions.ToInteger(field.GetValue((object) this)) & -3 | 1;
field.SetValue((object) this, (object) num);
}
protected override void InitializeAndValidate(Uri uri, ref UriFormatException parsingError)
{
base.InitializeAndValidate(uri, out parsingError);
if (parsingError == null && Operators.CompareString(uri.Host, "", false) == 0)
parsingError = new UriFormatException("should contain host");
if (parsingError == null && !uri.AbsolutePath.StartsWith("/"))
parsingError = new UriFormatException("should be absolute path");
if (parsingError != null || uri.Port > 0)
return;
parsingError = new UriFormatException("should not contain port");
}
}
}

111
Rei.Fs/IO/FileInfo.cs Normal file
View File

@@ -0,0 +1,111 @@
// Decompiled with JetBrains decompiler
// Type: Rei.Fs.IO.FileInfo
// 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 System;
using System.IO;
namespace Rei.Fs.IO
{
public class FileInfo
{
private FileAttributes pFileAttributes;
private DateTime pCreationTime;
private DateTime pLastAccessTime;
private DateTime pLastWriteTime;
private ulong pFileSize;
private string pFileName;
private string pFullPath;
private string pAltFileName;
internal FileInfo(string path, Win32Native.WIN32_FIND_DATA d)
{
this.pFileAttributes = d.dwFileAttributes;
this.pCreationTime = DateTime.FromFileTime((long) d.ftCreationTime.dwHighDateTime << 32 | (long) d.ftCreationTime.dwLowDateTime & (long) uint.MaxValue);
this.pLastAccessTime = DateTime.FromFileTime((long) d.ftLastAccessTime.dwHighDateTime << 32 | (long) d.ftLastAccessTime.dwLowDateTime & (long) uint.MaxValue);
this.pLastWriteTime = DateTime.FromFileTime((long) d.ftLastWriteTime.dwHighDateTime << 32 | (long) d.ftLastWriteTime.dwLowDateTime & (long) uint.MaxValue);
this.pFileSize = checked ((ulong) d.nFileSizeHigh << 32 + (ulong) d.nFileSizeLow);
this.pFileName = d.cFileName;
this.pAltFileName = d.cAlternateFileName;
this.pFullPath = path;
}
internal FileInfo(string path, Win32Native.WIN32_FILE_ATTRIBUTE_DATA d)
{
this.pFileAttributes = d.dwFileAttributes;
this.pCreationTime = DateTime.FromFileTime((long) d.ftCreationTime.dwHighDateTime << 32 | (long) d.ftCreationTime.dwLowDateTime & (long) uint.MaxValue);
this.pLastAccessTime = DateTime.FromFileTime((long) d.ftLastAccessTime.dwHighDateTime << 32 | (long) d.ftLastAccessTime.dwLowDateTime & (long) uint.MaxValue);
this.pLastWriteTime = DateTime.FromFileTime((long) d.ftLastWriteTime.dwHighDateTime << 32 | (long) d.ftLastWriteTime.dwLowDateTime & (long) uint.MaxValue);
this.pFileSize = checked ((ulong) d.nFileSizeHigh << 32 + (ulong) d.nFileSizeLow);
this.pFileName = FileSystem.GetFilename(path);
this.pAltFileName = (string) null;
this.pFullPath = path;
}
public bool IsDirectory
{
get
{
return (this.FileAttributes & FileAttributes.Directory) != (FileAttributes) 0;
}
}
public FileAttributes FileAttributes
{
get
{
return this.pFileAttributes;
}
}
public DateTime CreationTime
{
get
{
return this.pCreationTime;
}
}
public DateTime LastAccessTime
{
get
{
return this.pLastAccessTime;
}
}
public DateTime LastWriteTime
{
get
{
return this.pLastWriteTime;
}
}
public ulong FileSize
{
get
{
return this.pFileSize;
}
}
public string FileName
{
get
{
return this.pFileName;
}
}
public string FullPath
{
get
{
return this.pFullPath;
}
}
}
}

482
Rei.Fs/IO/FileSystem.cs Normal file
View File

@@ -0,0 +1,482 @@
// Decompiled with JetBrains decompiler
// Type: Rei.Fs.IO.FileSystem
// 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 Microsoft.Win32.SafeHandles;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.IO;
using System.Runtime.InteropServices;
using System.Text;
namespace Rei.Fs.IO
{
[StandardModule]
public sealed class FileSystem
{
private static DateTime win32timeorigin = new DateTime(1601, 1, 1, 0, 0, 0, DateTimeKind.Utc);
public static string CombinePath(string path1, string path2)
{
if (path1.EndsWith("\\"))
{
if (path2.StartsWith("\\"))
return path1 + path2.Substring(1);
return path1 + path2;
}
if (path2.StartsWith("\\"))
return path1 + path2;
return path1 + "\\" + path2;
}
public static string GetFilename(string path)
{
while (path.EndsWith("\\"))
path = path.Substring(0, checked (path.Length - 1));
int num = path.LastIndexOf("\\");
if (num < 0)
return path;
return path.Substring(checked (num + 1));
}
public static string GetDirectoryName(string path)
{
while (path.EndsWith("\\"))
path = path.Substring(0, checked (path.Length - 1));
int length = path.LastIndexOf("\\");
if (length < 0)
return path;
return path.Substring(0, length);
}
public static string NormalizePath(string path)
{
if (path.StartsWith("\\\\?\\"))
return path;
string str1 = path;
if (str1.Length >= 248)
;
string str2 = str1.Replace("/", "\\");
if (str2.StartsWith("\\\\"))
path = "\\\\?\\UNC\\" + str2.Substring(1);
else if (path.Length > 3 && Operators.CompareString(Conversions.ToString(path[1]), ":", false) == 0 && Operators.CompareString(Conversions.ToString(path[2]), "\\", false) == 0)
path = "\\\\?\\" + str2.Replace("/", "\\");
else if (Operators.CompareString(Conversions.ToString(path[0]), "\\", false) == 0)
path = "\\\\?\\" + str2.Replace("/", "\\");
return path;
}
public static System.Runtime.InteropServices.ComTypes.FILETIME ToFileTime(DateTime time)
{
byte[] bytes = BitConverter.GetBytes(DateTime.Compare(time, FileSystem.win32timeorigin) >= 0 ? time.ToFileTime() : 0L);
System.Runtime.InteropServices.ComTypes.FILETIME filetime;
filetime.dwHighDateTime = BitConverter.ToInt32(bytes, 4);
filetime.dwLowDateTime = BitConverter.ToInt32(bytes, 0);
return filetime;
}
private static void RaiseError(string path)
{
FileSystem.RaiseError(path, Marshal.GetLastWin32Error());
}
private static void RaiseError(string path, int code)
{
switch (code)
{
case 2:
throw new FileNotFoundException();
case 3:
throw new DirectoryNotFoundException();
case 5:
throw new UnauthorizedAccessException();
case 15:
throw new DriveNotFoundException();
default:
throw new IOException(new Win32Exception(code).Message);
}
}
public static FileInfo GetFileInfo(string path)
{
FileInfo info = (FileInfo) null;
if (!FileSystem.TryGetFileInfo(path, ref info))
FileSystem.RaiseError(path);
return info;
}
public static bool TryGetFileInfo(string path, ref FileInfo info)
{
string path1 = FileSystem.NormalizePath(path);
Win32Native.WIN32_FILE_ATTRIBUTE_DATA fileData;
if (!Win32Native.GetFileAttributesEx(FileSystem.NormalizePath(path), Win32Native.GET_FILEEX_INFO_LEVELS.GetFileExInfoStandard, ref fileData))
{
switch (Marshal.GetLastWin32Error())
{
case 2:
case 3:
case 50:
case 67:
return false;
default:
throw new ArgumentOutOfRangeException("TryGetFileInfo error path:" + path + " error:" + Conversions.ToString(Marshal.GetLastWin32Error()));
}
}
else
{
info = new FileInfo(path1, fileData);
return true;
}
}
public static bool FileOrDirectoryExists(string path, ref bool isdirectory)
{
Win32Native.ErrorModeType uMode = Win32Native.SetErrorMode(Win32Native.ErrorModeType.SEM_FAILCRITICALERRORS);
Win32Native.WIN32_FILE_ATTRIBUTE_DATA fileData;
bool fileAttributesEx;
try
{
fileAttributesEx = Win32Native.GetFileAttributesEx(FileSystem.NormalizePath(path), Win32Native.GET_FILEEX_INFO_LEVELS.GetFileExInfoStandard, ref fileData);
}
finally
{
int num = (int) Win32Native.SetErrorMode(uMode);
}
if (!fileAttributesEx)
{
int lastWin32Error = Marshal.GetLastWin32Error();
switch (lastWin32Error)
{
case 2:
case 3:
break;
default:
throw new ArgumentOutOfRangeException(path + " " + lastWin32Error.ToString());
}
}
else
isdirectory = (fileData.dwFileAttributes & FileAttributes.Directory) != (FileAttributes) 0;
return fileAttributesEx;
}
public static bool FileExists(string path)
{
Win32Native.ErrorModeType uMode = Win32Native.SetErrorMode(Win32Native.ErrorModeType.SEM_FAILCRITICALERRORS);
Win32Native.WIN32_FILE_ATTRIBUTE_DATA fileData;
bool fileAttributesEx;
try
{
fileAttributesEx = Win32Native.GetFileAttributesEx(FileSystem.NormalizePath(path), Win32Native.GET_FILEEX_INFO_LEVELS.GetFileExInfoStandard, ref fileData);
}
finally
{
int num = (int) Win32Native.SetErrorMode(uMode);
}
if (!fileAttributesEx)
{
switch (Marshal.GetLastWin32Error())
{
case 2:
case 3:
break;
default:
throw new ArgumentOutOfRangeException(path);
}
}
return fileAttributesEx && (fileData.dwFileAttributes & FileAttributes.Directory) == (FileAttributes) 0;
}
public static bool DirectoryExists(string path)
{
Win32Native.ErrorModeType uMode = Win32Native.SetErrorMode(Win32Native.ErrorModeType.SEM_FAILCRITICALERRORS);
Win32Native.WIN32_FILE_ATTRIBUTE_DATA fileData;
bool fileAttributesEx;
try
{
fileAttributesEx = Win32Native.GetFileAttributesEx(FileSystem.NormalizePath(path), Win32Native.GET_FILEEX_INFO_LEVELS.GetFileExInfoStandard, ref fileData);
}
finally
{
int num = (int) Win32Native.SetErrorMode(uMode);
}
if (!fileAttributesEx)
{
switch (Marshal.GetLastWin32Error())
{
case 2:
case 3:
break;
default:
throw new ArgumentOutOfRangeException(path);
}
}
return fileAttributesEx && (fileData.dwFileAttributes & FileAttributes.Directory) != (FileAttributes) 0;
}
public static string[] GetNetworkShare(string host)
{
List<string> stringList = new List<string>();
int entriesread = 0;
int totalentries = 0;
int resume_handle = 0;
int num1 = Marshal.SizeOf(typeof (Win32Native.SHARE_INFO_0));
IntPtr zero = IntPtr.Zero;
int hresult = Win32Native.NetShareEnum(new StringBuilder(host), 0, ref zero, uint.MaxValue, ref entriesread, ref totalentries, ref resume_handle);
if (hresult != 0)
throw new IOException("unknown error", hresult);
try
{
IntPtr ptr = zero;
int num2 = 0;
int num3 = checked (entriesread - 1);
int num4 = num2;
while (num4 <= num3)
{
object structure = Marshal.PtrToStructure(ptr, typeof (Win32Native.SHARE_INFO_0));
Win32Native.SHARE_INFO_0 shareInfo0_1;
Win32Native.SHARE_INFO_0 shareInfo0_2 = structure != null ? (Win32Native.SHARE_INFO_0) structure : shareInfo0_1;
stringList.Add(shareInfo0_2.shi0_netname);
ptr = new IntPtr(checked (ptr.ToInt32() + num1));
checked { ++num4; }
}
}
finally
{
Win32Native.NetApiBufferFree(zero);
}
return stringList.ToArray();
}
public static SafeFileHandle CreateFile(string path, FileAccess access, FileShare share, FileMode mode)
{
return FileSystem.CreateFile(path, access, share, mode, 128U);
}
public static SafeFileHandle CreateFile(string path, FileAccess access, FileShare share, FileMode mode, uint dwFlagsAndAttributes)
{
SafeFileHandle file;
if (mode == FileMode.Append)
{
file = Win32Native.CreateFile(FileSystem.NormalizePath(path), checked ((uint) access), checked ((uint) share), IntPtr.Zero, 4U, dwFlagsAndAttributes | 268435456U, IntPtr.Zero);
if (!file.IsInvalid)
{
int num = (int) Win32Native.SetFilePointer(file, 0, IntPtr.Zero, Win32Native.MoveMethodType.FILE_END);
}
}
else
{
uint dwDesiredAccess;
if (access == FileAccess.Read)
dwDesiredAccess = 2147483648U;
else if (access == FileAccess.Write)
dwDesiredAccess = 1073741824U;
else if (access == FileAccess.ReadWrite)
dwDesiredAccess = 268435456U;
file = Win32Native.CreateFile(FileSystem.NormalizePath(path), dwDesiredAccess, checked ((uint) share), IntPtr.Zero, checked ((uint) mode), dwFlagsAndAttributes, IntPtr.Zero);
}
if (file.IsInvalid)
FileSystem.RaiseError(path);
return file;
}
public static Stream OpenRead(string path)
{
return (Stream) new FileStream(FileSystem.CreateFile(path, FileAccess.Read, FileShare.Read, FileMode.Open), FileAccess.Read);
}
public static void SetFileTime(string path, DateTime creationtime, DateTime accesstime, DateTime writetime)
{
if (DateTime.Compare(creationtime, DateTime.MinValue) == 0 && DateTime.Compare(accesstime, DateTime.MinValue) == 0 && DateTime.Compare(writetime, DateTime.MinValue) == 0)
return;
while (path.EndsWith("\\"))
path = path.Substring(0, checked (path.Length - 1));
using (SafeFileHandle file = Win32Native.CreateFile(FileSystem.NormalizePath(path), 256U, 0U, IntPtr.Zero, 3U, 33554432U, IntPtr.Zero))
{
if (file.IsInvalid)
FileSystem.RaiseError(path);
System.Runtime.InteropServices.ComTypes.FILETIME lpCreationTime = new System.Runtime.InteropServices.ComTypes.FILETIME();
System.Runtime.InteropServices.ComTypes.FILETIME lpLastAccessTime = new System.Runtime.InteropServices.ComTypes.FILETIME();
System.Runtime.InteropServices.ComTypes.FILETIME lpLastWriteTime = new System.Runtime.InteropServices.ComTypes.FILETIME();
if (DateTime.Compare(creationtime, DateTime.MinValue) > 0)
lpCreationTime = FileSystem.ToFileTime(creationtime);
if (DateTime.Compare(accesstime, DateTime.MinValue) > 0)
lpLastAccessTime = FileSystem.ToFileTime(accesstime);
if (DateTime.Compare(writetime, DateTime.MinValue) > 0)
lpLastWriteTime = FileSystem.ToFileTime(writetime);
if (Win32Native.SetFileTime(file, ref lpCreationTime, ref lpLastAccessTime, ref lpLastWriteTime))
return;
FileSystem.RaiseError(path);
}
}
public static FileInfo[] ListDirectoryEntries(string directorypath)
{
if (string.IsNullOrEmpty(directorypath))
throw new ArgumentNullException();
directorypath = directorypath.EndsWith("\\") || directorypath.EndsWith("/") ? FileSystem.CombinePath(directorypath, "*") : FileSystem.CombinePath(directorypath, "\\*");
return FileSystem.FindFiles(directorypath);
}
public static FileInfo[] FindFiles(string path)
{
List<FileInfo> fileInfoList = new List<FileInfo>();
Win32Native.WIN32_FIND_DATA lpFindFileData = new Win32Native.WIN32_FIND_DATA();
int length = path.LastIndexOf("\\");
int num = path.LastIndexOf("/");
if (num > length)
length = num;
string path1 = length >= 0 ? path.Substring(0, length) : Environment.CurrentDirectory;
using (SafeFindHandle firstFile = Win32Native.FindFirstFile(FileSystem.NormalizePath(path), out lpFindFileData))
{
if (firstFile.IsInvalid)
FileSystem.RaiseError(path);
do
{
if (Operators.CompareString(lpFindFileData.cFileName, ".", false) != 0 && Operators.CompareString(lpFindFileData.cFileName, "..", false) != 0)
fileInfoList.Add(new FileInfo(FileSystem.CombinePath(path1, lpFindFileData.cFileName), lpFindFileData));
}
while (Win32Native.FindNextFile(firstFile, out lpFindFileData));
int lastWin32Error = Marshal.GetLastWin32Error();
if (lastWin32Error != 18)
FileSystem.RaiseError(path, lastWin32Error);
}
return fileInfoList.ToArray();
}
public static void CreateDirectory(string path)
{
if (Win32Native.CreateDirectory(FileSystem.NormalizePath(path), IntPtr.Zero))
return;
FileSystem.RaiseError(path);
}
public static void DeleteFile(string path, bool recursive)
{
string str1 = FileSystem.NormalizePath(path);
bool isdirectory;
if (!FileSystem.FileOrDirectoryExists(str1, ref isdirectory))
throw new FileNotFoundException();
if (!isdirectory)
{
if (Win32Native.DeleteFile(str1))
return;
FileSystem.RaiseError(str1);
}
else if (!recursive)
{
if (Win32Native.RemoveDirectory(str1))
return;
FileSystem.RaiseError(str1);
}
else
{
List<string> stringList = new List<string>();
stringList.Add(str1);
while (stringList.Count > 0)
{
string str2 = stringList[checked (stringList.Count - 1)];
FileInfo[] fileInfoArray = FileSystem.ListDirectoryEntries(str2);
if (fileInfoArray.Length == 0)
{
if (!Win32Native.RemoveDirectory(str2))
FileSystem.RaiseError(str2);
stringList.RemoveAt(checked (stringList.Count - 1));
}
else
{
int num1 = 0;
int num2 = checked (fileInfoArray.Length - 1);
int index = num1;
while (index <= num2)
{
if (fileInfoArray[index].IsDirectory)
stringList.Add(FileSystem.NormalizePath(FileSystem.CombinePath(str2, fileInfoArray[index].FileName)));
else if (!Win32Native.DeleteFile(FileSystem.NormalizePath(FileSystem.CombinePath(str2, fileInfoArray[index].FileName))))
FileSystem.RaiseError(str2);
checked { ++index; }
}
}
}
}
}
public static void MoveFile(string path1, string path2, bool overwrite)
{
if (!overwrite ? Win32Native.MoveFileEx(FileSystem.NormalizePath(path1), FileSystem.NormalizePath(path2), Win32Native.MoveFileFlagType.MOVEFILE_COPY_ALLOWED) : Win32Native.MoveFileEx(FileSystem.NormalizePath(path1), FileSystem.NormalizePath(path2), Win32Native.MoveFileFlagType.MOVEFILE_REPLACE_EXISTING | Win32Native.MoveFileFlagType.MOVEFILE_COPY_ALLOWED))
return;
int lastWin32Error = Marshal.GetLastWin32Error();
FileSystem.RaiseError(path1, lastWin32Error);
}
public static void CopyFile(string path1, string path2, bool overwrite)
{
string str1 = FileSystem.NormalizePath(path1);
string str2 = FileSystem.NormalizePath(path2);
bool isdirectory1;
if (!FileSystem.FileOrDirectoryExists(str1, ref isdirectory1))
throw new FileNotFoundException();
bool isdirectory2;
if (!overwrite && FileSystem.FileOrDirectoryExists(str2, ref isdirectory2))
FileSystem.RaiseError(str2, 183);
if (!isdirectory1)
{
if (Win32Native.CopyFile(str1, str2, !overwrite))
return;
FileSystem.RaiseError(str1);
}
else
{
List<string[]> strArrayList = new List<string[]>();
strArrayList.Add(new string[3]{ str1, str2, "d" });
int index1 = 0;
while (index1 < strArrayList.Count)
{
string[] strArray = strArrayList[index1];
if (Operators.CompareString(strArray[2], "d", false) == 0)
{
FileInfo[] fileInfoArray = FileSystem.ListDirectoryEntries(strArray[0]);
int num1 = 0;
int num2 = checked (fileInfoArray.Length - 1);
int index2 = num1;
while (index2 <= num2)
{
if (fileInfoArray[index2].IsDirectory)
strArrayList.Add(new string[3]
{
FileSystem.NormalizePath(FileSystem.CombinePath(strArray[0], fileInfoArray[index2].FileName)),
FileSystem.NormalizePath(FileSystem.CombinePath(strArray[1], fileInfoArray[index2].FileName)),
"d"
});
else
strArrayList.Add(new string[3]
{
FileSystem.NormalizePath(FileSystem.CombinePath(strArray[0], fileInfoArray[index2].FileName)),
FileSystem.NormalizePath(FileSystem.CombinePath(strArray[1], fileInfoArray[index2].FileName)),
"f"
});
checked { ++index2; }
}
}
checked { ++index1; }
}
int index3 = 0;
while (index3 < strArrayList.Count)
{
string[] strArray = strArrayList[index3];
if (Operators.CompareString(strArray[2], "d", false) == 0)
{
if (!Win32Native.CreateDirectory(strArray[1], IntPtr.Zero))
FileSystem.RaiseError(strArray[1]);
}
else if (!Win32Native.CopyFile(strArray[0], strArray[1], !overwrite))
FileSystem.RaiseError(strArray[0]);
checked { ++index3; }
}
}
}
}
}

View File

@@ -0,0 +1,23 @@
// Decompiled with JetBrains decompiler
// Type: Rei.Fs.IO.SafeFindHandle
// 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.Win32.SafeHandles;
namespace Rei.Fs.IO
{
public class SafeFindHandle : SafeHandleMinusOneIsInvalid
{
private SafeFindHandle()
: base(true)
{
}
protected override bool ReleaseHandle()
{
return Win32Native.FindClose(this.handle);
}
}
}

182
Rei.Fs/IO/Win32Native.cs Normal file
View File

@@ -0,0 +1,182 @@
// Decompiled with JetBrains decompiler
// Type: Rei.Fs.IO.Win32Native
// 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 Microsoft.Win32.SafeHandles;
using System;
using System.IO;
using System.Runtime.InteropServices;
using System.Text;
namespace Rei.Fs.IO
{
[StandardModule]
public sealed class Win32Native
{
public const int MAX_PATH = 260;
public const string LongFilePrefix = "\\\\?\\";
public const string LongFileUncPrefix = "\\\\?\\UNC\\";
public const uint MAX_PREFERRED_LENGTH = 4294967295;
[DllImport("kernel32.dll")]
public static extern Win32Native.ErrorModeType SetErrorMode(Win32Native.ErrorModeType uMode);
[DllImport("kernel32.dll", CharSet = CharSet.Unicode, SetLastError = true)]
public static extern bool GetFileAttributesEx(string lpFileName, Win32Native.GET_FILEEX_INFO_LEVELS fInfoLevelId, ref Win32Native.WIN32_FILE_ATTRIBUTE_DATA fileData);
[DllImport("Netapi32.dll", CharSet = CharSet.Unicode, SetLastError = true)]
public static extern int NetShareEnum(StringBuilder ServerName, int level, ref IntPtr bufPtr, uint prefmaxlen, ref int entriesread, ref int totalentries, ref int resume_handle);
[DllImport("Netapi32.dll", CharSet = CharSet.Unicode, SetLastError = true)]
public static extern int NetApiBufferFree(IntPtr buf);
[DllImport("kernel32.dll", CharSet = CharSet.Unicode, SetLastError = true)]
public static extern SafeFileHandle CreateFile(string lpFileName, uint dwDesiredAccess, uint dwShareMode, IntPtr lpAttributes, uint dwCreationDisposition, uint dwFlagsAndAttributes, IntPtr hTemplateFile);
[DllImport("kernel32.dll", CharSet = CharSet.Unicode, SetLastError = true)]
public static extern uint SetFilePointer(SafeFileHandle hFile, int lDistanceToMove, IntPtr lpDistanceToMoveHigh, Win32Native.MoveMethodType dwMoveMethod);
[DllImport("kernel32.dll", CharSet = CharSet.Unicode, SetLastError = true)]
public static extern bool SetFileTime(SafeFileHandle hFile, [In] ref System.Runtime.InteropServices.ComTypes.FILETIME lpCreationTime, [In] ref System.Runtime.InteropServices.ComTypes.FILETIME lpLastAccessTime, [In] ref System.Runtime.InteropServices.ComTypes.FILETIME lpLastWriteTime);
[DllImport("kernel32.dll", CharSet = CharSet.Unicode, SetLastError = true)]
public static extern SafeFindHandle FindFirstFile(string lpFileName, out Win32Native.WIN32_FIND_DATA lpFindFileData);
[DllImport("kernel32.dll", CharSet = CharSet.Unicode, SetLastError = true)]
public static extern bool FindNextFile(SafeFindHandle hFindFile, out Win32Native.WIN32_FIND_DATA lpFindFileData);
[DllImport("kernel32.dll", CharSet = CharSet.Unicode, SetLastError = true)]
public static extern bool FindClose(IntPtr hFindFile);
[DllImport("kernel32.dll", CharSet = CharSet.Unicode, SetLastError = true)]
public static extern bool CreateDirectory(string lpPathName, IntPtr lpSecurityAttributes);
[DllImport("kernel32.dll", CharSet = CharSet.Unicode, SetLastError = true)]
public static extern bool DeleteFile(string lpFileName);
[DllImport("kernel32.dll", CharSet = CharSet.Unicode, SetLastError = true)]
public static extern bool RemoveDirectory(string lpPathName);
[DllImport("kernel32.dll", CharSet = CharSet.Unicode, SetLastError = true)]
public static extern bool MoveFileEx(string lpExistingFileName, string lpNewFileName, Win32Native.MoveFileFlagType dwFlags);
[DllImport("kernel32.dll", CharSet = CharSet.Unicode, SetLastError = true)]
public static extern bool CopyFile(string lpExistingFileName, string lpNewFileName, bool bFailIfExists);
public struct WIN32_FILE_ATTRIBUTE_DATA
{
public FileAttributes dwFileAttributes;
public System.Runtime.InteropServices.ComTypes.FILETIME ftCreationTime;
public System.Runtime.InteropServices.ComTypes.FILETIME ftLastAccessTime;
public System.Runtime.InteropServices.ComTypes.FILETIME ftLastWriteTime;
public uint nFileSizeHigh;
public uint nFileSizeLow;
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]
public struct WIN32_FIND_DATA
{
public FileAttributes dwFileAttributes;
public System.Runtime.InteropServices.ComTypes.FILETIME ftCreationTime;
public System.Runtime.InteropServices.ComTypes.FILETIME ftLastAccessTime;
public System.Runtime.InteropServices.ComTypes.FILETIME ftLastWriteTime;
public uint nFileSizeHigh;
public uint nFileSizeLow;
public uint dwReserved0;
public uint dwReserved1;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 260)]
public string cFileName;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 14)]
public string cAlternateFileName;
}
public enum GET_FILEEX_INFO_LEVELS
{
GetFileExInfoStandard,
GetFileExMaxInfoLevel,
}
[Flags]
public enum ErrorModeType : uint
{
System_DefalutDEFAULT = 0,
SEM_FAILCRITICALERRORS = 1,
SEM_NOALIGNMENTFAULTEXCEPT = 4,
SEM_NOGPFAULTERRORBOX = 2,
SEM_NOOPENFILEERRORBOX = 32768,
}
public enum CreateDispositionType : uint
{
CREATE_NEW = 1,
CREATE_ALWAYS = 2,
OPEN_EXISTING = 3,
OPEN_ALWAYS = 4,
TRUNCATE_EXISTING = 5,
}
[Flags]
public enum FileAttributeType : uint
{
FILE_ATTRIBUTE_READONLY = 1,
FILE_ATTRIBUTE_HIDDEN = 2,
FILE_ATTRIBUTE_SYSTEM = 4,
FILE_ATTRIBUTE_DIRECTORY = 16,
FILE_ATTRIBUTE_ARCHIVE = 32,
FILE_ATTRIBUTE_DEVICE = 64,
FILE_ATTRIBUTE_NORMAL = 128,
FILE_ATTRIBUTE_TEMPORARY = 256,
FILE_ATTRIBUTE_SPARSE_FILE = 512,
FILE_ATTRIBUTE_REPARSE_POINT = 1024,
FILE_ATTRIBUTE_COMPRESSED = 2048,
FILE_ATTRIBUTE_OFFLINE = 4096,
FILE_ATTRIBUTE_NOT_CONTENT_INDEXED = 8192,
FILE_ATTRIBUTE_ENCRYPTED = 16384,
FILE_ATTRIBUTE_VIRTUAL = 65536,
}
public enum MoveMethodType : uint
{
FILE_BEGIN,
FILE_CURRENT,
FILE_END,
}
[Flags]
public enum GenericAccessType : uint
{
GENERIC_READ = 2147483648,
GENERIC_WRITE = 1073741824,
GENERIC_EXECUTE = 536870912,
GENERIC_ALL = 268435456,
}
[Flags]
public enum FileShareType : uint
{
FILE_SHARE_READ = 1,
FILE_SHARE_WRITE = 2,
FILE_SHARE_DELETE = 4,
}
[Flags]
public enum MoveFileFlagType : uint
{
MOVEFILE_REPLACE_EXISTING = 1,
MOVEFILE_COPY_ALLOWED = 2,
MOVEFILE_DELAY_UNTIL_REBOOT = 4,
MOVEFILE_WRITE_THROUGH = 8,
MOVEFILE_CREATE_HARDLINK = 16,
MOVEFILE_FAIL_IF_NOT_TRACKABLE = 32,
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct SHARE_INFO_0
{
public string shi0_netname;
}
}
}

View File

@@ -0,0 +1,41 @@
// Decompiled with JetBrains decompiler
// Type: Rei.Fs.InconsistencyDetectedException
// 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 System;
namespace Rei.Fs
{
public class InconsistencyDetectedException : Exception
{
private Uri _target;
public InconsistencyDetectedException(Uri uri, string message)
: base(message)
{
this._target = uri;
}
public InconsistencyDetectedException(Uri uri, Exception innerexception)
: base("Inconsistency detected. Remote resource was changed during atomic operation.", innerexception)
{
this._target = uri;
}
public InconsistencyDetectedException(Uri uri, string message, Exception innerexception)
: base(message, innerexception)
{
this._target = uri;
}
public Uri TargetUri
{
get
{
return this._target;
}
}
}
}

View File

@@ -0,0 +1,33 @@
// Decompiled with JetBrains decompiler
// Type: Rei.Fs.InvalidRangeException
// 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 System;
namespace Rei.Fs
{
public class InvalidRangeException : Exception
{
public InvalidRangeException(string message, Exception innerexception)
: base(message, innerexception)
{
}
public InvalidRangeException(Exception innerexception)
: this("Invalid Range", innerexception)
{
}
public InvalidRangeException(string message)
: this(message, (Exception) null)
{
}
public InvalidRangeException()
: this("Invalid Range", (Exception) null)
{
}
}
}

View File

@@ -0,0 +1,58 @@
// Decompiled with JetBrains decompiler
// Type: Rei.Fs.InvalidServerResponseException
// 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 System;
namespace Rei.Fs
{
public class InvalidServerResponseException : ApplicationException
{
private string pBody;
public InvalidServerResponseException()
: this("Invalid server response", string.Empty, (Exception) null)
{
}
public InvalidServerResponseException(string message)
: this(message, string.Empty, (Exception) null)
{
}
public InvalidServerResponseException(string message, Exception innerException)
: this(message, (string) null, innerException)
{
}
public InvalidServerResponseException(string message, string body)
: this(message, body, (Exception) null)
{
}
public InvalidServerResponseException(string message, string body, Exception innerException)
: base(message, innerException)
{
if (body == null)
body = string.Empty;
this.pBody = body;
}
public override string ToString()
{
if (this.pBody.Length == 0)
return base.ToString();
return base.ToString() + "\r\nHttp Message Body:" + this.Body;
}
public string Body
{
get
{
return this.pBody;
}
}
}
}

507
Rei.Fs/JsonObject.cs Normal file
View File

@@ -0,0 +1,507 @@
// Decompiled with JetBrains decompiler
// Type: Rei.Fs.JsonObject
// 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.Collections.Generic;
using System.Globalization;
using System.Text;
namespace Rei.Fs
{
public class JsonObject
{
private const string JSONIgnoreChars = " \t\r\n\0";
private JsonObject.JsonType pType;
private string pString;
private long pInteger;
private double pDouble;
private bool pBoolean;
private Dictionary<string, JsonObject> pHash;
private List<JsonObject> pArray;
public static JsonObject ReadJson(string str)
{
JsonObject jsonObject = (JsonObject) null;
JsonObject.InnerReadJson(0, str, ref jsonObject);
return jsonObject;
}
private static string GetSubStrArround(string str, int index)
{
if (string.IsNullOrEmpty(str))
return "";
checked { index -= 30; }
if (index < 0)
index = 0;
int length = 60;
if (str.Length < checked (index + length))
length = checked (str.Length - index);
return str.Substring(index, length);
}
private static int InnerReadJson(int index, string str, ref JsonObject value)
{
try
{
while (" \t\r\n\0".Contains(Conversions.ToString(str[index])))
checked { ++index; }
if ((int) str[index] == 123)
{
Dictionary<string, JsonObject> hash = new Dictionary<string, JsonObject>();
JsonObject jsonObject = (JsonObject) null;
checked { ++index; }
while (" \t\r\n\0".Contains(Conversions.ToString(str[index])))
checked { ++index; }
if ((int) str[index] == 125)
{
value = new JsonObject(hash);
return checked (index + 1);
}
while (true)
{
string key = (string) null;
index = JsonObject.InnreReadJSON_String(index, str, ref key);
while (" \t\r\n\0".Contains(Conversions.ToString(str[index])))
checked { ++index; }
if ((int) str[index] == 58)
{
checked { ++index; }
index = JsonObject.InnerReadJson(index, str, ref jsonObject);
hash.Add(key, jsonObject);
while (" \t\r\n\0".Contains(Conversions.ToString(str[index])))
checked { ++index; }
if ((int) str[index] == 44)
checked { ++index; }
else
goto label_19;
}
else
break;
}
throw new Exception();
label_19:
if ((int) str[index] != 125)
throw new Exception();
checked { ++index; }
value = new JsonObject(hash);
return index;
}
if ((int) str[index] == 91)
{
List<JsonObject> array = new List<JsonObject>();
JsonObject jsonObject = (JsonObject) null;
checked { ++index; }
while (" \t\r\n\0".Contains(Conversions.ToString(str[index])))
checked { ++index; }
if ((int) str[index] == 93)
{
value = new JsonObject(array);
return checked (index + 1);
}
while (true)
{
index = JsonObject.InnerReadJson(index, str, ref jsonObject);
array.Add(jsonObject);
while (" \t\r\n\0".Contains(Conversions.ToString(str[index])))
checked { ++index; }
if ((int) str[index] == 44)
checked { ++index; }
else
break;
}
if ((int) str[index] != 93)
throw new Exception();
checked { ++index; }
value = new JsonObject(array);
return index;
}
if ((int) str[index] == 34)
{
string str1 = (string) null;
index = JsonObject.InnreReadJSON_String(index, str, ref str1);
value = new JsonObject(str1);
return index;
}
if (checked (str.Length - index) > 4 && Operators.CompareString(str.Substring(index, 4).ToLowerInvariant(), "true", false) == 0)
{
value = new JsonObject(true);
return checked (index + 4);
}
if (checked (str.Length - index) > 5 && Operators.CompareString(str.Substring(index, 5).ToLowerInvariant(), "false", false) == 0)
{
value = new JsonObject(false);
return checked (index + 5);
}
if (checked (str.Length - index) > 4 && Operators.CompareString(str.Substring(index, 4).ToLowerInvariant(), "null", false) == 0)
{
value = new JsonObject();
return checked (index + 4);
}
int startIndex = index;
while ("+-0123456789".Contains(Conversions.ToString(str[index])))
checked { ++index; }
if ((int) str[index] == 101 || (int) str[index] == 69 || (int) str[index] == 46)
{
while ("+-0123456789.eE".Contains(Conversions.ToString(str[index])))
checked { ++index; }
double result;
if (double.TryParse(str.Substring(startIndex, checked (index - startIndex)), NumberStyles.Any, (IFormatProvider) CultureInfo.InvariantCulture, out result))
{
value = new JsonObject(result);
return index;
}
}
else
{
long result;
if (long.TryParse(str.Substring(startIndex, checked (index - startIndex)), out result))
{
value = new JsonObject(result);
return index;
}
}
throw new Exception();
}
catch (Exception ex) when (
{
// ISSUE: unable to correctly present filter
ProjectData.SetProjectError(ex);
if (!(ex is InvalidServerResponseException))
{
SuccessfulFiltering;
}
else
throw;
}
)
{
throw new InvalidServerResponseException("Cannot parse server response. index:" + index.ToString() + " arround: \"" + JsonObject.GetSubStrArround(str, index) + "\"");
}
}
private static int InnreReadJSON_String(int index, string str, ref string value)
{
try
{
while (" \t\r\n\0".Contains(Conversions.ToString(str[index])))
checked { ++index; }
if ((int) str[index] != 34)
throw new Exception();
checked { ++index; }
StringBuilder stringBuilder = new StringBuilder();
while (true)
{
while ((int) str[index] != 92)
{
if ((int) str[index] != 34)
{
stringBuilder.Append(str[index]);
checked { ++index; }
}
else
{
value = stringBuilder.ToString();
return checked (index + 1);
}
}
checked { ++index; }
if ((int) str[index] == 98)
stringBuilder.Append("\b");
else if ((int) str[index] == 102)
stringBuilder.Append("\f");
else if ((int) str[index] == 110)
stringBuilder.Append("\n");
else if ((int) str[index] == 114)
stringBuilder.Append("\r");
else if ((int) str[index] == 116)
stringBuilder.Append("\t");
else if ((int) str[index] == 117)
{
stringBuilder.Append(Convert.ToChar(Convert.ToUInt32(str.Substring(checked (index + 1), 4), 16)));
checked { index += 4; }
}
else
stringBuilder.Append(str[index]);
checked { ++index; }
}
}
catch (Exception ex) when (
{
// ISSUE: unable to correctly present filter
ProjectData.SetProjectError(ex);
if (!(ex is InvalidServerResponseException))
{
SuccessfulFiltering;
}
else
throw;
}
)
{
throw new InvalidServerResponseException("Cannot parse server response. index:" + index.ToString() + " arround: \"" + JsonObject.GetSubStrArround(str, index) + "\"");
}
}
public static string EscapeString(string str)
{
StringBuilder stringBuilder = new StringBuilder(checked (str.Length * 2));
stringBuilder.Append("\"");
int num1 = 0;
int num2 = checked (str.Length - 1);
int index = num1;
while (index <= num2)
{
char ch = str[index];
if (Operators.CompareString(Conversions.ToString(ch), "\b", false) == 0)
stringBuilder.Append("\\b");
else if (Operators.CompareString(Conversions.ToString(ch), "\f", false) == 0)
stringBuilder.Append("\\f");
else if (Operators.CompareString(Conversions.ToString(ch), "\n", false) == 0)
stringBuilder.Append("\\n");
else if (Operators.CompareString(Conversions.ToString(ch), "\r", false) == 0)
stringBuilder.Append("\\r");
else if (Operators.CompareString(Conversions.ToString(ch), "\t", false) == 0)
stringBuilder.Append("\\t");
else if (Convert.ToInt32(ch) < 32)
stringBuilder.Append("\\u" + Convert.ToInt32(ch).ToString("X4"));
else if (Operators.CompareString(Conversions.ToString(ch), "\"", false) == 0)
{
stringBuilder.Append("\\u0022");
}
else
{
if ((int) ch == 34 || (int) ch == 92)
stringBuilder.Append("\\");
stringBuilder.Append(ch);
}
checked { ++index; }
}
stringBuilder.Append("\"");
return stringBuilder.ToString();
}
public static string EscapeStringAscii(string str)
{
StringBuilder stringBuilder = new StringBuilder(checked (str.Length * 2));
stringBuilder.Append("\"");
int num1 = 0;
int num2 = checked (str.Length - 1);
int index = num1;
while (index <= num2)
{
char ch = str[index];
if (Operators.CompareString(Conversions.ToString(ch), "\b", false) == 0)
stringBuilder.Append("\\b");
else if (Operators.CompareString(Conversions.ToString(ch), "\f", false) == 0)
stringBuilder.Append("\\f");
else if (Operators.CompareString(Conversions.ToString(ch), "\n", false) == 0)
stringBuilder.Append("\\n");
else if (Operators.CompareString(Conversions.ToString(ch), "\r", false) == 0)
stringBuilder.Append("\\r");
else if (Operators.CompareString(Conversions.ToString(ch), "\t", false) == 0)
stringBuilder.Append("\\t");
else if (Convert.ToInt32(ch) < 32 || Convert.ToInt32(ch) >= (int) sbyte.MaxValue)
stringBuilder.Append("\\u" + Convert.ToInt32(ch).ToString("X4"));
else if (Operators.CompareString(Conversions.ToString(ch), "\"", false) == 0)
{
stringBuilder.Append("\\u0022");
}
else
{
if ((int) ch == 34 || (int) ch == 92)
stringBuilder.Append("\\");
stringBuilder.Append(ch);
}
checked { ++index; }
}
stringBuilder.Append("\"");
return stringBuilder.ToString();
}
public JsonObject()
{
this.pType = JsonObject.JsonType.Nothing;
}
public JsonObject(string str)
{
this.pType = JsonObject.JsonType.String;
this.pString = str;
}
public JsonObject(long number)
{
this.pType = JsonObject.JsonType.Integer;
this.pInteger = number;
}
public JsonObject(double number)
{
this.pType = JsonObject.JsonType.Double;
this.pDouble = number;
}
public JsonObject(bool @bool)
{
this.pType = JsonObject.JsonType.Boolean;
this.pBoolean = @bool;
}
public JsonObject(Dictionary<string, JsonObject> hash)
{
this.pType = JsonObject.JsonType.Hash;
this.pHash = hash;
}
public JsonObject(List<JsonObject> array)
{
this.pType = JsonObject.JsonType.Array;
this.pArray = array;
}
public JsonObject.JsonType Type
{
get
{
return this.pType;
}
}
public string String
{
get
{
return this.pString;
}
}
public long Integer
{
get
{
return this.pInteger;
}
}
public double Double
{
get
{
return this.pDouble;
}
}
public bool Boolean
{
get
{
return this.pBoolean;
}
}
public Dictionary<string, JsonObject> Hash
{
get
{
return this.pHash;
}
}
public List<JsonObject> Array
{
get
{
return this.pArray;
}
}
public bool IsNothing
{
get
{
return this.Type == JsonObject.JsonType.Nothing;
}
}
public JsonObject this[string name]
{
get
{
if (this.Type != JsonObject.JsonType.Hash)
return new JsonObject();
if (!this.Hash.ContainsKey(name))
return new JsonObject();
return this.Hash[name];
}
set
{
if (this.Type != JsonObject.JsonType.Hash)
throw new InvalidOperationException();
this.Hash.Add(name, value);
}
}
public JsonObject this[int index]
{
get
{
if (this.Type != JsonObject.JsonType.Array)
return new JsonObject();
if (index < 0)
throw new ArgumentOutOfRangeException();
if (index >= this.Array.Count)
return new JsonObject();
return this.Array[index];
}
set
{
if (this.Type != JsonObject.JsonType.Array)
throw new InvalidOperationException();
if (index < 0)
throw new ArgumentOutOfRangeException();
if (index > this.Array.Count)
throw new ArgumentOutOfRangeException();
if (index == this.Array.Count)
this.Array.Add(value);
else
this.Array[index] = value;
}
}
public DateTime GetAsDateTime()
{
if (this.Type == JsonObject.JsonType.Nothing)
return DateTime.MinValue;
return DateTime.Parse(this.String, (IFormatProvider) CultureInfo.InvariantCulture);
}
public long IntegerWithDefault(long @default)
{
if (this.Type == JsonObject.JsonType.Integer)
return this.Integer;
return @default;
}
public string StringWithDefault(string @default)
{
if (this.Type == JsonObject.JsonType.String)
return this.String;
return @default;
}
public enum JsonType
{
String,
Integer,
Double,
Boolean,
Nothing,
Hash,
Array,
}
}
}

522
Rei.Fs/LinkListForm.cs Normal file
View File

@@ -0,0 +1,522 @@
// Decompiled with JetBrains decompiler
// Type: Rei.Fs.LinkListForm
// 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 Rei.Fs.My;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing;
using System.Runtime.CompilerServices;
using System.Windows.Forms;
namespace Rei.Fs
{
[DesignerGenerated]
public class LinkListForm : Form
{
private IContainer components;
[AccessedThroughProperty("ButtonClose")]
private Button _ButtonClose;
[AccessedThroughProperty("ListView1")]
private ListView _ListView1;
[AccessedThroughProperty("ColumnHeader1")]
private ColumnHeader _ColumnHeader1;
[AccessedThroughProperty("ColumnHeader2")]
private ColumnHeader _ColumnHeader2;
[AccessedThroughProperty("ColumnHeader3")]
private ColumnHeader _ColumnHeader3;
[AccessedThroughProperty("ButtonCopy")]
private Button _ButtonCopy;
[AccessedThroughProperty("ContextMenuStrip1")]
private ContextMenuStrip _ContextMenuStrip1;
[AccessedThroughProperty("SelectAllToolStripMenuItem")]
private ToolStripMenuItem _SelectAllToolStripMenuItem;
[AccessedThroughProperty("CopyToolStripMenuItem")]
private ToolStripMenuItem _CopyToolStripMenuItem;
[AccessedThroughProperty("CopyAllToolStripMenuItem")]
private ToolStripMenuItem _CopyAllToolStripMenuItem;
[AccessedThroughProperty("ToolStripSeparator1")]
private ToolStripSeparator _ToolStripSeparator1;
private const int MinColWidth = 32;
public string[] Data;
private bool columchangingflag;
public LinkListForm()
{
this.Load += new EventHandler(this.SharedLinkForm_Load);
this.columchangingflag = false;
this.InitializeComponent();
}
[DebuggerNonUserCode]
protected override void Dispose(bool disposing)
{
try
{
if (!disposing || this.components == null)
return;
this.components.Dispose();
}
finally
{
base.Dispose(disposing);
}
}
[DebuggerStepThrough]
private void InitializeComponent()
{
this.components = (IContainer) new System.ComponentModel.Container();
this.ButtonClose = new Button();
this.ListView1 = new ListView();
this.ColumnHeader1 = new ColumnHeader();
this.ColumnHeader2 = new ColumnHeader();
this.ColumnHeader3 = new ColumnHeader();
this.ContextMenuStrip1 = new ContextMenuStrip(this.components);
this.CopyToolStripMenuItem = new ToolStripMenuItem();
this.CopyAllToolStripMenuItem = new ToolStripMenuItem();
this.ToolStripSeparator1 = new ToolStripSeparator();
this.SelectAllToolStripMenuItem = new ToolStripMenuItem();
this.ButtonCopy = new Button();
this.ContextMenuStrip1.SuspendLayout();
this.SuspendLayout();
this.ButtonClose.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
Button buttonClose1 = this.ButtonClose;
Point point1 = new Point(152, 152);
Point point2 = point1;
buttonClose1.Location = point2;
this.ButtonClose.Name = "ButtonClose";
Button buttonClose2 = this.ButtonClose;
Size size1 = new Size(72, 24);
Size size2 = size1;
buttonClose2.Size = size2;
this.ButtonClose.TabIndex = 2;
this.ButtonClose.Text = "Close";
this.ButtonClose.UseVisualStyleBackColor = true;
this.ListView1.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
this.ListView1.Columns.AddRange(new ColumnHeader[3]
{
this.ColumnHeader1,
this.ColumnHeader2,
this.ColumnHeader3
});
this.ListView1.ContextMenuStrip = this.ContextMenuStrip1;
this.ListView1.FullRowSelect = true;
this.ListView1.GridLines = true;
this.ListView1.HideSelection = false;
ListView listView1_1 = this.ListView1;
point1 = new Point(8, 8);
Point point3 = point1;
listView1_1.Location = point3;
this.ListView1.Name = "ListView1";
ListView listView1_2 = this.ListView1;
size1 = new Size(216, 136);
Size size3 = size1;
listView1_2.Size = size3;
this.ListView1.TabIndex = 0;
this.ListView1.UseCompatibleStateImageBehavior = false;
this.ListView1.View = View.Details;
this.ColumnHeader1.Text = "Path";
this.ColumnHeader2.Text = "State";
this.ColumnHeader3.Text = "SharedLink";
this.ContextMenuStrip1.Items.AddRange(new ToolStripItem[4]
{
(ToolStripItem) this.CopyToolStripMenuItem,
(ToolStripItem) this.CopyAllToolStripMenuItem,
(ToolStripItem) this.ToolStripSeparator1,
(ToolStripItem) this.SelectAllToolStripMenuItem
});
this.ContextMenuStrip1.Name = "ContextMenuStrip1";
ContextMenuStrip contextMenuStrip1 = this.ContextMenuStrip1;
size1 = new Size(167, 76);
Size size4 = size1;
contextMenuStrip1.Size = size4;
this.CopyToolStripMenuItem.Name = "CopyToolStripMenuItem";
this.CopyToolStripMenuItem.ShortcutKeys = Keys.C | Keys.Control;
ToolStripMenuItem toolStripMenuItem1 = this.CopyToolStripMenuItem;
size1 = new Size(166, 22);
Size size5 = size1;
toolStripMenuItem1.Size = size5;
this.CopyToolStripMenuItem.Text = "Copy Link";
this.CopyAllToolStripMenuItem.Name = "CopyAllToolStripMenuItem";
ToolStripMenuItem toolStripMenuItem2 = this.CopyAllToolStripMenuItem;
size1 = new Size(166, 22);
Size size6 = size1;
toolStripMenuItem2.Size = size6;
this.CopyAllToolStripMenuItem.Text = "Copy All";
this.ToolStripSeparator1.Name = "ToolStripSeparator1";
ToolStripSeparator toolStripSeparator1 = this.ToolStripSeparator1;
size1 = new Size(163, 6);
Size size7 = size1;
toolStripSeparator1.Size = size7;
this.SelectAllToolStripMenuItem.Name = "SelectAllToolStripMenuItem";
this.SelectAllToolStripMenuItem.ShortcutKeys = Keys.A | Keys.Control;
ToolStripMenuItem toolStripMenuItem3 = this.SelectAllToolStripMenuItem;
size1 = new Size(166, 22);
Size size8 = size1;
toolStripMenuItem3.Size = size8;
this.SelectAllToolStripMenuItem.Text = "Select All";
this.ButtonCopy.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
Button buttonCopy1 = this.ButtonCopy;
point1 = new Point(72, 152);
Point point4 = point1;
buttonCopy1.Location = point4;
this.ButtonCopy.Name = "ButtonCopy";
Button buttonCopy2 = this.ButtonCopy;
size1 = new Size(72, 24);
Size size9 = size1;
buttonCopy2.Size = size9;
this.ButtonCopy.TabIndex = 1;
this.ButtonCopy.Text = "Copy";
this.ButtonCopy.UseVisualStyleBackColor = true;
this.AcceptButton = (IButtonControl) this.ButtonClose;
this.AutoScaleDimensions = new SizeF(6f, 12f);
this.AutoScaleMode = AutoScaleMode.Font;
size1 = new Size(233, 185);
this.ClientSize = size1;
this.Controls.Add((Control) this.ListView1);
this.Controls.Add((Control) this.ButtonCopy);
this.Controls.Add((Control) this.ButtonClose);
size1 = new Size(249, 223);
this.MinimumSize = size1;
this.Name = "SharedLinkForm";
this.Text = "SharedLink Form";
this.ContextMenuStrip1.ResumeLayout(false);
this.ResumeLayout(false);
}
internal virtual Button ButtonClose
{
get
{
return this._ButtonClose;
}
[MethodImpl(MethodImplOptions.Synchronized)] set
{
EventHandler eventHandler = new EventHandler(this.ButtonClose_Click);
if (this._ButtonClose != null)
this._ButtonClose.Click -= eventHandler;
this._ButtonClose = value;
if (this._ButtonClose == null)
return;
this._ButtonClose.Click += eventHandler;
}
}
internal virtual ListView ListView1
{
get
{
return this._ListView1;
}
[MethodImpl(MethodImplOptions.Synchronized)] set
{
EventHandler eventHandler1 = new EventHandler(this.ListView1_ClientSizeChanged);
EventHandler eventHandler2 = new EventHandler(this.ListView1_SelectedIndexChanged);
ColumnWidthChangedEventHandler changedEventHandler = new ColumnWidthChangedEventHandler(this.ListView1_ColumnWidthChanged);
if (this._ListView1 != null)
{
this._ListView1.ClientSizeChanged -= eventHandler1;
this._ListView1.SelectedIndexChanged -= eventHandler2;
this._ListView1.ColumnWidthChanged -= changedEventHandler;
}
this._ListView1 = value;
if (this._ListView1 == null)
return;
this._ListView1.ClientSizeChanged += eventHandler1;
this._ListView1.SelectedIndexChanged += eventHandler2;
this._ListView1.ColumnWidthChanged += changedEventHandler;
}
}
internal virtual ColumnHeader ColumnHeader1
{
get
{
return this._ColumnHeader1;
}
[MethodImpl(MethodImplOptions.Synchronized)] set
{
this._ColumnHeader1 = value;
}
}
internal virtual ColumnHeader ColumnHeader2
{
get
{
return this._ColumnHeader2;
}
[MethodImpl(MethodImplOptions.Synchronized)] set
{
this._ColumnHeader2 = value;
}
}
internal virtual ColumnHeader ColumnHeader3
{
get
{
return this._ColumnHeader3;
}
[MethodImpl(MethodImplOptions.Synchronized)] set
{
this._ColumnHeader3 = value;
}
}
internal virtual Button ButtonCopy
{
get
{
return this._ButtonCopy;
}
[MethodImpl(MethodImplOptions.Synchronized)] set
{
EventHandler eventHandler = new EventHandler(this.ButtonCopy_Click);
if (this._ButtonCopy != null)
this._ButtonCopy.Click -= eventHandler;
this._ButtonCopy = value;
if (this._ButtonCopy == null)
return;
this._ButtonCopy.Click += eventHandler;
}
}
internal virtual ContextMenuStrip ContextMenuStrip1
{
get
{
return this._ContextMenuStrip1;
}
[MethodImpl(MethodImplOptions.Synchronized)] set
{
this._ContextMenuStrip1 = value;
}
}
internal virtual ToolStripMenuItem SelectAllToolStripMenuItem
{
get
{
return this._SelectAllToolStripMenuItem;
}
[MethodImpl(MethodImplOptions.Synchronized)] set
{
EventHandler eventHandler = new EventHandler(this.SelectAllToolStripMenuItem_Click);
if (this._SelectAllToolStripMenuItem != null)
this._SelectAllToolStripMenuItem.Click -= eventHandler;
this._SelectAllToolStripMenuItem = value;
if (this._SelectAllToolStripMenuItem == null)
return;
this._SelectAllToolStripMenuItem.Click += eventHandler;
}
}
internal virtual ToolStripMenuItem CopyToolStripMenuItem
{
get
{
return this._CopyToolStripMenuItem;
}
[MethodImpl(MethodImplOptions.Synchronized)] set
{
EventHandler eventHandler = new EventHandler(this.ButtonCopy_Click);
if (this._CopyToolStripMenuItem != null)
this._CopyToolStripMenuItem.Click -= eventHandler;
this._CopyToolStripMenuItem = value;
if (this._CopyToolStripMenuItem == null)
return;
this._CopyToolStripMenuItem.Click += eventHandler;
}
}
internal virtual ToolStripMenuItem CopyAllToolStripMenuItem
{
get
{
return this._CopyAllToolStripMenuItem;
}
[MethodImpl(MethodImplOptions.Synchronized)] set
{
EventHandler eventHandler = new EventHandler(this.CopyAllToolStripMenuItem_Click);
if (this._CopyAllToolStripMenuItem != null)
this._CopyAllToolStripMenuItem.Click -= eventHandler;
this._CopyAllToolStripMenuItem = value;
if (this._CopyAllToolStripMenuItem == null)
return;
this._CopyAllToolStripMenuItem.Click += eventHandler;
}
}
internal virtual ToolStripSeparator ToolStripSeparator1
{
get
{
return this._ToolStripSeparator1;
}
[MethodImpl(MethodImplOptions.Synchronized)] set
{
this._ToolStripSeparator1 = value;
}
}
private void SharedLinkForm_Load(object sender, EventArgs e)
{
this.ListView1.BeginUpdate();
int num1 = 0;
int num2 = checked (this.Data.Length - 1);
int index = num1;
while (index <= num2)
{
ListViewItem listViewItem = new ListViewItem(this.Data[index].Split(new string[1]
{
"\t"
}, 3, StringSplitOptions.None));
if (Operators.CompareString(listViewItem.SubItems[1].Text, "error", false) == 0)
listViewItem.SubItems[1].ForeColor = Color.Red;
listViewItem.Selected = true;
this.ListView1.Items.Add(listViewItem);
checked { ++index; }
}
this.ListView1.EndUpdate();
}
private void ButtonClose_Click(object sender, EventArgs e)
{
this.Close();
this.Dispose();
}
private void ButtonCopy_Click(object sender, EventArgs e)
{
List<string> stringList = new List<string>();
int num1 = 0;
int num2 = checked (this.ListView1.Items.Count - 1);
int index = num1;
while (index <= num2)
{
if (this.ListView1.Items[index].Selected)
stringList.Add(this.ListView1.Items[index].SubItems[2].Text);
checked { ++index; }
}
string text = string.Join("\r\n", stringList.ToArray());
if (string.IsNullOrEmpty(text))
return;
MyProject.Computer.Clipboard.SetText(text, TextDataFormat.Text);
}
private void CopyAllToolStripMenuItem_Click(object sender, EventArgs e)
{
List<string> stringList = new List<string>();
int num1 = 0;
int num2 = checked (this.ListView1.Items.Count - 1);
int index = num1;
while (index <= num2)
{
if (this.ListView1.Items[index].Selected)
stringList.Add(this.Data[index]);
checked { ++index; }
}
string text = string.Join("\r\n", stringList.ToArray());
if (string.IsNullOrEmpty(text))
return;
MyProject.Computer.Clipboard.SetText(text, TextDataFormat.Text);
}
private void SelectAllToolStripMenuItem_Click(object sender, EventArgs e)
{
this.ListView1.BeginUpdate();
int num1 = 0;
int num2 = checked (this.ListView1.Items.Count - 1);
int index = num1;
while (index <= num2)
{
this.ListView1.Items[index].Selected = true;
checked { ++index; }
}
this.ListView1.EndUpdate();
}
private void ListView1_ClientSizeChanged(object sender, EventArgs e)
{
if (this.columchangingflag)
return;
this.columchangingflag = true;
int num1 = this.ListView1.Columns[0].Width;
if (num1 < 32)
num1 = 32;
int num2 = this.ListView1.Columns[1].Width;
if (num2 < 32)
num2 = 32;
int num3 = checked (this.ListView1.ClientSize.Width - num1 - num2);
if (num3 < 32)
{
num3 = 32;
Size clientSize = this.ListView1.ClientSize;
num2 = checked (clientSize.Width - num1 - num3);
if (num2 < 32)
{
num2 = 32;
clientSize = this.ListView1.ClientSize;
num1 = checked (clientSize.Width - num2 - num3);
if (num1 < 32)
num1 = 32;
}
}
this.ListView1.BeginUpdate();
this.ListView1.Columns[0].Width = num1;
this.ListView1.Columns[1].Width = num2;
this.ListView1.Columns[2].Width = num3;
this.ListView1.EndUpdate();
this.columchangingflag = false;
}
private void ListView1_ColumnWidthChanged(object sender, ColumnWidthChangedEventArgs e)
{
if (this.columchangingflag)
return;
this.columchangingflag = true;
int num1 = this.ListView1.Columns[0].Width;
if (num1 < 32)
num1 = 32;
int num2 = this.ListView1.Columns[1].Width;
if (num2 < 32)
num2 = 32;
int num3 = checked (this.ListView1.ClientSize.Width - num1 - num2);
if (num3 < 32)
{
num3 = 32;
Size clientSize = this.ListView1.ClientSize;
num2 = checked (clientSize.Width - num1 - num3);
if (num2 < 32)
{
num2 = 32;
clientSize = this.ListView1.ClientSize;
num1 = checked (clientSize.Width - num2 - num3);
if (num1 < 32)
num1 = 32;
}
}
this.ListView1.BeginUpdate();
this.ListView1.Columns[0].Width = num1;
this.ListView1.Columns[1].Width = num2;
this.ListView1.Columns[2].Width = num3;
this.ListView1.EndUpdate();
this.columchangingflag = false;
}
private void ListView1_SelectedIndexChanged(object sender, EventArgs e)
{
if (this.ListView1.SelectedItems.Count == 0)
this.ButtonCopy.Enabled = false;
else
this.ButtonCopy.Enabled = true;
}
}
}

120
Rei.Fs/LinkListForm.resx Normal file
View File

@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@@ -0,0 +1,33 @@
// Decompiled with JetBrains decompiler
// Type: Rei.Fs.LogMessageEventArgs
// 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 System;
namespace Rei.Fs
{
public class LogMessageEventArgs : EventArgs
{
private string pMessage;
public LogMessageEventArgs(string message)
{
this.pMessage = message;
}
public LogMessageEventArgs(string[] messages)
{
this.pMessage = string.Join(" ", messages);
}
public string Message
{
get
{
return this.pMessage;
}
}
}
}

View File

@@ -0,0 +1,18 @@
// Decompiled with JetBrains decompiler
// Type: Rei.Fs.My.MyApplication
// 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.ApplicationServices;
using System.CodeDom.Compiler;
using System.ComponentModel;
namespace Rei.Fs.My
{
[EditorBrowsable(EditorBrowsableState.Never)]
[GeneratedCode("MyTemplate", "8.0.0.0")]
internal class MyApplication : ApplicationBase
{
}
}

24
Rei.Fs/My/MyComputer.cs Normal file
View File

@@ -0,0 +1,24 @@
// Decompiled with JetBrains decompiler
// Type: Rei.Fs.My.MyComputer
// 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.Devices;
using System.CodeDom.Compiler;
using System.ComponentModel;
using System.Diagnostics;
namespace Rei.Fs.My
{
[GeneratedCode("MyTemplate", "8.0.0.0")]
[EditorBrowsable(EditorBrowsableState.Never)]
internal class MyComputer : Computer
{
[EditorBrowsable(EditorBrowsableState.Never)]
[DebuggerHidden]
public MyComputer()
{
}
}
}

148
Rei.Fs/My/MyProject.cs Normal file
View File

@@ -0,0 +1,148 @@
// Decompiled with JetBrains decompiler
// Type: Rei.Fs.My.MyProject
// 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;
using Microsoft.VisualBasic.ApplicationServices;
using Microsoft.VisualBasic.CompilerServices;
using Microsoft.VisualBasic.MyServices.Internal;
using System;
using System.CodeDom.Compiler;
using System.ComponentModel;
using System.ComponentModel.Design;
using System.Diagnostics;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
namespace Rei.Fs.My
{
[HideModuleName]
[StandardModule]
[GeneratedCode("MyTemplate", "8.0.0.0")]
internal sealed class MyProject
{
private static readonly MyProject.ThreadSafeObjectProvider<MyComputer> m_ComputerObjectProvider = new MyProject.ThreadSafeObjectProvider<MyComputer>();
private static readonly MyProject.ThreadSafeObjectProvider<MyApplication> m_AppObjectProvider = new MyProject.ThreadSafeObjectProvider<MyApplication>();
private static readonly MyProject.ThreadSafeObjectProvider<User> m_UserObjectProvider = new MyProject.ThreadSafeObjectProvider<User>();
private static readonly MyProject.ThreadSafeObjectProvider<MyProject.MyWebServices> m_MyWebServicesObjectProvider = new MyProject.ThreadSafeObjectProvider<MyProject.MyWebServices>();
[HelpKeyword("My.Computer")]
internal static MyComputer Computer
{
[DebuggerHidden] get
{
return MyProject.m_ComputerObjectProvider.GetInstance;
}
}
[HelpKeyword("My.Application")]
internal static MyApplication Application
{
[DebuggerHidden] get
{
return MyProject.m_AppObjectProvider.GetInstance;
}
}
[HelpKeyword("My.User")]
internal static User User
{
[DebuggerHidden] get
{
return MyProject.m_UserObjectProvider.GetInstance;
}
}
[HelpKeyword("My.WebServices")]
internal static MyProject.MyWebServices WebServices
{
[DebuggerHidden] get
{
return MyProject.m_MyWebServicesObjectProvider.GetInstance;
}
}
[EditorBrowsable(EditorBrowsableState.Never)]
[MyGroupCollection("System.Web.Services.Protocols.SoapHttpClientProtocol", "Create__Instance__", "Dispose__Instance__", "")]
internal sealed class MyWebServices
{
[DebuggerHidden]
[EditorBrowsable(EditorBrowsableState.Never)]
public override bool Equals(object o)
{
return base.Equals(RuntimeHelpers.GetObjectValue(o));
}
[DebuggerHidden]
[EditorBrowsable(EditorBrowsableState.Never)]
public override int GetHashCode()
{
return base.GetHashCode();
}
[DebuggerHidden]
[EditorBrowsable(EditorBrowsableState.Never)]
internal new Type GetType()
{
return typeof (MyProject.MyWebServices);
}
[EditorBrowsable(EditorBrowsableState.Never)]
[DebuggerHidden]
public override string ToString()
{
return base.ToString();
}
[DebuggerHidden]
private static T Create__Instance__<T>(T instance) where T : new()
{
if ((object) instance == null)
return Activator.CreateInstance<T>();
return instance;
}
[DebuggerHidden]
private void Dispose__Instance__<T>(ref T instance)
{
instance = default (T);
}
[EditorBrowsable(EditorBrowsableState.Never)]
[DebuggerHidden]
public MyWebServices()
{
}
}
[ComVisible(false)]
[EditorBrowsable(EditorBrowsableState.Never)]
internal sealed class ThreadSafeObjectProvider<T> where T : new()
{
private readonly ContextValue<T> m_Context;
internal T GetInstance
{
[DebuggerHidden] get
{
T instance = this.m_Context.Value;
if ((object) instance == null)
{
instance = Activator.CreateInstance<T>();
this.m_Context.Value = instance;
}
return instance;
}
}
[EditorBrowsable(EditorBrowsableState.Never)]
[DebuggerHidden]
public ThreadSafeObjectProvider()
{
this.m_Context = new ContextValue<T>();
}
}
}
}

29
Rei.Fs/My/MySettings.cs Normal file
View File

@@ -0,0 +1,29 @@
// Decompiled with JetBrains decompiler
// Type: Rei.Fs.My.MySettings
// 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 System.CodeDom.Compiler;
using System.ComponentModel;
using System.Configuration;
using System.Runtime.CompilerServices;
namespace Rei.Fs.My
{
[CompilerGenerated]
[GeneratedCode("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")]
[EditorBrowsable(EditorBrowsableState.Advanced)]
internal sealed class MySettings : ApplicationSettingsBase
{
private static MySettings defaultInstance = (MySettings) SettingsBase.Synchronized((SettingsBase) new MySettings());
public static MySettings Default
{
get
{
return MySettings.defaultInstance;
}
}
}
}

View File

@@ -0,0 +1,30 @@
// Decompiled with JetBrains decompiler
// Type: Rei.Fs.My.MySettingsProperty
// 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;
using Microsoft.VisualBasic.CompilerServices;
using System.ComponentModel.Design;
using System.Diagnostics;
using System.Runtime.CompilerServices;
namespace Rei.Fs.My
{
[StandardModule]
[CompilerGenerated]
[HideModuleName]
[DebuggerNonUserCode]
internal sealed class MySettingsProperty
{
[HelpKeyword("My.Settings")]
internal static MySettings Settings
{
get
{
return MySettings.Default;
}
}
}
}

View File

@@ -0,0 +1,69 @@
// Decompiled with JetBrains decompiler
// Type: Rei.Fs.My.Resources.Resources
// 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;
using Microsoft.VisualBasic.CompilerServices;
using System.CodeDom.Compiler;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing;
using System.Globalization;
using System.Resources;
using System.Runtime.CompilerServices;
namespace Rei.Fs.My.Resources
{
[CompilerGenerated]
[StandardModule]
[GeneratedCode("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[HideModuleName]
[DebuggerNonUserCode]
internal sealed class Resources
{
private static ResourceManager resourceMan;
private static CultureInfo resourceCulture;
[EditorBrowsable(EditorBrowsableState.Advanced)]
internal static ResourceManager ResourceManager
{
get
{
if (object.ReferenceEquals((object) Rei.Fs.My.Resources.Resources.resourceMan, (object) null))
Rei.Fs.My.Resources.Resources.resourceMan = new ResourceManager("Rei.Fs.Resources", typeof (Rei.Fs.My.Resources.Resources).Assembly);
return Rei.Fs.My.Resources.Resources.resourceMan;
}
}
[EditorBrowsable(EditorBrowsableState.Advanced)]
internal static CultureInfo Culture
{
get
{
return Rei.Fs.My.Resources.Resources.resourceCulture;
}
set
{
Rei.Fs.My.Resources.Resources.resourceCulture = value;
}
}
internal static Icon NetFolder
{
get
{
return (Icon) RuntimeHelpers.GetObjectValue(Rei.Fs.My.Resources.Resources.ResourceManager.GetObject(nameof (NetFolder), Rei.Fs.My.Resources.Resources.resourceCulture));
}
}
internal static Icon security
{
get
{
return (Icon) RuntimeHelpers.GetObjectValue(Rei.Fs.My.Resources.Resources.ResourceManager.GetObject(nameof (security), Rei.Fs.My.Resources.Resources.resourceCulture));
}
}
}
}

198
Rei.Fs/MyAsyncResult.cs Normal file
View File

@@ -0,0 +1,198 @@
// Decompiled with JetBrains decompiler
// Type: Rei.Fs.MyAsyncResult
// 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.Runtime.CompilerServices;
using System.Threading;
namespace Rei.Fs
{
public class MyAsyncResult : IAsyncResult
{
private AsyncCallback _callback;
private object _asyncstate;
private bool _iscompleted;
private bool _isended;
private bool _completesync;
private ManualResetEvent _waithandle;
private object _returnvalue;
private object _syncobject;
private IAsyncResult _baseasyncresult;
private object _tag;
private Exception _ex;
public MyAsyncResult(AsyncCallback callback, object asyncstate)
{
this._callback = callback;
this._asyncstate = RuntimeHelpers.GetObjectValue(asyncstate);
this._iscompleted = false;
this._isended = false;
this._completesync = true;
this._waithandle = (ManualResetEvent) null;
this._returnvalue = (object) null;
this._syncobject = RuntimeHelpers.GetObjectValue(new object());
}
public bool IsCompleted
{
get
{
object syncobject = this._syncobject;
ObjectFlowControl.CheckForSyncLockOnValueType(syncobject);
Monitor.Enter(syncobject);
try
{
return this._iscompleted;
}
finally
{
Monitor.Exit(syncobject);
}
}
}
public object AsyncState
{
get
{
return this._asyncstate;
}
}
public bool CompletedSynchronously
{
get
{
return this._completesync;
}
}
public WaitHandle AsyncWaitHandle
{
get
{
object syncobject = this._syncobject;
ObjectFlowControl.CheckForSyncLockOnValueType(syncobject);
Monitor.Enter(syncobject);
try
{
if (this._waithandle == null)
this._waithandle = new ManualResetEvent(this._iscompleted);
}
finally
{
Monitor.Exit(syncobject);
}
return (WaitHandle) this._waithandle;
}
}
internal object ReturnValue
{
get
{
return this._returnvalue;
}
set
{
this._returnvalue = RuntimeHelpers.GetObjectValue(value);
}
}
internal IAsyncResult BaseAsyncResult
{
get
{
return this._baseasyncresult;
}
set
{
this._baseasyncresult = value;
}
}
internal object Tag
{
get
{
return this._tag;
}
set
{
this._tag = RuntimeHelpers.GetObjectValue(value);
}
}
internal void SetCompleteAsync()
{
this._completesync = false;
}
internal void AsyncComplete()
{
this.AsyncComplete((Exception) null);
}
internal void AsyncComplete(Exception ex)
{
object syncobject = this._syncobject;
ObjectFlowControl.CheckForSyncLockOnValueType(syncobject);
Monitor.Enter(syncobject);
try
{
if (this._iscompleted)
throw new InvalidOperationException();
this._iscompleted = true;
this._ex = ex;
if (this._waithandle != null)
this._waithandle.Set();
}
finally
{
Monitor.Exit(syncobject);
}
if (this._callback == null)
return;
this._callback((IAsyncResult) this);
}
internal void AsyncEnd()
{
object syncobject1 = this._syncobject;
ObjectFlowControl.CheckForSyncLockOnValueType(syncobject1);
Monitor.Enter(syncobject1);
bool iscompleted;
try
{
if (this._isended)
throw new InvalidOperationException();
this._isended = true;
iscompleted = this._iscompleted;
}
finally
{
Monitor.Exit(syncobject1);
}
if (!iscompleted)
this.AsyncWaitHandle.WaitOne();
object syncobject2 = this._syncobject;
ObjectFlowControl.CheckForSyncLockOnValueType(syncobject2);
Monitor.Enter(syncobject2);
try
{
if (this._waithandle != null)
this._waithandle.Close();
}
finally
{
Monitor.Exit(syncobject2);
}
if (this._ex != null)
throw this._ex;
}
}
}

View File

@@ -0,0 +1,51 @@
// Decompiled with JetBrains decompiler
// Type: Rei.Fs.NoHostRootedUriParser
// 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.Security.Permissions;
namespace Rei.Fs
{
public class NoHostRootedUriParser : GenericUriParser
{
private static readonly GenericUriParserOptions ParserOptions = GenericUriParserOptions.DontUnescapePathDotsAndSlashes | GenericUriParserOptions.Idn | GenericUriParserOptions.IriParsing;
private const int MustHaveAuthority = 1;
private const int OptionalAuthority = 2;
public static void Register(string scheme, int defaultport)
{
if (UriParser.IsKnownScheme(scheme))
return;
UriParser.Register((UriParser) new NoHostRootedUriParser(), scheme, defaultport);
}
public NoHostRootedUriParser()
: base(NoHostRootedUriParser.ParserOptions)
{
ReflectionPermission reflectionPermission = new ReflectionPermission(ReflectionPermissionFlag.AllFlags);
SecurityPermission securityPermission = new SecurityPermission(SecurityPermissionFlag.AllFlags);
reflectionPermission.Demand();
securityPermission.Demand();
FieldInfo field = typeof (UriParser).GetField("m_Flags", BindingFlags.Instance | BindingFlags.NonPublic);
int num = Conversions.ToInteger(field.GetValue((object) this)) & -2 | 2;
field.SetValue((object) this, (object) num);
}
protected override void InitializeAndValidate(Uri uri, ref UriFormatException parsingError)
{
base.InitializeAndValidate(uri, out parsingError);
if (parsingError == null && Operators.CompareString(uri.Host, "", false) != 0)
parsingError = new UriFormatException("should not contain host");
if (parsingError == null && !uri.AbsolutePath.StartsWith("/"))
parsingError = new UriFormatException("should be absolute path");
if (parsingError != null || uri.Port > 0)
return;
parsingError = new UriFormatException("should not contain port");
}
}
}

504
Rei.Fs/OAuth2Dialog.cs Normal file
View File

@@ -0,0 +1,504 @@
// Decompiled with JetBrains decompiler
// Type: Rei.Fs.OAuth2Dialog
// 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.ComponentModel;
using System.Diagnostics;
using System.Drawing;
using System.Runtime.CompilerServices;
using System.Windows.Forms;
namespace Rei.Fs
{
[DesignerGenerated]
public class OAuth2Dialog : Form
{
private IContainer components;
[AccessedThroughProperty("TextBoxAuthCode")]
private TextBox _TextBoxAuthCode;
[AccessedThroughProperty("ButtonOK")]
private Button _ButtonOK;
[AccessedThroughProperty("ButtonCancel")]
private Button _ButtonCancel;
[AccessedThroughProperty("LinkLabel1")]
private LinkLabel _LinkLabel1;
[AccessedThroughProperty("Label3")]
private Label _Label3;
[AccessedThroughProperty("Label4")]
private Label _Label4;
[AccessedThroughProperty("Label5")]
private Label _Label5;
[AccessedThroughProperty("Label2")]
private Label _Label2;
[AccessedThroughProperty("UriTextBox")]
private TextBox _UriTextBox;
[AccessedThroughProperty("Label1")]
private Label _Label1;
[AccessedThroughProperty("RememberCheckBox")]
private CheckBox _RememberCheckBox;
[AccessedThroughProperty("Label6")]
private Label _Label6;
public OAuth2Dialog()
{
this.Load += new EventHandler(this.OAuth2Dialog_Load);
this.InitializeComponent();
}
[DebuggerNonUserCode]
protected override void Dispose(bool disposing)
{
try
{
if (!disposing || this.components == null)
return;
this.components.Dispose();
}
finally
{
base.Dispose(disposing);
}
}
[DebuggerStepThrough]
private void InitializeComponent()
{
this.TextBoxAuthCode = new TextBox();
this.ButtonOK = new Button();
this.ButtonCancel = new Button();
this.LinkLabel1 = new LinkLabel();
this.Label3 = new Label();
this.Label4 = new Label();
this.Label5 = new Label();
this.Label2 = new Label();
this.UriTextBox = new TextBox();
this.Label1 = new Label();
this.RememberCheckBox = new CheckBox();
this.Label6 = new Label();
this.SuspendLayout();
this.TextBoxAuthCode.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
TextBox textBoxAuthCode1 = this.TextBoxAuthCode;
Point point1 = new Point(80, 128);
Point point2 = point1;
textBoxAuthCode1.Location = point2;
this.TextBoxAuthCode.Name = "TextBoxAuthCode";
TextBox textBoxAuthCode2 = this.TextBoxAuthCode;
Size size1 = new Size(200, 19);
Size size2 = size1;
textBoxAuthCode2.Size = size2;
this.TextBoxAuthCode.TabIndex = 7;
this.ButtonOK.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
Button buttonOk1 = this.ButtonOK;
point1 = new Point(128, 192);
Point point3 = point1;
buttonOk1.Location = point3;
this.ButtonOK.Name = "ButtonOK";
Button buttonOk2 = this.ButtonOK;
size1 = new Size(72, 24);
Size size3 = size1;
buttonOk2.Size = size3;
this.ButtonOK.TabIndex = 10;
this.ButtonOK.Text = "OK";
this.ButtonOK.UseVisualStyleBackColor = true;
this.ButtonCancel.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
this.ButtonCancel.DialogResult = DialogResult.Cancel;
Button buttonCancel1 = this.ButtonCancel;
point1 = new Point(208, 192);
Point point4 = point1;
buttonCancel1.Location = point4;
this.ButtonCancel.Name = "ButtonCancel";
Button buttonCancel2 = this.ButtonCancel;
size1 = new Size(72, 24);
Size size4 = size1;
buttonCancel2.Size = size4;
this.ButtonCancel.TabIndex = 11;
this.ButtonCancel.Text = "Cancel";
this.ButtonCancel.UseVisualStyleBackColor = true;
this.LinkLabel1.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
LinkLabel linkLabel1_1 = this.LinkLabel1;
point1 = new Point(40, 64);
Point point5 = point1;
linkLabel1_1.Location = point5;
this.LinkLabel1.Name = "LinkLabel1";
LinkLabel linkLabel1_2 = this.LinkLabel1;
size1 = new Size(239, 16);
Size size5 = size1;
linkLabel1_2.Size = size5;
this.LinkLabel1.TabIndex = 3;
this.LinkLabel1.TabStop = true;
this.LinkLabel1.Text = "LinkLabel1";
this.LinkLabel1.TextAlign = ContentAlignment.MiddleLeft;
this.Label3.AutoSize = true;
Label label3_1 = this.Label3;
point1 = new Point(8, 48);
Point point6 = point1;
label3_1.Location = point6;
this.Label3.Name = "Label3";
Label label3_2 = this.Label3;
size1 = new Size(126, 12);
Size size6 = size1;
label3_2.Size = size6;
this.Label3.TabIndex = 2;
this.Label3.Text = "Step1: Open Link Below";
this.Label4.AutoSize = true;
Label label4_1 = this.Label4;
point1 = new Point(8, 88);
Point point7 = point1;
label4_1.Location = point7;
this.Label4.Name = "Label4";
Label label4_2 = this.Label4;
size1 = new Size(203, 12);
Size size7 = size1;
label4_2.Size = size7;
this.Label4.TabIndex = 4;
this.Label4.Text = "Step2: Authorize CarotDAV on the site";
this.Label5.AutoSize = true;
Label label5_1 = this.Label5;
point1 = new Point(8, 104);
Point point8 = point1;
label5_1.Location = point8;
this.Label5.Name = "Label5";
Label label5_2 = this.Label5;
size1 = new Size(166, 12);
Size size8 = size1;
label5_2.Size = size8;
this.Label5.TabIndex = 5;
this.Label5.Text = "Step3: Input Authorization Code";
this.Label2.AutoSize = true;
Label label2_1 = this.Label2;
point1 = new Point(40, 128);
Point point9 = point1;
label2_1.Location = point9;
this.Label2.Name = "Label2";
Label label2_2 = this.Label2;
size1 = new Size(31, 12);
Size size9 = size1;
label2_2.Size = size9;
this.Label2.TabIndex = 6;
this.Label2.Text = "Code";
this.UriTextBox.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
TextBox uriTextBox1 = this.UriTextBox;
point1 = new Point(8, 24);
Point point10 = point1;
uriTextBox1.Location = point10;
this.UriTextBox.Multiline = true;
this.UriTextBox.Name = "UriTextBox";
this.UriTextBox.ReadOnly = true;
TextBox uriTextBox2 = this.UriTextBox;
size1 = new Size(272, 19);
Size size10 = size1;
uriTextBox2.Size = size10;
this.UriTextBox.TabIndex = 1;
this.UriTextBox.TabStop = false;
this.Label1.AutoSize = true;
Label label1_1 = this.Label1;
point1 = new Point(8, 8);
Point point11 = point1;
label1_1.Location = point11;
this.Label1.Name = "Label1";
Label label1_2 = this.Label1;
size1 = new Size(90, 12);
Size size11 = size1;
label1_2.Size = size11;
this.Label1.TabIndex = 0;
this.Label1.Text = "Authorization for";
this.RememberCheckBox.AutoSize = true;
CheckBox rememberCheckBox1 = this.RememberCheckBox;
point1 = new Point(8, 176);
Point point12 = point1;
rememberCheckBox1.Location = point12;
CheckBox rememberCheckBox2 = this.RememberCheckBox;
size1 = new Size(214, 16);
Size size12 = size1;
rememberCheckBox2.MinimumSize = size12;
this.RememberCheckBox.Name = "RememberCheckBox";
CheckBox rememberCheckBox3 = this.RememberCheckBox;
size1 = new Size(214, 16);
Size size13 = size1;
rememberCheckBox3.Size = size13;
this.RememberCheckBox.TabIndex = 9;
this.RememberCheckBox.Text = "Remember Authorization Info";
this.RememberCheckBox.UseVisualStyleBackColor = true;
this.Label6.AutoSize = true;
Label label6_1 = this.Label6;
point1 = new Point(8, 152);
Point point13 = point1;
label6_1.Location = point13;
this.Label6.Name = "Label6";
Label label6_2 = this.Label6;
size1 = new Size(97, 12);
Size size14 = size1;
label6_2.Size = size14;
this.Label6.TabIndex = 8;
this.Label6.Text = "Step4: Click \"OK\"";
this.AcceptButton = (IButtonControl) this.ButtonOK;
this.AutoScaleDimensions = new SizeF(6f, 12f);
this.AutoScaleMode = AutoScaleMode.Font;
this.CancelButton = (IButtonControl) this.ButtonCancel;
size1 = new Size(288, 224);
this.ClientSize = size1;
this.Controls.Add((Control) this.Label6);
this.Controls.Add((Control) this.RememberCheckBox);
this.Controls.Add((Control) this.UriTextBox);
this.Controls.Add((Control) this.Label1);
this.Controls.Add((Control) this.LinkLabel1);
this.Controls.Add((Control) this.ButtonCancel);
this.Controls.Add((Control) this.ButtonOK);
this.Controls.Add((Control) this.Label2);
this.Controls.Add((Control) this.Label5);
this.Controls.Add((Control) this.Label4);
this.Controls.Add((Control) this.Label3);
this.Controls.Add((Control) this.TextBoxAuthCode);
size1 = new Size(304, 262);
this.MinimumSize = size1;
this.Name = nameof (OAuth2Dialog);
this.Text = "OAuth Authorization Dialog";
this.ResumeLayout(false);
this.PerformLayout();
}
internal virtual TextBox TextBoxAuthCode
{
get
{
return this._TextBoxAuthCode;
}
[MethodImpl(MethodImplOptions.Synchronized)] set
{
EventHandler eventHandler = new EventHandler(this.TextBox1_TextChanged);
if (this._TextBoxAuthCode != null)
this._TextBoxAuthCode.TextChanged -= eventHandler;
this._TextBoxAuthCode = value;
if (this._TextBoxAuthCode == null)
return;
this._TextBoxAuthCode.TextChanged += eventHandler;
}
}
internal virtual Button ButtonOK
{
get
{
return this._ButtonOK;
}
[MethodImpl(MethodImplOptions.Synchronized)] set
{
EventHandler eventHandler = new EventHandler(this.ButtonOK_Click);
if (this._ButtonOK != null)
this._ButtonOK.Click -= eventHandler;
this._ButtonOK = value;
if (this._ButtonOK == null)
return;
this._ButtonOK.Click += eventHandler;
}
}
internal virtual Button ButtonCancel
{
get
{
return this._ButtonCancel;
}
[MethodImpl(MethodImplOptions.Synchronized)] set
{
this._ButtonCancel = value;
}
}
internal virtual LinkLabel LinkLabel1
{
get
{
return this._LinkLabel1;
}
[MethodImpl(MethodImplOptions.Synchronized)] set
{
LinkLabelLinkClickedEventHandler clickedEventHandler = new LinkLabelLinkClickedEventHandler(this.LinkLabel1_LinkClicked);
if (this._LinkLabel1 != null)
this._LinkLabel1.LinkClicked -= clickedEventHandler;
this._LinkLabel1 = value;
if (this._LinkLabel1 == null)
return;
this._LinkLabel1.LinkClicked += clickedEventHandler;
}
}
internal virtual Label Label3
{
get
{
return this._Label3;
}
[MethodImpl(MethodImplOptions.Synchronized)] set
{
this._Label3 = value;
}
}
internal virtual Label Label4
{
get
{
return this._Label4;
}
[MethodImpl(MethodImplOptions.Synchronized)] set
{
this._Label4 = value;
}
}
internal virtual Label Label5
{
get
{
return this._Label5;
}
[MethodImpl(MethodImplOptions.Synchronized)] set
{
this._Label5 = value;
}
}
internal virtual Label Label2
{
get
{
return this._Label2;
}
[MethodImpl(MethodImplOptions.Synchronized)] set
{
this._Label2 = value;
}
}
internal virtual TextBox UriTextBox
{
get
{
return this._UriTextBox;
}
[MethodImpl(MethodImplOptions.Synchronized)] set
{
this._UriTextBox = value;
}
}
internal virtual Label Label1
{
get
{
return this._Label1;
}
[MethodImpl(MethodImplOptions.Synchronized)] set
{
this._Label1 = value;
}
}
internal virtual CheckBox RememberCheckBox
{
get
{
return this._RememberCheckBox;
}
[MethodImpl(MethodImplOptions.Synchronized)] set
{
this._RememberCheckBox = value;
}
}
internal virtual Label Label6
{
get
{
return this._Label6;
}
[MethodImpl(MethodImplOptions.Synchronized)] set
{
this._Label6 = value;
}
}
public string Target
{
get
{
return this.UriTextBox.Text;
}
set
{
this.UriTextBox.Text = value;
}
}
public string AuthorizationEndpoint
{
get
{
return this.LinkLabel1.Text;
}
set
{
this.LinkLabel1.Text = value;
}
}
public bool ShowRememberCheckBox
{
get
{
return this.RememberCheckBox.Visible;
}
set
{
this.RememberCheckBox.Visible = value;
}
}
public bool Remember
{
get
{
return this.RememberCheckBox.Checked;
}
set
{
this.RememberCheckBox.Checked = value;
}
}
public string Code
{
get
{
return this.TextBoxAuthCode.Text;
}
}
private void ButtonOK_Click(object sender, EventArgs e)
{
this.DialogResult = DialogResult.OK;
}
private void LinkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
Process.Start(this.LinkLabel1.Text);
}
private void TextBox1_TextChanged(object sender, EventArgs e)
{
if (this.TextBoxAuthCode.Text.Length < 0)
return;
this.ButtonOK.Enabled = true;
}
private void OAuth2Dialog_Load(object sender, EventArgs e)
{
this.Icon = Rei.Fs.My.Resources.Resources.security;
}
}
}

120
Rei.Fs/OAuth2Dialog.resx Normal file
View File

@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

330
Rei.Fs/PartialStream.cs Normal file
View File

@@ -0,0 +1,330 @@
// Decompiled with JetBrains decompiler
// Type: Rei.Fs.PartialStream
// 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.IO;
using System.Runtime.CompilerServices;
namespace Rei.Fs
{
public class PartialStream : Stream
{
private Stream pBaseStream;
private long pLength;
private long pInnerPos;
private long pStart;
private int pLastCount;
public object Tag;
private object pSyncObject;
private bool pHasError;
private bool pDisposed;
public PartialStream(Stream basestream, long length)
{
this.pHasError = false;
this.pDisposed = false;
this.pBaseStream = basestream;
this.pLength = length;
this.pInnerPos = 0L;
if (!this.pBaseStream.CanSeek)
return;
this.pStart = this.pBaseStream.Position;
}
public Stream BaseStream
{
get
{
return this.pBaseStream;
}
}
public override bool CanRead
{
get
{
return this.pBaseStream.CanRead;
}
}
public override bool CanSeek
{
get
{
return this.pBaseStream.CanSeek;
}
}
public override bool CanWrite
{
get
{
return this.pBaseStream.CanWrite;
}
}
public override bool CanTimeout
{
get
{
return this.pBaseStream.CanTimeout;
}
}
public override long Length
{
get
{
if (this.pLength < 0L)
throw new NotSupportedException();
return this.pLength;
}
}
public override int ReadTimeout
{
get
{
return this.pBaseStream.ReadTimeout;
}
set
{
this.pBaseStream.ReadTimeout = value;
}
}
public override int WriteTimeout
{
get
{
return this.pBaseStream.WriteTimeout;
}
set
{
this.pBaseStream.WriteTimeout = value;
}
}
public override long Position
{
get
{
return this.pInnerPos;
}
set
{
this.Seek(value, SeekOrigin.Begin);
}
}
public override long Seek(long offset, SeekOrigin origin)
{
try
{
switch (origin)
{
case SeekOrigin.Current:
checked { offset += this.Position; }
break;
case SeekOrigin.End:
if (this.pLength < 0L)
throw new NotSupportedException();
offset = checked (this.pLength - offset);
break;
}
if (offset < 0L || this.pLength >= 0L && offset > this.pLength)
throw new ArgumentOutOfRangeException();
this.pBaseStream.Seek(checked (this.pStart + offset), SeekOrigin.Begin);
this.pInnerPos = offset;
}
catch (Exception ex)
{
ProjectData.SetProjectError(ex);
this.pHasError = true;
throw;
}
long num;
return num;
}
public override void SetLength(long value)
{
throw new NotSupportedException();
}
public override int Read(byte[] buffer, int offset, int count)
{
try
{
if (this.pInnerPos < 0L)
this.Position = 0L;
if (this.pLength >= 0L && checked (this.pInnerPos + (long) count) > this.pLength)
count = checked ((int) (this.pLength - this.pInnerPos));
int num = this.pBaseStream.Read(buffer, offset, count);
this.pInnerPos = checked (this.pInnerPos + (long) num);
if (num == 0 && count > 0 && (this.pLength >= 0L && this.pInnerPos < this.pLength))
throw new IOException("Invalid Stream Length");
return num;
}
catch (Exception ex)
{
ProjectData.SetProjectError(ex);
this.pHasError = true;
throw;
}
}
public override IAsyncResult BeginRead(byte[] buffer, int offset, int count, AsyncCallback callback, object state)
{
try
{
if (this.pInnerPos < 0L)
this.Position = 0L;
if (this.pLength >= 0L && checked (this.pInnerPos + (long) count) > this.pLength)
count = checked ((int) (this.pLength - this.pInnerPos));
this.pLastCount = count;
return this.pBaseStream.BeginRead(buffer, offset, count, callback, RuntimeHelpers.GetObjectValue(state));
}
catch (Exception ex)
{
ProjectData.SetProjectError(ex);
this.pHasError = true;
throw;
}
}
public override int EndRead(IAsyncResult asyncResult)
{
try
{
int num = this.pBaseStream.EndRead(asyncResult);
this.pInnerPos = checked (this.pInnerPos + (long) num);
if (num == 0 && this.pLastCount > 0 && (this.pLength >= 0L && this.pInnerPos < this.pLength))
throw new IOException("Invalid Stream Length");
return num;
}
catch (Exception ex)
{
ProjectData.SetProjectError(ex);
this.pHasError = true;
throw;
}
}
public override void Write(byte[] buffer, int offset, int count)
{
try
{
if (this.pInnerPos < 0L)
this.Position = 0L;
if (this.pLength >= 0L && checked (this.pInnerPos + (long) count) > this.pLength)
throw new InvalidRangeException();
this.pBaseStream.Write(buffer, offset, count);
this.pInnerPos = checked (this.pInnerPos + (long) count);
}
catch (Exception ex)
{
ProjectData.SetProjectError(ex);
this.pHasError = true;
throw;
}
}
public override IAsyncResult BeginWrite(byte[] buffer, int offset, int count, AsyncCallback callback, object state)
{
try
{
if (this.pInnerPos < 0L)
this.Position = 0L;
if (this.pLength >= 0L && checked (this.pInnerPos + (long) count) > this.pLength)
throw new ArgumentException();
this.pLastCount = count;
return this.pBaseStream.BeginWrite(buffer, offset, count, callback, RuntimeHelpers.GetObjectValue(state));
}
catch (Exception ex)
{
ProjectData.SetProjectError(ex);
this.pHasError = true;
throw;
}
}
public override void EndWrite(IAsyncResult asyncResult)
{
try
{
this.pBaseStream.EndWrite(asyncResult);
this.pInnerPos = checked (this.pInnerPos + (long) this.pLastCount);
}
catch (Exception ex)
{
ProjectData.SetProjectError(ex);
this.pHasError = true;
throw;
}
}
public override void Flush()
{
try
{
this.pBaseStream.Flush();
}
catch (Exception ex)
{
ProjectData.SetProjectError(ex);
this.pHasError = true;
throw;
}
}
protected override void Dispose(bool disposing)
{
try
{
if (!disposing || this.pDisposed)
return;
this.pDisposed = true;
if (this.pHasError)
{
try
{
this.pBaseStream.Close();
}
catch (Exception ex)
{
ProjectData.SetProjectError(ex);
ProjectData.ClearProjectError();
}
}
else
{
if (this.pLength >= 0L && this.pInnerPos != this.pLength)
{
string message = "Length:" + this.pLength.ToString() + " Position:" + this.pInnerPos.ToString();
try
{
this.pBaseStream.Close();
}
catch (Exception ex)
{
ProjectData.SetProjectError(ex);
Exception innerexception = ex;
throw new InvalidRangeException(message, innerexception);
}
throw new InvalidRangeException(message);
}
this.pBaseStream.Close();
}
}
finally
{
base.Dispose(disposing);
}
}
}
}

15
Rei.Fs/ProxyType.cs Normal file
View File

@@ -0,0 +1,15 @@
// Decompiled with JetBrains decompiler
// Type: Rei.Fs.ProxyType
// 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
namespace Rei.Fs
{
public enum ProxyType
{
Default,
Specify,
NoProxy,
}
}

102
Rei.Fs/Rei.Fs.csproj Normal file
View File

@@ -0,0 +1,102 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!--Project was exported from assembly: F:\Eigene Dateien\Dropbox\portable Collection\Progs\CarotDAV\Rei.Fs.dll-->
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{BD378147-118C-4141-A046-BFD575EF1B05}</ProjectGuid>
<OutputType>Library</OutputType>
<AssemblyName>Rei.Fs</AssemblyName>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<ApplicationVersion>1.13.2.8796</ApplicationVersion>
<FileAlignment>512</FileAlignment>
<RootNamespace>Rei.Fs</RootNamespace>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.VisualBasic" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System" />
<Reference Include="System.Drawing" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="AuthDialog.cs" />
<Compile Include="OAuth2Dialog.cs" />
<Compile Include="ConnectionSettingBase.cs" />
<Compile Include="UCSNormalization.cs" />
<Compile Include="ProxyType.cs" />
<Compile Include="SecureType.cs" />
<Compile Include="FsSpecificContextMenuItem.cs" />
<Compile Include="ResourceInfoEventArgs.cs" />
<Compile Include="LinkListForm.cs" />
<Compile Include="CannotProcessRequest.cs" />
<Compile Include="DestinationAlreadyExistsException.cs" />
<Compile Include="InconsistencyDetectedException.cs" />
<Compile Include="InvalidRangeException.cs" />
<Compile Include="InvalidServerResponseException.cs" />
<Compile Include="RemoteCertificateErrorException.cs" />
<Compile Include="RemoteResourceNotFoundException.cs" />
<Compile Include="SimpleWebException.cs" />
<Compile Include="UnauthorizedException.cs" />
<Compile Include="FsBase.cs" />
<Compile Include="LogMessageEventArgs.cs" />
<Compile Include="FsAbility.cs" />
<Compile Include="HostRootedUriParser.cs" />
<Compile Include="JsonObject.cs" />
<Compile Include="MyAsyncResult.cs" />
<Compile Include="NoHostRootedUriParser.cs" />
<Compile Include="ReturnedInfo.cs" />
<Compile Include="ResourceId.cs" />
<Compile Include="ResourceInfo.cs" />
<Compile Include="SettingSupport.cs" />
<Compile Include="AutoSplitFs.cs" />
<Compile Include="EncryptFs.cs" />
<Compile Include="SslProtocols.cs" />
<Compile Include="ChunkedStream.cs" />
<Compile Include="CloseNotifyStream.cs" />
<Compile Include="FooteredWriteStream.cs" />
<Compile Include="PartialStream.cs" />
<Compile Include="ZlibStream.cs" />
<Compile Include="Adler32.cs" />
<Compile Include="UriParserFixer.cs" />
<Compile Include="UriUtil.cs" />
<Compile Include="WebRequestCertificateValidationManager.cs" />
<Compile Include="My\MyApplication.cs" />
<Compile Include="My\MyComputer.cs" />
<Compile Include="My\MyProject.cs" />
<Compile Include="My\MySettings.cs" />
<Compile Include="My\MySettingsProperty.cs" />
<Compile Include="My\Resources\Resources.cs" />
<Compile Include="IO\Win32Native.cs" />
<Compile Include="IO\SafeFindHandle.cs" />
<Compile Include="IO\FileInfo.cs" />
<Compile Include="IO\FileSystem.cs" />
<Compile Include="AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="AuthDialog.resx" />
<EmbeddedResource Include="LinkListForm.resx" />
<EmbeddedResource Include="OAuth2Dialog.resx" />
<EmbeddedResource Include="Resources.resx" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

View File

@@ -0,0 +1,30 @@
// Decompiled with JetBrains decompiler
// Type: Rei.Fs.RemoteCertificateErrorException
// 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 System;
using System.Net.Security;
namespace Rei.Fs
{
public class RemoteCertificateErrorException : Exception
{
private SslPolicyErrors pErrors;
public RemoteCertificateErrorException(Exception ex, SslPolicyErrors errors)
: base(ex.Message, ex)
{
this.pErrors = errors;
}
public SslPolicyErrors Errors
{
get
{
return this.pErrors;
}
}
}
}

View File

@@ -0,0 +1,39 @@
// Decompiled with JetBrains decompiler
// Type: Rei.Fs.RemoteResourceNotFoundException
// 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 System;
namespace Rei.Fs
{
public class RemoteResourceNotFoundException : Exception
{
private Uri _target;
public RemoteResourceNotFoundException(Uri uri, string message, Exception innerexception)
: base(message, innerexception)
{
this._target = uri;
}
public RemoteResourceNotFoundException(Uri uri, Exception innerexception)
: this(uri, "Remote Resource Not Found", innerexception)
{
}
public RemoteResourceNotFoundException(Uri uri)
: this(uri, "Remote Resource Not Found", (Exception) null)
{
}
public Uri TargetUri
{
get
{
return this._target;
}
}
}
}

89
Rei.Fs/ResourceId.cs Normal file
View File

@@ -0,0 +1,89 @@
// Decompiled with JetBrains decompiler
// Type: Rei.Fs.ResourceId
// 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 System;
using System.ComponentModel;
using System.Diagnostics;
namespace Rei.Fs
{
[DebuggerDisplay("{DebuggerString}")]
[Serializable]
public class ResourceId : ReturnedInfo
{
private Uri pUri;
private string pTag;
private bool pIsCaseSensitive;
public ResourceId(Uri target, FsBase fs)
: this(target, "", fs)
{
}
public ResourceId(Uri target, string tag, FsBase fs)
{
this.pUri = target;
this.pTag = tag;
this.pIsCaseSensitive = fs.IsCaseSensitiveFs;
}
public Uri Uri
{
get
{
return this.pUri;
}
}
public string Tag
{
get
{
return this.pTag;
}
}
public bool IsCollection
{
get
{
return UriUtil.EndWithSlash(this.pUri);
}
}
public override string ToString()
{
return this.pUri.ToString();
}
public override bool Equals(object obj)
{
ResourceId resourceId = obj as ResourceId;
if ((object) resourceId == null)
return false;
return UriUtil.UriEquals(this.Uri, resourceId.Uri, this.pIsCaseSensitive);
}
[EditorBrowsable(EditorBrowsableState.Never)]
public string DebuggerString
{
get
{
return this.ToString();
}
}
public static bool operator ==(ResourceId id1, ResourceId id2)
{
return UriUtil.UriEquals(id1.Uri, id2.Uri, id1.pIsCaseSensitive);
}
public static bool operator !=(ResourceId id1, ResourceId id2)
{
return !UriUtil.UriEquals(id1.Uri, id2.Uri, id1.pIsCaseSensitive);
}
}
}

165
Rei.Fs/ResourceInfo.cs Normal file
View File

@@ -0,0 +1,165 @@
// Decompiled with JetBrains decompiler
// Type: Rei.Fs.ResourceInfo
// 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.Collections.Generic;
using System.Diagnostics;
namespace Rei.Fs
{
[DebuggerDisplay("{DebuggerString}")]
[Serializable]
public class ResourceInfo : ReturnedInfo, ICloneable
{
public ResourceId Id;
public long Size;
public DateTime LastModifiedTime;
public bool IsCollection;
public DateTime CreationTime;
public DateTime LastAccessTime;
public string StatusDescription;
public bool HasError;
public bool CanRename;
public bool CanMove;
public bool CanCopy;
public bool CanDelete;
public bool CanSetInfo;
public bool IsEncrypted;
public bool IsSplitted;
public bool IsMinor;
private List<string> pTypes;
private ResourceInfo.PropertyCollection pProperties;
public ResourceInfo()
: this((ResourceId) null, false, 0L, DateTime.MinValue, DateTime.MinValue, DateTime.MinValue)
{
}
public ResourceInfo(ResourceId id, bool iscollection, long size, DateTime lastmodified)
: this(id, iscollection, size, lastmodified, DateTime.MinValue, DateTime.MinValue)
{
}
public ResourceInfo(ResourceId id, bool iscollection, long size, DateTime lastmodified, DateTime creation, DateTime lastaccess)
{
this.Id = id;
this.IsCollection = iscollection;
this.Size = size;
this.LastModifiedTime = lastmodified;
this.CreationTime = creation;
this.LastAccessTime = lastaccess;
this.pProperties = new ResourceInfo.PropertyCollection();
this.pTypes = new List<string>();
this.HasError = false;
}
public ResourceInfo.PropertyCollection Properties
{
get
{
return this.pProperties;
}
}
public List<string> Types
{
get
{
return this.pTypes;
}
}
public object Clone()
{
ResourceInfo resourceInfo = (ResourceInfo) this.MemberwiseClone();
resourceInfo.pProperties = new ResourceInfo.PropertyCollection();
resourceInfo.pProperties.AddRange((IEnumerable<ResourceInfo.ResourceProperty>) this.pProperties);
resourceInfo.pTypes = new List<string>();
resourceInfo.pTypes.AddRange((IEnumerable<string>) this.pTypes);
return (object) resourceInfo;
}
public string DebuggerString
{
get
{
return this.ToString();
}
}
public override string ToString()
{
string str1 = "";
string str2 = (object) this.Id != null ? str1 + this.Id.ToString() : str1 + "NoId";
return (!this.IsCollection ? str2 + " <FILE> " : str2 + " <COLL> ") + this.Size.ToString();
}
[Serializable]
public class PropertyCollection : List<ResourceInfo.ResourceProperty>
{
public ResourceInfo.ResourceProperty this[string name]
{
get
{
int index = this.IndexOf(name);
if (index >= 0)
return this[index];
throw new ArgumentOutOfRangeException();
}
}
public int IndexOf(string name)
{
int num1 = 0;
int num2 = checked (this.Count - 1);
int index = num1;
while (index <= num2)
{
if (Operators.CompareString(this[index].Name, name, false) == 0)
return index;
checked { ++index; }
}
return -1;
}
public void Add(string name, string value, string statedescription, bool haserror)
{
this.Add(new ResourceInfo.ResourceProperty(name, value, statedescription, haserror));
}
public void Remove(string name)
{
int index = this.IndexOf(name);
if (index < 0)
throw new ArgumentException();
this.RemoveAt(index);
}
public bool Contains(string name)
{
return this.IndexOf(name) >= 0;
}
}
[Serializable]
public class ResourceProperty
{
public string Name;
public string Value;
public string StateDescription;
public bool HasError;
public ResourceProperty(string name, string value, string statedescription, bool haserror)
{
this.Name = name;
this.Value = value;
this.StateDescription = statedescription;
this.HasError = haserror;
}
}
}
}

View File

@@ -0,0 +1,49 @@
// Decompiled with JetBrains decompiler
// Type: Rei.Fs.ResourceInfoEventArgs
// 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 System;
using System.Runtime.CompilerServices;
namespace Rei.Fs
{
public class ResourceInfoEventArgs : EventArgs
{
private FsBase pfs;
private ResourceInfo[] ris;
private object pTag;
public ResourceInfo[] ResourceInfos
{
get
{
return this.ris;
}
}
public FsBase Fs
{
get
{
return this.pfs;
}
}
public object Tag
{
get
{
return this.pTag;
}
}
public ResourceInfoEventArgs(FsBase fs, ResourceInfo[] ris, object tag)
{
this.pfs = fs;
this.ris = ris;
this.pTag = RuntimeHelpers.GetObjectValue(tag);
}
}
}

1003
Rei.Fs/Resources.resx Normal file

File diff suppressed because it is too large Load Diff

15
Rei.Fs/ReturnedInfo.cs Normal file
View File

@@ -0,0 +1,15 @@
// Decompiled with JetBrains decompiler
// Type: Rei.Fs.ReturnedInfo
// 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 System;
namespace Rei.Fs
{
[Serializable]
public abstract class ReturnedInfo
{
}
}

15
Rei.Fs/SecureType.cs Normal file
View File

@@ -0,0 +1,15 @@
// Decompiled with JetBrains decompiler
// Type: Rei.Fs.SecureType
// 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
namespace Rei.Fs
{
public enum SecureType
{
None,
Secure,
Warning,
}
}

20
Rei.Fs/SettingSupport.cs Normal file
View File

@@ -0,0 +1,20 @@
// Decompiled with JetBrains decompiler
// Type: Rei.Fs.SettingSupport
// 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
namespace Rei.Fs
{
public class SettingSupport
{
public static bool IsSameType(object Object1, object Object2)
{
if (Object1 == null)
return Object2 == null;
if (Object2 == null)
return false;
return Object1.GetType() == Object2.GetType();
}
}
}

View File

@@ -0,0 +1,68 @@
// Decompiled with JetBrains decompiler
// Type: Rei.Fs.SimpleWebException
// 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 System;
using System.Net;
namespace Rei.Fs
{
public class SimpleWebException : Exception
{
public int StatusCode;
public WebExceptionStatus Status;
public Uri ResponseUri;
public string ResponseBody;
public SimpleWebException(WebException ex)
: this(ex.Message, ex.InnerException, ex.Status, ex.Response)
{
}
public SimpleWebException(WebException ex, string responsebody)
: this(ex.Message, ex.InnerException, ex.Status, ex.Response, responsebody)
{
}
public SimpleWebException(WebExceptionStatus status)
: this(status.ToString(), (Exception) null, status, (WebResponse) null)
{
}
public SimpleWebException(string message, WebExceptionStatus status)
: this(message, (Exception) null, status, (WebResponse) null)
{
}
public SimpleWebException(string message, Exception innerexception, WebExceptionStatus status)
: this(message, innerexception, status, (WebResponse) null)
{
}
public SimpleWebException(string message, Exception innerexception, WebExceptionStatus status, WebResponse response)
: this(message, innerexception, status, response, (string) null)
{
}
public SimpleWebException(string message, Exception innerexception, WebExceptionStatus status, WebResponse response, string responsebody)
: base(message, innerexception)
{
this.Status = status;
HttpWebResponse httpWebResponse = response as HttpWebResponse;
if (httpWebResponse != null)
{
this.StatusCode = (int) httpWebResponse.StatusCode;
this.ResponseUri = httpWebResponse.ResponseUri;
}
FtpWebResponse ftpWebResponse = response as FtpWebResponse;
if (ftpWebResponse != null)
{
this.StatusCode = (int) ftpWebResponse.StatusCode;
this.ResponseUri = ftpWebResponse.ResponseUri;
}
this.ResponseBody = responsebody;
}
}
}

22
Rei.Fs/SslProtocols.cs Normal file
View File

@@ -0,0 +1,22 @@
// Decompiled with JetBrains decompiler
// Type: Rei.Fs.SslProtocols
// 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 System;
namespace Rei.Fs
{
[Flags]
public enum SslProtocols
{
None = 0,
Ssl2 = 12,
Ssl3 = 48,
Tls = 192,
Tls11 = 768,
Tls12 = 3072,
Default = Tls | Ssl3,
}
}

View File

@@ -0,0 +1,17 @@
// Decompiled with JetBrains decompiler
// Type: Rei.Fs.UCSNormalization
// 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
namespace Rei.Fs
{
public enum UCSNormalization
{
None = 0,
NFC = 1,
NFD = 2,
NFKC = 5,
NFKD = 6,
}
}

View File

@@ -0,0 +1,39 @@
// Decompiled with JetBrains decompiler
// Type: Rei.Fs.UnauthorizedException
// 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 System;
namespace Rei.Fs
{
public class UnauthorizedException : Exception
{
private bool p_canretry;
public bool CanRetry
{
get
{
return this.p_canretry;
}
}
public UnauthorizedException(string message, Exception innerexception, bool canretry)
: base(message, innerexception)
{
this.p_canretry = canretry;
}
public UnauthorizedException(Exception innerexception, bool canretry)
: this("Unauthorized", innerexception, canretry)
{
}
public UnauthorizedException(Exception innerexception)
: this("Unauthorized", innerexception, true)
{
}
}
}

115
Rei.Fs/UriParserFixer.cs Normal file
View File

@@ -0,0 +1,115 @@
// 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);
}
}
}
}
}

451
Rei.Fs/UriUtil.cs Normal file
View File

@@ -0,0 +1,451 @@
// Decompiled with JetBrains decompiler
// Type: Rei.Fs.UriUtil
// 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.Collections.Generic;
using System.Globalization;
using System.Text;
namespace Rei.Fs
{
public class UriUtil
{
private const string unescapestringforsegment = "!$&'()*+,-.0123456789:;=@ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz~";
private const string unescapestringforquery = "!$&'()*+,-.0123456789:;=@ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz~/?";
private const string FormUrlEncodeReserved = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789$-_.!*'(),\",";
private const string OAuthUnreserved = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~";
public static Uri AddLastSlash(Uri target)
{
string leftPart = target.GetLeftPart(UriPartial.Path);
if (leftPart.EndsWith("/"))
return target;
return new Uri(leftPart + "/" + target.Query + target.Fragment);
}
public static Uri RemoveLastSlash(Uri target)
{
if (target.Segments.Length == 1)
return target;
string leftPart = target.GetLeftPart(UriPartial.Path);
if (!leftPart.EndsWith("/"))
return target;
return new Uri(leftPart.Substring(0, checked (leftPart.Length - 1)) + target.Query + target.Fragment);
}
public static bool EndWithSlash(Uri target)
{
return target.GetLeftPart(UriPartial.Path).EndsWith("/");
}
public static Uri GetParent(Uri target)
{
string str = target.AbsolutePath;
int index = checked (str.Length - 1);
while (index >= 0 && Operators.CompareString(Conversions.ToString(str[index]), "/", false) == 0)
checked { --index; }
while (index >= 0 && Operators.CompareString(Conversions.ToString(str[index]), "/", false) != 0)
checked { --index; }
while (index >= 0 && Operators.CompareString(Conversions.ToString(str[index]), "/", false) == 0)
checked { --index; }
int num = checked (index + 1);
if (num == 0)
{
str = "/";
num = 0;
}
if (Operators.CompareString(target.Authority, "", false) == 0)
return new Uri(target.Scheme + ":" + str.Substring(0, checked (num + 1)));
return new Uri(target.Scheme + "://" + target.Authority + str.Substring(0, checked (num + 1)));
}
public static Uri GetRoot(Uri target)
{
if (Operators.CompareString(target.Authority, "", false) == 0)
return new Uri(target.Scheme + ":/");
return new Uri(target.Scheme + "://" + target.Authority + "/");
}
public static string GetLastSegment(Uri target)
{
string absolutePath = target.AbsolutePath;
int length = absolutePath.Length;
int num = length;
while (num == length)
{
checked { --length; }
if (length < 0)
{
num = -1;
break;
}
num = absolutePath.LastIndexOf('/', length);
if (num < 0)
{
num = -1;
break;
}
}
return absolutePath.Substring(checked (num + 1), checked (length - num));
}
public static string GetLastName(Uri target)
{
string stringToUnescape = UriUtil.GetLastSegment(target);
try
{
stringToUnescape = Uri.UnescapeDataString(stringToUnescape);
}
catch (UriFormatException ex)
{
ProjectData.SetProjectError((Exception) ex);
ProjectData.ClearProjectError();
}
return stringToUnescape;
}
public static string GetAuthority(Uri target)
{
return target.GetComponents(UriComponents.SchemeAndServer | UriComponents.UserInfo, UriFormat.UriEscaped) + "/";
}
public static Uri CombineSegment(Uri baseuri, string segment)
{
if (baseuri.AbsoluteUri.EndsWith("/"))
return new Uri(baseuri.AbsoluteUri + segment);
return new Uri(baseuri.AbsoluteUri + "/" + segment);
}
public static Uri CombineName(Uri baseuri, string name)
{
return UriUtil.CombineSegment(baseuri, Uri.EscapeDataString(name));
}
public static bool UriEquals(Uri u1, Uri u2, bool casesensitive)
{
if ((object) u1 == null)
return (object) u2 == null;
if ((object) u2 == null)
return false;
if (casesensitive)
return Uri.Compare(UriUtil.RemoveLastSlash(u1), UriUtil.RemoveLastSlash(u2), UriComponents.AbsoluteUri, UriFormat.Unescaped, StringComparison.InvariantCulture) == 0;
return Uri.Compare(UriUtil.RemoveLastSlash(u1), UriUtil.RemoveLastSlash(u2), UriComponents.AbsoluteUri, UriFormat.Unescaped, StringComparison.InvariantCultureIgnoreCase) == 0;
}
private static string UriEncodeConvertHelper(string str, Encoding sourceencoding, Encoding destinationencoding, bool queryorfragment)
{
if (str.Contains("%u") || str.Contains("%U"))
throw new ArgumentException("cannot use %u encoding uri");
List<byte> byteList = new List<byte>();
int index1;
while (index1 < str.Length)
{
if ((int) str[index1] != 37)
{
byteList.Add(Convert.ToByte(str[index1]));
checked { ++index1; }
}
else
{
byteList.Add(Convert.ToByte(str.Substring(checked (index1 + 1), 2), 16));
checked { index1 += 3; }
}
}
byte[] numArray = new byte[checked (byteList.Count - 1 + 1)];
byteList.CopyTo(numArray);
str = sourceencoding.GetString(numArray);
StringBuilder stringBuilder = new StringBuilder(checked (str.Length * 3));
string str1 = !queryorfragment ? "!$&'()*+,-.0123456789:;=@ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz~" : "!$&'()*+,-.0123456789:;=@ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz~/?";
int num1 = 0;
int num2 = checked (str.Length - 1);
int index2 = num1;
while (index2 <= num2)
{
if (str1.Contains(Conversions.ToString(str[index2])))
{
stringBuilder.Append(str[index2]);
}
else
{
byte[] bytes = destinationencoding.GetBytes(Conversions.ToString(str[index2]));
int index3 = 0;
while (index3 < bytes.Length)
{
byte num3 = bytes[index3];
char ch = Convert.ToChar(num3);
if (str1.Contains(Conversions.ToString(ch)))
{
stringBuilder.Append(ch);
}
else
{
stringBuilder.Append("%");
stringBuilder.Append(num3.ToString("X2"));
}
checked { ++index3; }
}
}
checked { ++index2; }
}
str = stringBuilder.ToString();
return str;
}
public static Uri UriEncodeConvert(Uri target, Encoding sourceencoding, Encoding destinationencoding)
{
if (sourceencoding == null)
sourceencoding = Encoding.UTF8;
if (destinationencoding == null)
destinationencoding = Encoding.UTF8;
if (sourceencoding == destinationencoding)
return target;
string components = target.GetComponents(UriComponents.SchemeAndServer | UriComponents.UserInfo, UriFormat.UriEscaped);
string[] strArray = target.GetComponents(UriComponents.Path, UriFormat.UriEscaped).Split(new char[1]
{
'/'
}, StringSplitOptions.None);
int num1 = 0;
int num2 = checked (strArray.Length - 1);
int index = num1;
while (index <= num2)
{
strArray[index] = UriUtil.UriEncodeConvertHelper(strArray[index], sourceencoding, destinationencoding, false);
checked { ++index; }
}
string str1 = target.GetComponents(UriComponents.Query, UriFormat.UriEscaped);
if (str1.Length > 0)
str1 = UriUtil.UriEncodeConvertHelper(str1, sourceencoding, destinationencoding, true);
string str2 = target.GetComponents(UriComponents.Fragment, UriFormat.UriEscaped);
if (str2.Length > 0)
str2 = UriUtil.UriEncodeConvertHelper(str2, sourceencoding, destinationencoding, true);
string uriString = components + "/" + string.Join("/", strArray);
if (str1.Length > 0)
uriString = uriString + "?" + str1;
if (str2.Length > 0)
uriString = uriString + "#" + str2;
return new Uri(uriString);
}
public static bool IsChild(Uri baseuri, Uri target)
{
if (checked (baseuri.Segments.Length + 1) != target.Segments.Length)
return false;
return UriUtil.IsDescendant(baseuri, target);
}
public static bool IsDescendant(Uri baseuri, Uri target)
{
if (checked (baseuri.Segments.Length + 1) > target.Segments.Length || Operators.CompareString(baseuri.Scheme, target.Scheme, false) != 0 || (Operators.CompareString(baseuri.Host, target.Host, false) != 0 || baseuri.Port != target.Port) || Operators.CompareString(baseuri.UserInfo, target.UserInfo, false) != 0)
return false;
int num1 = 0;
int num2 = checked (baseuri.Segments.Length - 1);
int index = num1;
while (index <= num2)
{
if (!UriUtil.IsSameSegmentString(baseuri.Segments[index], target.Segments[index]))
return false;
checked { ++index; }
}
return true;
}
public static bool IsSameSegmentString(string seg1, string seg2)
{
while (seg1.EndsWith("/"))
seg1 = seg1.Substring(0, checked (seg1.Length - 1));
while (seg2.EndsWith("/"))
seg2 = seg2.Substring(0, checked (seg2.Length - 1));
return Operators.CompareString(Uri.UnescapeDataString(seg1), Uri.UnescapeDataString(seg2), false) == 0;
}
public static bool IsRoot(Uri u)
{
return u.Segments.Length < 2;
}
public static string FormUrlEncode(string str)
{
StringBuilder stringBuilder = new StringBuilder();
int num1 = 0;
int num2 = checked (str.Length - 1);
int index1 = num1;
while (index1 <= num2)
{
if ((int) str[index1] == 32)
stringBuilder.Append("+");
else if ("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789$-_.!*'(),\",".Contains(Conversions.ToString(str[index1])))
{
stringBuilder.Append(str[index1]);
}
else
{
byte[] bytes = Encoding.UTF8.GetBytes(Conversions.ToString(str[index1]));
int index2 = 0;
while (index2 < bytes.Length)
{
byte num3 = bytes[index2];
stringBuilder.Append("%");
stringBuilder.Append(num3.ToString("X2"));
checked { ++index2; }
}
}
checked { ++index1; }
}
return stringBuilder.ToString();
}
public static string OAuthEncode(string str)
{
StringBuilder stringBuilder = new StringBuilder();
int num1 = 0;
int num2 = checked (str.Length - 1);
int index1 = num1;
while (index1 <= num2)
{
if ("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-._~".Contains(Conversions.ToString(str[index1])))
{
stringBuilder.Append(str[index1]);
}
else
{
byte[] bytes = Encoding.UTF8.GetBytes(Conversions.ToString(str[index1]));
int index2 = 0;
while (index2 < bytes.Length)
{
byte num3 = bytes[index2];
stringBuilder.Append("%");
stringBuilder.Append(num3.ToString("X2"));
checked { ++index2; }
}
}
checked { ++index1; }
}
return stringBuilder.ToString();
}
public static string OAuthDecode(string str)
{
List<byte> byteList = new List<byte>();
int index = 0;
while (index < str.Length)
{
byte result;
if (Operators.CompareString(Conversions.ToString(str[index]), "%", false) == 0 && index < checked (str.Length - 3) && byte.TryParse(str.Substring(checked (index + 1), 2), NumberStyles.HexNumber, (IFormatProvider) null, out result))
{
byteList.Add(result);
checked { index += 3; }
}
else
{
byteList.AddRange((IEnumerable<byte>) Encoding.UTF8.GetBytes(Conversions.ToString(str[index])));
checked { ++index; }
}
}
return Encoding.UTF8.GetString(byteList.ToArray());
}
public static Uri CreateNextCopyName(Uri target)
{
int result = 2;
string lastSegment = UriUtil.GetLastSegment(target);
string str = UriUtil.RemoveExtension(lastSegment);
if (str.EndsWith(")"))
{
int length = str.LastIndexOf("(");
if (int.TryParse(str.Substring(checked (length + 1), checked (str.Length - length - 2)), out result))
{
str = str.Substring(0, length).TrimEnd();
checked { ++result; }
}
}
return new Uri(UriUtil.GetParent(target).AbsoluteUri + str + " (" + result.ToString() + ")" + UriUtil.GetExtension(lastSegment));
}
public static string CreateNextCopyName(string name)
{
int result = 1;
string str = UriUtil.RemoveExtension(name);
if (str.EndsWith(")"))
{
int num = str.LastIndexOf("(");
if (int.TryParse(str.Substring(checked (num + 1), checked (str.Length - num - 2)), out result))
str = str.Substring(0, checked (num - 1));
}
int num1 = checked (result + 1);
return str + " (" + num1.ToString() + ")" + UriUtil.GetExtension(name);
}
public static string CreateFormUrlencodedString(Dictionary<string, string> values)
{
List<string> stringList = new List<string>();
Dictionary<string, string>.KeyCollection.Enumerator enumerator;
try
{
enumerator = values.Keys.GetEnumerator();
while (enumerator.MoveNext())
{
string current = enumerator.Current;
stringList.Add(Uri.EscapeDataString(current).Replace("%20", "+") + "=" + Uri.EscapeDataString(values[current]).Replace("%20", "+"));
}
}
finally
{
enumerator.Dispose();
}
return string.Join("&", stringList.ToArray());
}
public static Uri CreateUriFromSchemeAndPath(string scheme, string path)
{
string[] strArray = path.Split(new char[1]{ '/' }, StringSplitOptions.RemoveEmptyEntries);
string str = "";
if (strArray.Length == 0)
{
str = "/";
}
else
{
int num1 = 0;
int num2 = checked (strArray.Length - 1);
int index = num1;
while (index <= num2)
{
str = str + "/" + Uri.EscapeDataString(strArray[index]);
checked { ++index; }
}
}
return new Uri(scheme + ":" + str);
}
private static string GetFilename(string path)
{
while (path.EndsWith("\\"))
path = path.Substring(0, checked (path.Length - 1));
int num = path.LastIndexOf("\\");
if (num < 0)
return path;
return path.Substring(checked (num + 1));
}
private static string RemoveExtension(string filename)
{
int length = filename.LastIndexOf(".");
if (length < 0)
return filename;
return filename.Substring(0, length);
}
private static string GetExtension(string path)
{
string filename = UriUtil.GetFilename(path);
int num = filename.LastIndexOf(".");
if (num < 0 || checked (num + 1) >= filename.Length)
return "";
return filename.Substring(checked (num + 1));
}
}
}

View File

@@ -0,0 +1,136 @@
// Decompiled with JetBrains decompiler
// Type: Rei.Fs.WebRequestCertificateValidationManager
// 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 System.Collections;
using System.Collections.Generic;
using System.Net;
using System.Net.Security;
using System.Security.Cryptography.X509Certificates;
namespace Rei.Fs
{
public sealed class WebRequestCertificateValidationManager
{
private static Dictionary<WebRequest, WebRequestCertificateValidationManager.RequestStore> p_ReqToClient = new Dictionary<WebRequest, WebRequestCertificateValidationManager.RequestStore>();
static WebRequestCertificateValidationManager()
{
ServicePointManager.ServerCertificateValidationCallback = new RemoteCertificateValidationCallback(WebRequestCertificateValidationManager.InnerCertificateValidationCallback);
IEnumerator registeredModules = AuthenticationManager.RegisteredModules;
List<IAuthenticationModule> authenticationModuleList = new List<IAuthenticationModule>();
while (registeredModules.MoveNext())
authenticationModuleList.Add((IAuthenticationModule) registeredModules.Current);
AuthenticationManager.Register((IAuthenticationModule) new WebRequestCertificateValidationManager.FookAuthClient());
List<IAuthenticationModule>.Enumerator enumerator;
try
{
enumerator = authenticationModuleList.GetEnumerator();
while (enumerator.MoveNext())
AuthenticationManager.Register(enumerator.Current);
}
finally
{
enumerator.Dispose();
}
}
private static bool InnerCertificateValidationCallback(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors)
{
if (sslPolicyErrors == SslPolicyErrors.None)
return true;
int certErrorIgnores;
lock (WebRequestCertificateValidationManager.p_ReqToClient)
{
WebRequest key = sender as WebRequest;
if (!WebRequestCertificateValidationManager.p_ReqToClient.ContainsKey(key))
return false;
ConnectionSettingBase connectionSetting = WebRequestCertificateValidationManager.p_ReqToClient[key].ConnectionSetting;
certErrorIgnores = (int) connectionSetting.CertErrorIgnores;
connectionSetting.LastCertError = sslPolicyErrors;
}
return (sslPolicyErrors & (SslPolicyErrors) ~certErrorIgnores) == SslPolicyErrors.None;
}
public static void Register(WebRequest req, ConnectionSettingBase setting)
{
lock (WebRequestCertificateValidationManager.p_ReqToClient)
WebRequestCertificateValidationManager.p_ReqToClient.Add(req, new WebRequestCertificateValidationManager.RequestStore(setting));
}
public static void UnRegister(WebRequest req)
{
lock (WebRequestCertificateValidationManager.p_ReqToClient)
WebRequestCertificateValidationManager.p_ReqToClient.Remove(req);
}
public static string[] GetChallenges(WebRequest req)
{
lock (WebRequestCertificateValidationManager.p_ReqToClient)
{
if (!WebRequestCertificateValidationManager.p_ReqToClient.ContainsKey(req))
return new string[0];
return WebRequestCertificateValidationManager.p_ReqToClient[req].ChallengeList.ToArray();
}
}
public static ConnectionSettingBase GetConnectionSetting(WebRequest req)
{
lock (WebRequestCertificateValidationManager.p_ReqToClient)
{
if (!WebRequestCertificateValidationManager.p_ReqToClient.ContainsKey(req))
return (ConnectionSettingBase) null;
return WebRequestCertificateValidationManager.p_ReqToClient[req].ConnectionSetting;
}
}
private class FookAuthClient : IAuthenticationModule
{
public Authorization Authenticate(string challenge, WebRequest request, ICredentials credentials)
{
lock (WebRequestCertificateValidationManager.p_ReqToClient)
{
if (WebRequestCertificateValidationManager.p_ReqToClient.ContainsKey(request))
WebRequestCertificateValidationManager.p_ReqToClient[request].ChallengeList.Add(challenge);
}
return (Authorization) null;
}
public string AuthenticationType
{
get
{
return ":fook";
}
}
public bool CanPreAuthenticate
{
get
{
return false;
}
}
public Authorization PreAuthenticate(WebRequest request, ICredentials credentials)
{
return (Authorization) null;
}
}
private class RequestStore
{
public ConnectionSettingBase ConnectionSetting;
public List<string> ChallengeList;
public SslPolicyErrors LastCertError;
public RequestStore(ConnectionSettingBase c)
{
this.ChallengeList = new List<string>();
this.ConnectionSetting = c;
}
}
}
}

258
Rei.Fs/ZlibStream.cs Normal file
View File

@@ -0,0 +1,258 @@
// Decompiled with JetBrains decompiler
// Type: Rei.Fs.ZlibStream
// 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.IO;
using System.IO.Compression;
using System.Reflection;
using System.Runtime.CompilerServices;
namespace Rei.Fs
{
public class ZlibStream : Stream
{
private static FieldInfo finfo1 = typeof (DeflateStream).GetField("inflater", BindingFlags.Instance | BindingFlags.NonPublic);
private static FieldInfo finfo2 = ZlibStream.finfo1.FieldType.GetField("input", BindingFlags.Instance | BindingFlags.NonPublic);
private static MethodInfo minfo1 = ZlibStream.finfo2.FieldType.GetMethod("SkipToByteBoundary", BindingFlags.Instance | BindingFlags.Public);
private static MethodInfo minfo2 = ZlibStream.finfo2.FieldType.GetMethod("CopyTo", BindingFlags.Instance | BindingFlags.Public);
private static MethodInfo minfo3 = ZlibStream.finfo2.FieldType.GetMethod("SetInput", BindingFlags.Instance | BindingFlags.Public);
private static PropertyInfo pinfo1 = ZlibStream.finfo2.FieldType.GetProperty("AvailableBytes", BindingFlags.Instance | BindingFlags.Public);
private Stream m_stream;
private DeflateStream m_deflatestream;
private CompressionMode m_mode;
private bool m_leaveopen;
private Adler32 m_adler;
private bool m_rawdeflate;
public ZlibStream(Stream stream, CompressionMode mode)
: this(stream, mode, false)
{
}
public ZlibStream(Stream stream, CompressionMode mode, bool leaveOpen)
: this(stream, mode, leaveOpen, false)
{
}
public ZlibStream(Stream stream, CompressionMode mode, bool leaveOpen, bool canconvertrawdeflate)
{
if (stream == null)
throw new ArgumentNullException();
this.m_stream = stream;
this.m_deflatestream = (DeflateStream) null;
this.m_mode = mode;
this.m_leaveopen = leaveOpen;
this.m_rawdeflate = canconvertrawdeflate;
this.m_adler = (Adler32) null;
}
public override bool CanRead
{
get
{
if (this.m_stream == null)
return false;
if (this.m_deflatestream != null)
return this.m_deflatestream.CanRead;
return this.m_mode == CompressionMode.Decompress && this.m_stream.CanRead;
}
}
public override bool CanWrite
{
get
{
if (this.m_stream == null)
return false;
if (this.m_deflatestream != null)
return this.m_deflatestream.CanWrite;
return this.m_mode == CompressionMode.Compress && this.m_stream.CanWrite;
}
}
public override void Flush()
{
if (this.m_stream == null)
throw new ObjectDisposedException((string) null);
if (this.m_deflatestream == null)
this.m_stream.Flush();
else
this.m_deflatestream.Flush();
}
public override int Read(byte[] buffer, int offset, int count)
{
if (this.m_stream == null)
throw new ObjectDisposedException((string) null);
if (this.m_mode == CompressionMode.Compress)
throw new InvalidOperationException();
if (this.m_deflatestream == null)
{
byte[] numArray = new byte[2];
int num1 = this.m_stream.ReadByte();
if (num1 < 0)
throw new InvalidDataException();
numArray[0] = checked ((byte) num1);
int num2 = this.m_stream.ReadByte();
if (num2 < 0)
throw new InvalidDataException();
numArray[1] = checked ((byte) num2);
byte num3 = numArray[0];
if (((int) num3 & 15) == 8 && (int) (byte) ((uint) num3 >> 4) <= 7)
{
byte num4 = numArray[1];
int num5 = (int) num4 & 31;
bool flag = ((int) num4 & 32) != 0;
int num6 = (int) (byte) ((uint) num4 >> 7);
if (!flag && checked ((int) num3 * 256 + (int) num4) % 31 == 0)
{
this.m_adler = new Adler32();
this.m_deflatestream = new DeflateStream(this.m_stream, this.m_mode, true);
goto label_15;
}
}
if (!this.m_rawdeflate)
throw new NotSupportedException();
this.m_adler = (Adler32) null;
this.m_deflatestream = new DeflateStream(this.m_stream, this.m_mode, true);
object objectValue1 = RuntimeHelpers.GetObjectValue(ZlibStream.finfo1.GetValue((object) this.m_deflatestream));
object objectValue2 = RuntimeHelpers.GetObjectValue(ZlibStream.finfo2.GetValue(RuntimeHelpers.GetObjectValue(objectValue1)));
ZlibStream.minfo3.Invoke(RuntimeHelpers.GetObjectValue(objectValue2), new object[3]
{
(object) numArray,
(object) 0,
(object) 2
});
}
label_15:
int length = this.m_deflatestream.Read(buffer, offset, count);
if (this.m_adler != null)
{
if (length != 0)
{
this.m_adler.Calc(buffer, offset, length);
}
else
{
byte[] numArray = this.m_adler.Value;
object objectValue1 = RuntimeHelpers.GetObjectValue(ZlibStream.finfo1.GetValue((object) this.m_deflatestream));
object objectValue2 = RuntimeHelpers.GetObjectValue(ZlibStream.finfo2.GetValue(RuntimeHelpers.GetObjectValue(objectValue1)));
ZlibStream.minfo1.Invoke(RuntimeHelpers.GetObjectValue(objectValue2), (object[]) null);
byte[] buffer1 = new byte[checked (Conversions.ToInteger(ZlibStream.pinfo1.GetValue(RuntimeHelpers.GetObjectValue(objectValue2), (object[]) null)) - 1 + 1)];
int integer = Conversions.ToInteger(ZlibStream.minfo2.Invoke(RuntimeHelpers.GetObjectValue(objectValue2), new object[3]
{
(object) buffer1,
(object) 0,
(object) buffer1.Length
}));
while (integer < 4)
{
int num = this.m_stream.Read(buffer1, integer, checked (4 - integer));
if (num == 0)
throw new InvalidDataException();
checked { integer += num; }
}
if ((int) buffer1[0] != (int) numArray[0])
throw new InvalidDataException();
if ((int) buffer1[1] != (int) numArray[1])
throw new InvalidDataException();
if ((int) buffer1[2] != (int) numArray[2])
throw new InvalidDataException();
if ((int) buffer1[3] != (int) numArray[3])
throw new InvalidDataException();
this.m_adler = (Adler32) null;
}
}
return length;
}
public override void Write(byte[] buffer, int offset, int count)
{
if (this.m_stream == null)
throw new ObjectDisposedException((string) null);
if (this.m_mode == CompressionMode.Decompress)
throw new InvalidOperationException();
if (this.m_deflatestream == null)
{
this.m_stream.WriteByte((byte) 120);
this.m_stream.WriteByte((byte) 156);
this.m_adler = new Adler32();
this.m_deflatestream = new DeflateStream(this.m_stream, this.m_mode, true);
}
this.m_deflatestream.Write(buffer, offset, count);
this.m_adler.Calc(buffer, offset, count);
}
public override bool CanSeek
{
get
{
return false;
}
}
public override long Length
{
get
{
throw new NotImplementedException();
}
}
public override long Position
{
get
{
throw new NotImplementedException();
}
set
{
throw new NotImplementedException();
}
}
public override long Seek(long offset, SeekOrigin origin)
{
throw new NotImplementedException();
}
public override void SetLength(long value)
{
throw new NotImplementedException();
}
protected override void Dispose(bool disposing)
{
try
{
if (!disposing || this.m_stream == null)
return;
if (this.m_deflatestream != null)
{
this.m_deflatestream.Dispose();
this.m_deflatestream = (DeflateStream) null;
if (this.m_mode == CompressionMode.Compress)
{
byte[] numArray = this.m_adler.Value;
this.m_stream.WriteByte(numArray[0]);
this.m_stream.WriteByte(numArray[1]);
this.m_stream.WriteByte(numArray[2]);
this.m_stream.WriteByte(numArray[3]);
this.m_adler = (Adler32) null;
}
}
if (!this.m_leaveopen)
this.m_stream.Dispose();
this.m_stream = (Stream) null;
}
finally
{
base.Dispose(disposing);
}
}
}
}