459 lines
14 KiB
C#
459 lines
14 KiB
C#
// Decompiled with JetBrains decompiler
|
|
// Type: CarotDAV.ServerCertErrorPromptForm
|
|
// Assembly: CarotDAV, Version=1.13.2.18337, Culture=neutral, PublicKeyToken=null
|
|
// MVID: C31F2651-A4A8-4D09-916A-8C6106F5E7C8
|
|
// Assembly location: F:\Eigene Dateien\Dropbox\portable Collection\Progs\CarotDAV\CarotDAV.exe
|
|
|
|
using Microsoft.VisualBasic.CompilerServices;
|
|
using System;
|
|
using System.ComponentModel;
|
|
using System.Diagnostics;
|
|
using System.Drawing;
|
|
using System.Net.Security;
|
|
using System.Runtime.CompilerServices;
|
|
using System.Windows.Forms;
|
|
|
|
namespace CarotDAV
|
|
{
|
|
[DesignerGenerated]
|
|
public class ServerCertErrorPromptForm : Form
|
|
{
|
|
private IContainer components;
|
|
[AccessedThroughProperty("m_CancelButton")]
|
|
private Button _m_CancelButton;
|
|
[AccessedThroughProperty("RetryButton")]
|
|
private Button _RetryButton;
|
|
[AccessedThroughProperty("IgnoreButton")]
|
|
private Button _IgnoreButton;
|
|
[AccessedThroughProperty("MessageLabel")]
|
|
private Label _MessageLabel;
|
|
[AccessedThroughProperty("Label1")]
|
|
private Label _Label1;
|
|
[AccessedThroughProperty("TargetTextBox")]
|
|
private TextBox _TargetTextBox;
|
|
[AccessedThroughProperty("ChainErrorLabel")]
|
|
private Label _ChainErrorLabel;
|
|
[AccessedThroughProperty("NameMismatchLabel")]
|
|
private Label _NameMismatchLabel;
|
|
[AccessedThroughProperty("NotAvailableLabel")]
|
|
private Label _NotAvailableLabel;
|
|
private string pMessage;
|
|
private SslPolicyErrors pPolicyError;
|
|
private string pTarget;
|
|
|
|
public ServerCertErrorPromptForm()
|
|
{
|
|
this.Shown += new EventHandler(this.ServerCertErrorPromptForm_Shown);
|
|
this.Load += new EventHandler(this.ServerCertErrorPromptForm_Load);
|
|
this.pMessage = string.Empty;
|
|
this.pTarget = string.Empty;
|
|
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.m_CancelButton = new Button();
|
|
this.RetryButton = new Button();
|
|
this.IgnoreButton = new Button();
|
|
this.MessageLabel = new Label();
|
|
this.Label1 = new Label();
|
|
this.TargetTextBox = new TextBox();
|
|
this.ChainErrorLabel = new Label();
|
|
this.NameMismatchLabel = new Label();
|
|
this.NotAvailableLabel = new Label();
|
|
this.SuspendLayout();
|
|
this.m_CancelButton.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
|
this.m_CancelButton.DialogResult = DialogResult.Cancel;
|
|
Button mCancelButton1 = this.m_CancelButton;
|
|
Point point1 = new Point(288, 152);
|
|
Point point2 = point1;
|
|
mCancelButton1.Location = point2;
|
|
this.m_CancelButton.Name = "m_CancelButton";
|
|
Button mCancelButton2 = this.m_CancelButton;
|
|
Size size1 = new Size(72, 24);
|
|
Size size2 = size1;
|
|
mCancelButton2.Size = size2;
|
|
this.m_CancelButton.TabIndex = 8;
|
|
this.m_CancelButton.Text = "Cancel";
|
|
this.m_CancelButton.UseVisualStyleBackColor = true;
|
|
this.RetryButton.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
|
Button retryButton1 = this.RetryButton;
|
|
point1 = new Point(208, 152);
|
|
Point point3 = point1;
|
|
retryButton1.Location = point3;
|
|
this.RetryButton.Name = "RetryButton";
|
|
Button retryButton2 = this.RetryButton;
|
|
size1 = new Size(72, 24);
|
|
Size size3 = size1;
|
|
retryButton2.Size = size3;
|
|
this.RetryButton.TabIndex = 7;
|
|
this.RetryButton.Text = "Retry";
|
|
this.RetryButton.UseVisualStyleBackColor = true;
|
|
this.IgnoreButton.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
|
|
Button ignoreButton1 = this.IgnoreButton;
|
|
point1 = new Point(128, 152);
|
|
Point point4 = point1;
|
|
ignoreButton1.Location = point4;
|
|
this.IgnoreButton.Name = "IgnoreButton";
|
|
Button ignoreButton2 = this.IgnoreButton;
|
|
size1 = new Size(72, 25);
|
|
Size size4 = size1;
|
|
ignoreButton2.Size = size4;
|
|
this.IgnoreButton.TabIndex = 6;
|
|
this.IgnoreButton.Text = "Ignore";
|
|
this.IgnoreButton.UseVisualStyleBackColor = true;
|
|
this.MessageLabel.AutoSize = true;
|
|
Label messageLabel1 = this.MessageLabel;
|
|
point1 = new Point(8, 8);
|
|
Point point5 = point1;
|
|
messageLabel1.Location = point5;
|
|
this.MessageLabel.Name = "MessageLabel";
|
|
Label messageLabel2 = this.MessageLabel;
|
|
size1 = new Size(79, 12);
|
|
Size size5 = size1;
|
|
messageLabel2.Size = size5;
|
|
this.MessageLabel.TabIndex = 0;
|
|
this.MessageLabel.Text = "Error Message";
|
|
this.Label1.AutoSize = true;
|
|
Label label1_1 = this.Label1;
|
|
point1 = new Point(8, 24);
|
|
Point point6 = point1;
|
|
label1_1.Location = point6;
|
|
this.Label1.Name = "Label1";
|
|
Label label1_2 = this.Label1;
|
|
size1 = new Size(38, 12);
|
|
Size size6 = size1;
|
|
label1_2.Size = size6;
|
|
this.Label1.TabIndex = 1;
|
|
this.Label1.Text = "Target";
|
|
this.TargetTextBox.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
|
TextBox targetTextBox1 = this.TargetTextBox;
|
|
point1 = new Point(8, 40);
|
|
Point point7 = point1;
|
|
targetTextBox1.Location = point7;
|
|
this.TargetTextBox.Multiline = true;
|
|
this.TargetTextBox.Name = "TargetTextBox";
|
|
this.TargetTextBox.ReadOnly = true;
|
|
TextBox targetTextBox2 = this.TargetTextBox;
|
|
size1 = new Size(352, 32);
|
|
Size size7 = size1;
|
|
targetTextBox2.Size = size7;
|
|
this.TargetTextBox.TabIndex = 2;
|
|
this.TargetTextBox.TabStop = false;
|
|
this.ChainErrorLabel.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
|
Label chainErrorLabel1 = this.ChainErrorLabel;
|
|
point1 = new Point(32, 80);
|
|
Point point8 = point1;
|
|
chainErrorLabel1.Location = point8;
|
|
this.ChainErrorLabel.Name = "ChainErrorLabel";
|
|
Label chainErrorLabel2 = this.ChainErrorLabel;
|
|
size1 = new Size(328, 16);
|
|
Size size8 = size1;
|
|
chainErrorLabel2.Size = size8;
|
|
this.ChainErrorLabel.TabIndex = 3;
|
|
this.ChainErrorLabel.Text = "-";
|
|
this.NameMismatchLabel.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
|
Label nameMismatchLabel1 = this.NameMismatchLabel;
|
|
point1 = new Point(32, 104);
|
|
Point point9 = point1;
|
|
nameMismatchLabel1.Location = point9;
|
|
this.NameMismatchLabel.Name = "NameMismatchLabel";
|
|
Label nameMismatchLabel2 = this.NameMismatchLabel;
|
|
size1 = new Size(328, 16);
|
|
Size size9 = size1;
|
|
nameMismatchLabel2.Size = size9;
|
|
this.NameMismatchLabel.TabIndex = 4;
|
|
this.NameMismatchLabel.Text = "-";
|
|
this.NotAvailableLabel.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
|
|
Label notAvailableLabel1 = this.NotAvailableLabel;
|
|
point1 = new Point(32, 128);
|
|
Point point10 = point1;
|
|
notAvailableLabel1.Location = point10;
|
|
this.NotAvailableLabel.Name = "NotAvailableLabel";
|
|
Label notAvailableLabel2 = this.NotAvailableLabel;
|
|
size1 = new Size(328, 16);
|
|
Size size10 = size1;
|
|
notAvailableLabel2.Size = size10;
|
|
this.NotAvailableLabel.TabIndex = 5;
|
|
this.NotAvailableLabel.Text = "-";
|
|
this.AcceptButton = (IButtonControl) this.RetryButton;
|
|
this.AutoScaleDimensions = new SizeF(6f, 12f);
|
|
this.AutoScaleMode = AutoScaleMode.Font;
|
|
this.CancelButton = (IButtonControl) this.m_CancelButton;
|
|
size1 = new Size(368, 184);
|
|
this.ClientSize = size1;
|
|
this.Controls.Add((Control) this.NotAvailableLabel);
|
|
this.Controls.Add((Control) this.NameMismatchLabel);
|
|
this.Controls.Add((Control) this.ChainErrorLabel);
|
|
this.Controls.Add((Control) this.TargetTextBox);
|
|
this.Controls.Add((Control) this.Label1);
|
|
this.Controls.Add((Control) this.MessageLabel);
|
|
this.Controls.Add((Control) this.IgnoreButton);
|
|
this.Controls.Add((Control) this.m_CancelButton);
|
|
this.Controls.Add((Control) this.RetryButton);
|
|
this.MaximizeBox = false;
|
|
this.MinimizeBox = false;
|
|
size1 = new Size(384, 221);
|
|
this.MinimumSize = size1;
|
|
this.Name = nameof (ServerCertErrorPromptForm);
|
|
this.StartPosition = FormStartPosition.CenterParent;
|
|
this.Text = "Server Certificate Error";
|
|
this.ResumeLayout(false);
|
|
this.PerformLayout();
|
|
}
|
|
|
|
internal virtual Button m_CancelButton
|
|
{
|
|
get
|
|
{
|
|
return this._m_CancelButton;
|
|
}
|
|
[MethodImpl(MethodImplOptions.Synchronized)] set
|
|
{
|
|
EventHandler eventHandler = new EventHandler(this.m_CancelButton_Click);
|
|
if (this._m_CancelButton != null)
|
|
this._m_CancelButton.Click -= eventHandler;
|
|
this._m_CancelButton = value;
|
|
if (this._m_CancelButton == null)
|
|
return;
|
|
this._m_CancelButton.Click += eventHandler;
|
|
}
|
|
}
|
|
|
|
internal virtual Button RetryButton
|
|
{
|
|
get
|
|
{
|
|
return this._RetryButton;
|
|
}
|
|
[MethodImpl(MethodImplOptions.Synchronized)] set
|
|
{
|
|
EventHandler eventHandler = new EventHandler(this.RetryButton_Click);
|
|
if (this._RetryButton != null)
|
|
this._RetryButton.Click -= eventHandler;
|
|
this._RetryButton = value;
|
|
if (this._RetryButton == null)
|
|
return;
|
|
this._RetryButton.Click += eventHandler;
|
|
}
|
|
}
|
|
|
|
internal virtual Button IgnoreButton
|
|
{
|
|
get
|
|
{
|
|
return this._IgnoreButton;
|
|
}
|
|
[MethodImpl(MethodImplOptions.Synchronized)] set
|
|
{
|
|
EventHandler eventHandler = new EventHandler(this.IgnoreButton_Click);
|
|
if (this._IgnoreButton != null)
|
|
this._IgnoreButton.Click -= eventHandler;
|
|
this._IgnoreButton = value;
|
|
if (this._IgnoreButton == null)
|
|
return;
|
|
this._IgnoreButton.Click += eventHandler;
|
|
}
|
|
}
|
|
|
|
internal virtual Label MessageLabel
|
|
{
|
|
get
|
|
{
|
|
return this._MessageLabel;
|
|
}
|
|
[MethodImpl(MethodImplOptions.Synchronized)] set
|
|
{
|
|
this._MessageLabel = value;
|
|
}
|
|
}
|
|
|
|
internal virtual Label Label1
|
|
{
|
|
get
|
|
{
|
|
return this._Label1;
|
|
}
|
|
[MethodImpl(MethodImplOptions.Synchronized)] set
|
|
{
|
|
this._Label1 = value;
|
|
}
|
|
}
|
|
|
|
internal virtual TextBox TargetTextBox
|
|
{
|
|
get
|
|
{
|
|
return this._TargetTextBox;
|
|
}
|
|
[MethodImpl(MethodImplOptions.Synchronized)] set
|
|
{
|
|
this._TargetTextBox = value;
|
|
}
|
|
}
|
|
|
|
internal virtual Label ChainErrorLabel
|
|
{
|
|
get
|
|
{
|
|
return this._ChainErrorLabel;
|
|
}
|
|
[MethodImpl(MethodImplOptions.Synchronized)] set
|
|
{
|
|
this._ChainErrorLabel = value;
|
|
}
|
|
}
|
|
|
|
internal virtual Label NameMismatchLabel
|
|
{
|
|
get
|
|
{
|
|
return this._NameMismatchLabel;
|
|
}
|
|
[MethodImpl(MethodImplOptions.Synchronized)] set
|
|
{
|
|
this._NameMismatchLabel = value;
|
|
}
|
|
}
|
|
|
|
internal virtual Label NotAvailableLabel
|
|
{
|
|
get
|
|
{
|
|
return this._NotAvailableLabel;
|
|
}
|
|
[MethodImpl(MethodImplOptions.Synchronized)] set
|
|
{
|
|
this._NotAvailableLabel = value;
|
|
}
|
|
}
|
|
|
|
public string Message
|
|
{
|
|
get
|
|
{
|
|
return this.pMessage;
|
|
}
|
|
set
|
|
{
|
|
if (value == null)
|
|
value = string.Empty;
|
|
if (value.Length == 0)
|
|
value = "Server certificate error occurred.";
|
|
this.pMessage = value;
|
|
}
|
|
}
|
|
|
|
public SslPolicyErrors PolicyError
|
|
{
|
|
get
|
|
{
|
|
return this.pPolicyError;
|
|
}
|
|
set
|
|
{
|
|
this.pPolicyError = value;
|
|
if ((this.pPolicyError & SslPolicyErrors.RemoteCertificateChainErrors) != SslPolicyErrors.None)
|
|
{
|
|
this.ChainErrorLabel.Text = "Server certificate is not issued by trusted authority.";
|
|
this.ChainErrorLabel.ForeColor = Color.Red;
|
|
}
|
|
else
|
|
{
|
|
this.ChainErrorLabel.Text = "Server certificate is issued by trusted authority.";
|
|
this.ChainErrorLabel.ForeColor = Color.Black;
|
|
}
|
|
if ((this.pPolicyError & SslPolicyErrors.RemoteCertificateNameMismatch) != SslPolicyErrors.None)
|
|
{
|
|
this.NameMismatchLabel.Text = "Server certificate is not issued for the connected server.";
|
|
this.NameMismatchLabel.ForeColor = Color.Red;
|
|
}
|
|
else
|
|
{
|
|
this.NameMismatchLabel.Text = "Server certificate is issued for the connected server.";
|
|
this.NameMismatchLabel.ForeColor = Color.Black;
|
|
}
|
|
if ((this.pPolicyError & SslPolicyErrors.RemoteCertificateNotAvailable) != SslPolicyErrors.None)
|
|
{
|
|
this.NotAvailableLabel.Text = "Server certificate is not available any more.";
|
|
this.NotAvailableLabel.ForeColor = Color.Red;
|
|
}
|
|
else
|
|
{
|
|
this.NotAvailableLabel.Text = "Server Certificate is still available.";
|
|
this.NotAvailableLabel.ForeColor = Color.Black;
|
|
}
|
|
}
|
|
}
|
|
|
|
public string Target
|
|
{
|
|
get
|
|
{
|
|
return this.pTarget;
|
|
}
|
|
set
|
|
{
|
|
if (value == null)
|
|
value = string.Empty;
|
|
this.pTarget = value;
|
|
this.TargetTextBox.Text = this.pTarget;
|
|
}
|
|
}
|
|
|
|
private void ServerCertErrorPromptForm_Shown(object sender, EventArgs e)
|
|
{
|
|
this.Activate();
|
|
((Control) this.AcceptButton).Focus();
|
|
}
|
|
|
|
private void IgnoreButton_Click(object sender, EventArgs e)
|
|
{
|
|
this.DialogResult = DialogResult.Ignore;
|
|
}
|
|
|
|
private void RetryButton_Click(object sender, EventArgs e)
|
|
{
|
|
this.DialogResult = DialogResult.Retry;
|
|
}
|
|
|
|
private void m_CancelButton_Click(object sender, EventArgs e)
|
|
{
|
|
this.DialogResult = DialogResult.Cancel;
|
|
}
|
|
|
|
public static DialogResult ShowDialog(IWin32Window owner, string message, SslPolicyErrors policyerror, string target)
|
|
{
|
|
using (ServerCertErrorPromptForm certErrorPromptForm = new ServerCertErrorPromptForm())
|
|
{
|
|
certErrorPromptForm.Message = message;
|
|
certErrorPromptForm.Target = target;
|
|
certErrorPromptForm.PolicyError = policyerror;
|
|
certErrorPromptForm.RetryButton.Focus();
|
|
return certErrorPromptForm.ShowDialog(owner);
|
|
}
|
|
}
|
|
|
|
private void ServerCertErrorPromptForm_Load(object sender, EventArgs e)
|
|
{
|
|
this.Icon = CarotDAV.My.Resources.Resources.CarotDAV;
|
|
}
|
|
}
|
|
}
|