1
1
mirror of https://github.com/dgis/xsddiagram.git synced 2024-10-05 14:17:40 +03:00

- Accept all kind of https certificates when the xsd dependencies (import or include) point to a TLS/SSL url.

- Prompt the user to authenticate when the xsd dependencies (import or include) point toward a secured url.
This commit is contained in:
dgis 2012-12-01 13:25:26 +01:00
parent a77bbf3189
commit f2aa5b469a
8 changed files with 507 additions and 24 deletions

141
LoginPromptForm.Designer.cs generated Normal file
View File

@ -0,0 +1,141 @@
namespace XSDDiagram
{
partial class LoginPromptForm
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(LoginPromptForm));
this.buttonOK = new System.Windows.Forms.Button();
this.buttonCancel = new System.Windows.Forms.Button();
this.textBoxUsername = new System.Windows.Forms.TextBox();
this.textBoxPassword = new System.Windows.Forms.TextBox();
this.labelUsername = new System.Windows.Forms.Label();
this.labelPassword = new System.Windows.Forms.Label();
this.textBoxLabel = new System.Windows.Forms.TextBox();
this.SuspendLayout();
//
// buttonOK
//
this.buttonOK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.buttonOK.DialogResult = System.Windows.Forms.DialogResult.OK;
this.buttonOK.Location = new System.Drawing.Point(64, 152);
this.buttonOK.Name = "buttonOK";
this.buttonOK.Size = new System.Drawing.Size(75, 23);
this.buttonOK.TabIndex = 0;
this.buttonOK.Text = "OK";
this.buttonOK.UseVisualStyleBackColor = true;
//
// buttonCancel
//
this.buttonCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.buttonCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.buttonCancel.Location = new System.Drawing.Point(145, 152);
this.buttonCancel.Name = "buttonCancel";
this.buttonCancel.Size = new System.Drawing.Size(75, 23);
this.buttonCancel.TabIndex = 1;
this.buttonCancel.Text = "Cancel";
this.buttonCancel.UseVisualStyleBackColor = true;
//
// textBoxUsername
//
this.textBoxUsername.Location = new System.Drawing.Point(98, 90);
this.textBoxUsername.Name = "textBoxUsername";
this.textBoxUsername.Size = new System.Drawing.Size(174, 20);
this.textBoxUsername.TabIndex = 2;
//
// textBoxPassword
//
this.textBoxPassword.Location = new System.Drawing.Point(98, 116);
this.textBoxPassword.Name = "textBoxPassword";
this.textBoxPassword.Size = new System.Drawing.Size(174, 20);
this.textBoxPassword.TabIndex = 3;
this.textBoxPassword.UseSystemPasswordChar = true;
//
// labelUsername
//
this.labelUsername.AutoSize = true;
this.labelUsername.Location = new System.Drawing.Point(12, 93);
this.labelUsername.Name = "labelUsername";
this.labelUsername.Size = new System.Drawing.Size(55, 13);
this.labelUsername.TabIndex = 4;
this.labelUsername.Text = "Username";
//
// labelPassword
//
this.labelPassword.AutoSize = true;
this.labelPassword.Location = new System.Drawing.Point(12, 119);
this.labelPassword.Name = "labelPassword";
this.labelPassword.Size = new System.Drawing.Size(53, 13);
this.labelPassword.TabIndex = 5;
this.labelPassword.Text = "Password";
//
// textBoxLabel
//
this.textBoxLabel.BorderStyle = System.Windows.Forms.BorderStyle.None;
this.textBoxLabel.Location = new System.Drawing.Point(15, 13);
this.textBoxLabel.Multiline = true;
this.textBoxLabel.Name = "textBoxLabel";
this.textBoxLabel.ReadOnly = true;
this.textBoxLabel.Size = new System.Drawing.Size(257, 71);
this.textBoxLabel.TabIndex = 6;
//
// LoginPromptForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(284, 187);
this.Controls.Add(this.textBoxLabel);
this.Controls.Add(this.labelPassword);
this.Controls.Add(this.labelUsername);
this.Controls.Add(this.textBoxPassword);
this.Controls.Add(this.textBoxUsername);
this.Controls.Add(this.buttonCancel);
this.Controls.Add(this.buttonOK);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "LoginPromptForm";
this.ShowInTaskbar = false;
this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Authentication Required";
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Button buttonOK;
private System.Windows.Forms.Button buttonCancel;
private System.Windows.Forms.TextBox textBoxUsername;
private System.Windows.Forms.TextBox textBoxPassword;
private System.Windows.Forms.Label labelUsername;
private System.Windows.Forms.Label labelPassword;
private System.Windows.Forms.TextBox textBoxLabel;
}
}

