Esempio n. 1
0
 public void Purify(Uri uri)
 {
     var source = (string)mono_sourceField.GetValue(uri);
     mono_cachedToStringField.SetValue(uri, source);
     mono_cachedAbsoluteUriField.SetValue(uri, source);
     var uriInfo = new UriInfo(uri, source);
     mono_pathField.SetValue(uri, uriInfo.Path);
     mono_queryField.SetValue(uri, uriInfo.Query);
 }
Esempio n. 2
0
            public Uri Purify(Uri uri)
            {
                var source = (string)MonoSourceField.GetValue(uri);

                MonoCachedToStringField.SetValue(uri, source);
                MonoCachedAbsoluteUriField.SetValue(uri, source);
                var uriInfo = new UriInfo(uri, source);

                MonoPathField.SetValue(uri, uriInfo.Path);
                MonoQueryField.SetValue(uri, uriInfo.Query);
                return(uri);
            }
Esempio n. 3
0
            public Uri Purify(Uri uri)
            {
                var source = (string)mono_sourceField.GetValue(uri);

                mono_cachedToStringField.SetValue(uri, source ?? string.Empty);
                mono_cachedAbsoluteUriField.SetValue(uri, source ?? string.Empty);
                var uriInfo = new UriInfo(uri, source);

                mono_pathField.SetValue(uri, uriInfo.Path ?? string.Empty);
                mono_queryField.SetValue(uri, uriInfo.Query ?? string.Empty);
                return(uri);
            }
Esempio n. 4
0
 //Code inspired by Rasmus Faber's solution in this post: http://stackoverflow.com/questions/781205/getting-a-url-with-an-url-encoded-slash
 public void Purify(Uri uri)
 {
     string paq = uri.PathAndQuery; // need to access PathAndQuery
     var abs = uri.AbsoluteUri; //need to access this as well the MoreInfo prop is initialized.
     ulong flags = (ulong)flagsField.GetValue(uri);
     flags &= ~((ulong)0x30); // Flags.PathNotCanonical|Flags.QueryNotCanonical
     flagsField.SetValue(uri, flags);
     object info = infoField.GetValue(uri);
     var source = (string)stringField.GetValue(uri);
     infoStringField.SetValue(info, source);
     object moreInfo = moreInfoField.GetValue(info);
     moreInfoAbsoluteUri.SetValue(moreInfo, source);
     var uriInfo = new UriInfo(uri, source);
     moreInfoPath.SetValue(moreInfo, uriInfo.Path);
     moreInfoQuery.SetValue(moreInfo, uriInfo.Query);
 }
Esempio n. 5
0
            //Code inspired by Rasmus Faber's solution in this post: http://stackoverflow.com/questions/781205/getting-a-url-with-an-url-encoded-slash
            public Uri Purify(Uri uri)
            {
                string paq   = uri.PathAndQuery; // need to access PathAndQuery
                var    abs   = uri.AbsoluteUri;  //need to access this as well the MoreInfo prop is initialized.
                ulong  flags = (ulong)flagsField.GetValue(uri);

                flags &= ~((ulong)0x30); // Flags.PathNotCanonical|Flags.QueryNotCanonical
                flagsField.SetValue(uri, flags);
                object info   = infoField.GetValue(uri);
                var    source = (string)stringField.GetValue(uri);

                infoStringField.SetValue(info, source);
                object moreInfo = moreInfoField.GetValue(info);

                moreInfoAbsoluteUri.SetValue(moreInfo, source);
                var uriInfo = new UriInfo(uri, source);

                moreInfoPath.SetValue(moreInfo, uriInfo.Path);
                moreInfoQuery.SetValue(moreInfo, uriInfo.Query);
                return(uri);
            }
Esempio n. 6
0
            //Code inspired by Rasmus Faber's solution in this post: http://stackoverflow.com/questions/781205/getting-a-url-with-an-url-encoded-slash
            public Uri Purify(Uri uri)
            {
                // ReSharper disable once UnusedVariable
                string paq = uri.PathAndQuery;             // need to access PathAndQuery
                // ReSharper disable once UnusedVariable
                var   abs   = uri.AbsoluteUri;             //need to access this as well the MoreInfo prop is initialized.
                ulong flags = (ulong)FlagsField.GetValue(uri);

                flags &= ~((ulong)0x30);                 // Flags.PathNotCanonical|Flags.QueryNotCanonical
                FlagsField.SetValue(uri, flags);
                object info   = InfoField.GetValue(uri);
                var    source = (string)StringField.GetValue(uri);

                InfoStringField.SetValue(info, source);
                object moreInfo = MoreInfoField.GetValue(info);

                MoreInfoAbsoluteUri.SetValue(moreInfo, source);
                var uriInfo = new UriInfo(uri, source);

                MoreInfoPath.SetValue(moreInfo, uriInfo.Path);
                MoreInfoQuery.SetValue(moreInfo, uriInfo.Query);
                return(uri);
            }
Esempio n. 7
0
			public Uri Purify(Uri uri)
			{
				var source = (string)MonoSourceField.GetValue(uri);
				MonoCachedToStringField.SetValue(uri, source);
				MonoCachedAbsoluteUriField.SetValue(uri, source);
				var uriInfo = new UriInfo(uri, source);
				MonoPathField.SetValue(uri, uriInfo.Path);
				MonoQueryField.SetValue(uri, uriInfo.Query);
				return uri;
			}
Esempio n. 8
0
			//Code inspired by Rasmus Faber's solution in this post: http://stackoverflow.com/questions/781205/getting-a-url-with-an-url-encoded-slash
			public Uri Purify(Uri uri)
			{
				// ReSharper disable once UnusedVariable
				string paq = uri.PathAndQuery; // need to access PathAndQuery
				// ReSharper disable once UnusedVariable
				var abs = uri.AbsoluteUri; //need to access this as well the MoreInfo prop is initialized.
				ulong flags = (ulong)FlagsField.GetValue(uri);
				flags &= ~((ulong)0x30); // Flags.PathNotCanonical|Flags.QueryNotCanonical
				FlagsField.SetValue(uri, flags);
				object info = InfoField.GetValue(uri);
				var source = (string)StringField.GetValue(uri);
				InfoStringField.SetValue(info, source);
				object moreInfo = MoreInfoField.GetValue(info);
				MoreInfoAbsoluteUri.SetValue(moreInfo, source);
				var uriInfo = new UriInfo(uri, source);
				MoreInfoPath.SetValue(moreInfo, uriInfo.Path);
				MoreInfoQuery.SetValue(moreInfo, uriInfo.Query);
				return uri;
			}
Esempio n. 9
0
			public Uri Purify(Uri uri)
			{
				var source = (string)mono_sourceField.GetValue(uri);
				mono_cachedToStringField.SetValue(uri, source ?? string.Empty);
				mono_cachedAbsoluteUriField.SetValue(uri, source ?? string.Empty);
				var uriInfo = new UriInfo(uri, source);
				mono_pathField.SetValue(uri, uriInfo.Path ?? string.Empty);
				mono_queryField.SetValue(uri, uriInfo.Query ?? string.Empty);
				return uri;
			}