/wasDAVClient/Helpers/ResponseParser.cs |
@@ -9,12 +9,19 @@ |
namespace wasDAVClient.Helpers |
{ |
/// <summary> |
/// Represents the parser for response's results. |
/// Represents the parser for response's results. |
/// </summary> |
internal static class ResponseParser |
{ |
internal static XmlReaderSettings XmlReaderSettings = new XmlReaderSettings |
{ |
IgnoreComments = true, |
IgnoreProcessingInstructions = true, |
IgnoreWhitespace = true |
}; |
|
/// <summary> |
/// Parses the disk item. |
/// Parses the disk item. |
/// </summary> |
/// <param name="stream">The response text.</param> |
/// <returns>The parsed item.</returns> |
@@ -23,15 +30,8 @@ |
return ParseItems(stream).FirstOrDefault(); |
} |
|
internal static XmlReaderSettings XmlReaderSettings = new XmlReaderSettings |
{ |
IgnoreComments = true, |
IgnoreProcessingInstructions = true, |
IgnoreWhitespace = true |
}; |
|
/// <summary> |
/// Parses the disk items. |
/// Parses the disk items. |
/// </summary> |
/// <param name="stream">The response text.</param> |
/// <returns>The list of parsed items.</returns> |
@@ -40,7 +40,6 @@ |
var items = new List<Item>(); |
using (var reader = XmlReader.Create(stream, XmlReaderSettings)) |
{ |
|
Item itemInfo = null; |
while (reader.Read()) |
{ |
@@ -125,7 +124,8 @@ |
{ |
reader.Read(); |
var resourceType = reader.LocalName.ToLower(); |
if (string.Equals(resourceType, "collection", StringComparison.InvariantCultureIgnoreCase)) |
if (string.Equals(resourceType, "collection", |
StringComparison.InvariantCultureIgnoreCase)) |
itemInfo.IsCollection = true; |
} |
break; |
@@ -138,10 +138,10 @@ |
reader.Skip(); |
break; |
default: |
{ |
int a = 0; |
break; |
} |
{ |
var a = 0; |
break; |
} |
} |
} |
else if (reader.NodeType == XmlNodeType.EndElement && reader.LocalName.ToLower() == "response") |
@@ -164,7 +164,5 @@ |
|
return items; |
} |
|
|
} |
} |
} |
/wasDAVClient/Helpers/wasDAVConflictException.cs |
@@ -9,32 +9,39 @@ |
{ |
} |
|
public wasDAVConflictException(string message) |
public wasDAVConflictException(string message) |
: base(message) |
{} |
{ |
} |
|
public wasDAVConflictException(string message, int hr) |
public wasDAVConflictException(string message, int hr) |
: base(message, hr) |
{} |
{ |
} |
|
public wasDAVConflictException(string message, Exception innerException) |
public wasDAVConflictException(string message, Exception innerException) |
: base(message, innerException) |
{} |
{ |
} |
|
public wasDAVConflictException(int httpCode, string message, Exception innerException) |
public wasDAVConflictException(int httpCode, string message, Exception innerException) |
: base(httpCode, message, innerException) |
{} |
{ |
} |
|
public wasDAVConflictException(int httpCode, string message) |
public wasDAVConflictException(int httpCode, string message) |
: base(httpCode, message) |
{} |
{ |
} |
|
public wasDAVConflictException(int httpCode, string message, int hr) |
public wasDAVConflictException(int httpCode, string message, int hr) |
: base(httpCode, message, hr) |
{} |
{ |
} |
|
protected wasDAVConflictException(SerializationInfo info, StreamingContext context) |
protected wasDAVConflictException(SerializationInfo info, StreamingContext context) |
: base(info, context) |
{} |
{ |
} |
} |
} |
/wasDAVClient/Helpers/wasDAVException.cs |
@@ -10,37 +10,44 @@ |
{ |
} |
|
public wasDAVException(string message) |
public wasDAVException(string message) |
: base(message) |
{} |
{ |
} |
|
public wasDAVException(string message, int hr) |
public wasDAVException(string message, int hr) |
: base(message, hr) |
{} |
{ |
} |
|
public wasDAVException(string message, Exception innerException) |
public wasDAVException(string message, Exception innerException) |
: base(message, innerException) |
{} |
{ |
} |
|
public wasDAVException(int httpCode, string message, Exception innerException) |
public wasDAVException(int httpCode, string message, Exception innerException) |
: base(httpCode, message, innerException) |
{} |
{ |
} |
|
public wasDAVException(int httpCode, string message) |
public wasDAVException(int httpCode, string message) |
: base(httpCode, message) |
{} |
{ |
} |
|
public wasDAVException(int httpCode, string message, int hr) |
public wasDAVException(int httpCode, string message, int hr) |
: base(httpCode, message, hr) |
{} |
{ |
} |
|
protected wasDAVException(SerializationInfo info, StreamingContext context) |
protected wasDAVException(SerializationInfo info, StreamingContext context) |
: base(info, context) |
{} |
{ |
} |
|
public override string ToString() |
{ |
var s = string.Format("HttpStatusCode: {0}", base.GetHttpCode()); |
var s = string.Format("HttpStatusCode: {0}", GetHttpCode()); |
s += Environment.NewLine + string.Format("ErrorCode: {0}", ErrorCode); |
s += Environment.NewLine + string.Format("Message: {0}", Message); |
s += Environment.NewLine + base.ToString(); |