36
LoginPromptForm.cs Normal file
View File

@ -0,0 +1,36 @@
using System;
using System.Windows.Forms;
namespace XSDDiagram
{
public partial class LoginPromptForm : Form
{
public LoginPromptForm(string label)
{
InitializeComponent();
this.textBoxLabel.Text = label;
}
public string Username { get; set; }
public string Password { get; set; }
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
this.textBoxUsername.Text = Username;
this.textBoxPassword.Text = Password;
}
protected override void OnClosed(EventArgs e)
{
if (this.DialogResult == System.Windows.Forms.DialogResult.OK)
{
Username = this.textBoxUsername.Text;
Password = this.textBoxPassword.Text;
}
base.OnClosed(e);
}
}
}

197
LoginPromptForm.resx Normal file
View File

@ -0,0 +1,197 @@
<?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=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Drawing" name="System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object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AAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAND/QADQ//8A0P//AND/QAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAA////////////4f///8D///8A////QP///2H//8N///+Bf/wfgH/4D4Fg
YA/DQCwf/wAP///ALB//4GAP///4D//////nxB8TkwBsQ8EXoMPAH4DD5D4Aw/A4MMPwcPLD8DJyQ/AZ
AQPgHBwDwk//w8MH/8OPH//D////z/////8=
</value>
</data>
</root>

View File

@ -72,7 +72,9 @@ namespace XSDDiagram
this.panelDiagram.DiagramControl.MouseHover += new EventHandler(DiagramControl_MouseHover);
this.panelDiagram.DiagramControl.MouseMove += new MouseEventHandler(DiagramControl_MouseMove);
this.panelDiagram.VirtualSize = new Size(0, 0);
this.panelDiagram.DiagramControl.Paint += new PaintEventHandler(DiagramControl_Paint);
this.panelDiagram.DiagramControl.Paint += new PaintEventHandler(DiagramControl_Paint);
this.schema.RequestCredential += schema_RequestCredential;
if (Options.IsRunningOnMono)
{
@ -85,7 +87,25 @@ namespace XSDDiagram
webBrowserSupported = false;
}
}
}
}
string backupUsername = "", backupPassword = "";
bool schema_RequestCredential(string url, string realm, out string username, out string password)
{
string label = "The file '" + url + "' requires a username and password.";
LoginPromptForm dlg = new LoginPromptForm(label);
dlg.Username = backupUsername;
dlg.Password = backupPassword;
if (dlg.ShowDialog(this) == DialogResult.OK)
{
backupUsername = username = dlg.Username;
backupPassword = password = dlg.Password;
return true;
}
username = password = "";
return false;
}
/// <summary>
/// Clean up any resources being used.

View File

