diff --git a/Shared/DecaTec.WebDav.Shared/LockToken.cs b/Shared/DecaTec.WebDav.Shared/LockToken.cs index f8fdbfc..caeba57 100644 --- a/Shared/DecaTec.WebDav.Shared/LockToken.cs +++ b/Shared/DecaTec.WebDav.Shared/LockToken.cs @@ -7,8 +7,6 @@ namespace DecaTec.WebDav /// public class LockToken { - private string lockToken; - /// /// Initializes a new instance of LockToken. /// @@ -18,9 +16,16 @@ public LockToken(string lockToken) if (string.IsNullOrEmpty(lockToken)) throw new WebDavException("A lock token cannot be null or empty."); - this.lockToken = lockToken; + this.RawLockToken = lockToken; } + /// + /// Gets the raw representation of the lock token for serialization purposes. + /// + /// Use to get the formatted representation for use in headers. + /// + public string RawLockToken { get; } + /// /// Gets the string representation of a lock token as used in an IF header. /// @@ -30,16 +35,16 @@ public string ToString(LockTokenFormat format) { var sb = new StringBuilder(); - if (format == LockTokenFormat.IfHeader && !this.lockToken.StartsWith("(")) + if (format == LockTokenFormat.IfHeader && !this.RawLockToken.StartsWith("(")) sb.Append("("); - else if(!this.lockToken.StartsWith("<") && !this.lockToken.StartsWith("(")) + else if(!this.RawLockToken.StartsWith("<") && !this.RawLockToken.StartsWith("(")) sb.Append("<"); - sb.Append(this.lockToken); + sb.Append(this.RawLockToken); - if (format == LockTokenFormat.IfHeader && !this.lockToken.EndsWith(")")) + if (format == LockTokenFormat.IfHeader && !this.RawLockToken.EndsWith(")")) sb.Append(")"); - else if(!this.lockToken.EndsWith(">") && !this.lockToken.EndsWith(")")) + else if(!this.RawLockToken.EndsWith(">") && !this.RawLockToken.EndsWith(")")) sb.Append(">"); return sb.ToString();