/// <summary> /// Purifies the given document. /// </summary> /// <param name="uri"> /// URI of the document. /// </param> public void Purify(Uri uri) { if (!uri.IsAbsoluteUri) { return; } var source = (string)Source.GetValue(uri); var info = new UriInfo(uri, source); Path.SetValue(uri, info.Path); Query.SetValue(uri, info.Query); Fragment.SetValue(uri, info.Fragment); CachedToString.SetValue(uri, info.Source); CachedAbsoluteUri.SetValue(uri, info.Source); }
public ContextualSerializerLookupKey(ContextTypeFlags flags, [NotNull] IContextKey contextSpecificKey, [NotNull] Type type) { if (contextSpecificKey == null) { throw new ArgumentNullException(nameof(contextSpecificKey), $"Provided argument {nameof(contextSpecificKey)} is null."); } if (type == null) { throw new ArgumentNullException(nameof(type), $"Provided argument {type} is null."); } ContextType = type; ContextFlags = flags; ContextSpecificKey = contextSpecificKey; CachedToString = $"{this.ContextFlags.ToString()}-{this.ContextSpecificKey?.GetType()?.Name}-{this.ContextSpecificKey.Key}-{ContextType?.FullName}"; CachedHashCode = CachedToString.GetHashCode(); }