@ -1,6 +1,6 @@
XSD Diagram is a free xml schema definition diagram viewer (http://regis.cosnier.free.fr).
Version 0.11 Copyright (c) 2006-2012 Regis Cosnier, All Rights Reserved.
Version 0.12 Copyright (c) 2006-2012 Regis Cosnier, All Rights Reserved.
This program is free software and may be distributed
according to the terms of the GNU General Public License (GPL).
@ -98,6 +98,10 @@ TODO LIST:
CHANGES:
version 0.12 (2012-12-01)
- Accept all kind of https certificates when the xsd dependencies (import or include) point to a TLS/SSL url.
- Prompt the user to authenticate when the xsd dependencies (import or include) point toward a secured url.
version 0.11 (2012-07-22)
- Remove the "Order" attributes in the source file XmlSchema.cs which are imcompatible with mono > 2.6!
- Add the option "-y" to force huge image generation without user prompt.

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<OutputPath>bin\x86\Release\</OutputPath>
@ -114,6 +114,12 @@
<DependentUpon>ErrorReportForm.cs</DependentUpon>
</Compile>
<Compile Include="FileShellExtension.cs" />
<Compile Include="LoginPromptForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="LoginPromptForm.Designer.cs">
<DependentUpon>LoginPromptForm.cs</DependentUpon>
</Compile>
<Compile Include="MainForm.cs">
<SubType>Form</SubType>
</Compile>
@ -142,6 +148,9 @@
<SubType>Designer</SubType>
<DependentUpon>ErrorReportForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="LoginPromptForm.resx">
<DependentUpon>LoginPromptForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="MainForm.resx">
<SubType>Designer</SubType>
<DependentUpon>MainForm.cs</DependentUpon>

49
XSDDiagram2012.sln Normal file
View File

@ -0,0 +1,49 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual C# Express 2010
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "XSDDiagram2010", "XSDDiagram2010.csproj", "{B212CAFE-B4C8-44CB-B82D-AA32B55D2719}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "XSDDiagramConsole2010", "XSDDiagramConsole\XSDDiagramConsole2010.csproj", "{1D732DFD-D631-4BFB-8057-C34B9327A08F}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "XSDDiagrams2010", "XsdDiagrams\XSDDiagrams2010.csproj", "{6D3DACE7-D51B-4259-883A-6899BF4D52E2}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{B212CAFE-B4C8-44CB-B82D-AA32B55D2719}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B212CAFE-B4C8-44CB-B82D-AA32B55D2719}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B212CAFE-B4C8-44CB-B82D-AA32B55D2719}.Debug|x86.ActiveCfg = Debug|x86
{B212CAFE-B4C8-44CB-B82D-AA32B55D2719}.Debug|x86.Build.0 = Debug|x86
{B212CAFE-B4C8-44CB-B82D-AA32B55D2719}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B212CAFE-B4C8-44CB-B82D-AA32B55D2719}.Release|Any CPU.Build.0 = Release|Any CPU
{B212CAFE-B4C8-44CB-B82D-AA32B55D2719}.Release|x86.ActiveCfg = Release|x86
{B212CAFE-B4C8-44CB-B82D-AA32B55D2719}.Release|x86.Build.0 = Release|x86
{1D732DFD-D631-4BFB-8057-C34B9327A08F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1D732DFD-D631-4BFB-8057-C34B9327A08F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1D732DFD-D631-4BFB-8057-C34B9327A08F}.Debug|x86.ActiveCfg = Debug|x86
{1D732DFD-D631-4BFB-8057-C34B9327A08F}.Debug|x86.Build.0 = Debug|x86
{1D732DFD-D631-4BFB-8057-C34B9327A08F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1D732DFD-D631-4BFB-8057-C34B9327A08F}.Release|Any CPU.Build.0 = Release|Any CPU
{1D732DFD-D631-4BFB-8057-C34B9327A08F}.Release|x86.ActiveCfg = Release|x86
{1D732DFD-D631-4BFB-8057-C34B9327A08F}.Release|x86.Build.0 = Release|x86
{6D3DACE7-D51B-4259-883A-6899BF4D52E2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6D3DACE7-D51B-4259-883A-6899BF4D52E2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6D3DACE7-D51B-4259-883A-6899BF4D52E2}.Debug|x86.ActiveCfg = Debug|x86
{6D3DACE7-D51B-4259-883A-6899BF4D52E2}.Debug|x86.Build.0 = Debug|x86
{6D3DACE7-D51B-4259-883A-6899BF4D52E2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6D3DACE7-D51B-4259-883A-6899BF4D52E2}.Release|Any CPU.Build.0 = Release|Any CPU
{6D3DACE7-D51B-4259-883A-6899BF4D52E2}.Release|x86.ActiveCfg = Release|x86
{6D3DACE7-D51B-4259-883A-6899BF4D52E2}.Release|x86.Build.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(MonoDevelopProperties) = preSolution
StartupItem = XSDDiagram.csproj
EndGlobalSection
EndGlobal

