コード例 #1
0
ファイル: PurifierMono.cs プロジェクト: jfojtl/PUrify
 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);
 }
コード例 #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);
            }
コード例 #3
0
ファイル: Purify.cs プロジェクト: zidad/elasticsearch-net
            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);
            }
コード例 #4
0
ファイル: PurifierDotNet.cs プロジェクト: jfojtl/PUrify
 //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);
 }
コード例 #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);
            }
コード例 #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);
            }
コード例 #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;
			}
コード例 #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;
			}
コード例 #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;
			}