예제 #1
0
        protected internal UriReference(UriReference uriReference)
        {
            scheme    = uriReference.scheme;
            authority = uriReference.authority;
            path      = uriReference.path;
            query     = uriReference.query;
            fragment  = uriReference.fragment;

            uriReferenceType = uriReference.Type;
        }
        protected static UniformResourceIdentifier2 TransformReferences(UriReference r)
        {
            /* UniformResourceIdentifier t = new UniformResourceIdentifier();
             *
             * if (r.scheme != null)
             * {
             *  t.scheme = r.scheme;
             *  t.authority = r.authority;
             *  t.path = remove_dot_segments(r.path);
             *  t.query = r.query;
             * }
             * else
             * {
             *  if (r.authority != null)
             *  {
             *      t.authority = r.authority;
             *      t.path = RemoveDotSegments(r.path);
             *      t.query = r.query;
             *  }
             *  else
             *  {
             *      if (r.path == string.Empty)
             *      {
             *          t.path = Base.path;
             *          if (r.query != null)
             *              t.query = r.query;
             *          else
             *              t.query = Base.query;
             *      }
             *      else
             *      {
             *          if (r.path.startsWith("/"))
             *          {
             *              t.path = RemoveDotSegments(r.path);
             *          }
             *          else
             *          {
             *              t.path = Merge(Base.path, r.path);
             *              t.path = RemoveDotSegments(t.path);
             *          }
             *          t.query = r.query;
             *      }
             *      t.authority = Base.authority;
             *  }
             *  t.scheme = Base.scheme;
             * }
             *
             * t.fragment = r.fragment; */

            return(null);
        }
예제 #3
0
        protected static Uri TransformReferences(UriReference r, Uri Base)
        {
            var t = new Uri();

            if (r.scheme != null)
            {
                t.scheme    = r.scheme;
                t.authority = r.authority;
                t.path      = RemoveDotSegments(r.path);
                t.query     = r.query;
            }
            else
            {
                if (r.authority != null)
                {
                    t.authority = r.authority;
                    t.path      = RemoveDotSegments(r.path);
                    t.query     = r.query;
                }
                else
                {
                    if (r.path == string.Empty)
                    {
                        t.path  = Base.path;
                        t.query = r.query ?? Base.query;
                    }
                    else
                    {
                        if (r.path.StartsWith("/"))
                        {
                            t.path = RemoveDotSegments(r.path);
                        }
                        else
                        {
                            t.path = Merge(Base, r.path);
                            t.path = RemoveDotSegments(t.path);
                        }
                        t.query = r.query;
                    }
                    t.authority = Base.authority;
                }
                t.scheme = Base.scheme;
            }

            t.fragment = r.fragment;

            return(null);
        }
예제 #4
0
 public Uri(UriReference uriReference, Uri baseUri)
     : base(uriReference)
 {
 }