View File

@ -39,6 +39,9 @@ namespace XSDDiagram
schemaSerializer.UnknownNode += new XmlNodeEventHandler(schemaSerializer_UnknownNode);
schemaSerializer.UnknownElement += new XmlElementEventHandler(schemaSerializer_UnknownElement);
schemaSerializer.UnknownAttribute += new XmlAttributeEventHandler(schemaSerializer_UnknownAttribute);
//Trust all certificates
System.Net.ServicePointManager.ServerCertificateValidationCallback = ((sender, certificate, chain, sslPolicyErrors) => true);
}
public IList<XSDObject> Elements { get { return elements; } }
@ -48,6 +51,9 @@ namespace XSDDiagram
public IList<string> LoadError { get { return loadError; } }
public IList<string> XsdFilenames { get { return listOfXsdFilename; } }
public delegate bool RequestCredentialEventHandler(string url, string realm, out string username, out string password);
public event RequestCredentialEventHandler RequestCredential;
public void LoadSchema(string fileName)
{
this.firstElement = null;
@ -132,29 +138,50 @@ namespace XSDDiagram
if (!File.Exists(loadedFileName))
{
WebClient webClient = new WebClient();
//webClient.Credentials = new System.Net.NetworkCredential("username", "password");
try
bool tryAgain = false;
do
{
//webClient.DownloadFile(uri, loadedFileName);
string importedXsdFile = webClient.DownloadString(uri);
try
{
//webClient.DownloadFile(uri, loadedFileName);
tryAgain = false;
string importedXsdFile = webClient.DownloadString(uri);
string importedXsdFileWithoutDTD = new Regex(@"<!DOCTYPE[^>]*>", RegexOptions.Singleline | RegexOptions.IgnoreCase).Replace(importedXsdFile, String.Empty);
string importedXsdFileWithoutDTD = new Regex(@"<!DOCTYPE[^>]*>", RegexOptions.Singleline | RegexOptions.IgnoreCase).Replace(importedXsdFile, String.Empty);
using (StreamWriter outfile = new StreamWriter(loadedFileName))
{
outfile.Write(importedXsdFileWithoutDTD);
}
}
//catch (WebException)
//{
// this.loadError.Add("Cannot load the dependency: " + uri.ToString() + ", error: " + ex.ToString());
// loadedFileName = null;
//}
catch (Exception ex)
{
this.loadError.Add("Cannot load the dependency: " + uri.ToString() + ", error: " + ex.ToString());
loadedFileName = null;
}
using (StreamWriter outfile = new StreamWriter(loadedFileName))
{
outfile.Write(importedXsdFileWithoutDTD);
}
}
catch (WebException ex)
{
if (ex.Response is HttpWebResponse)
{
HttpWebResponse response = ex.Response as HttpWebResponse;
if (response != null && RequestCredential != null && (response.StatusCode == HttpStatusCode.Unauthorized || response.StatusCode == HttpStatusCode.Forbidden))
{
string username = "", password = "";
if (RequestCredential(url, "", out username, out password))
{
webClient.Credentials = new System.Net.NetworkCredential(username, password);
tryAgain = true;
}
}
}
if (!tryAgain)
{
this.loadError.Add("Cannot load the dependency: " + uri.ToString() + ", error: " + ex.ToString());
loadedFileName = null;
}
}
catch (Exception ex)
{
this.loadError.Add("Cannot load the dependency: " + uri.ToString() + ", error: " + ex.ToString());
loadedFileName = null;
}
}
while (tryAgain);
}
}
}