/// <summary>
 /// Convert the string to a valid URI.
 /// </summary>
 /// <param name="value">The value.</param>
 /// <param name="uriKind">The uri kind.</param>
 /// <returns>The <see cref="Uri"/>, or null if it is invalid URI.</returns>
 public static Uri ToUri(this string value, UriKind uriKind = UriKind.Absolute)
 {
     return
         (string.IsNullOrWhiteSpace(value) || !Uri.IsWellFormedUriString(value, uriKind))
             ? null
             : new Uri(value, uriKind);
 }
Exemple #2
0
 private void ValidatePackageUri(string packageUri, UriKind allowedUriKind)
 {
     if (!_galleryUriValidator.IsValidUri(packageUri, allowedUriKind))
     {
         throw new UriFormatException(packageUri);
     }
 }
Exemple #3
0
        internal static bool TryMakeUri(string path, bool isDirectory, UriKind kind, out Uri uri) {
            if (isDirectory && !string.IsNullOrEmpty(path) && !HasEndSeparator(path)) {
                path += Path.DirectorySeparatorChar;
            }

            return Uri.TryCreate(path, kind, out uri);
        }
Exemple #4
0
 public NetflixCatalog(Uri serviceRoot, UriKind absolute) : 
         base(serviceRoot)
 {
     this.ResolveName = new global::System.Func<global::System.Type, string>(this.ResolveNameFromType);
     this.ResolveType = new global::System.Func<string, global::System.Type>(this.ResolveTypeFromName);
     this.OnContextCreated();
 }
        public static void ParseUriList(string listOfUrisAsString, Collection<Uri> uriCollection, UriKind uriKind)
        {
            Fx.Assert(listOfUrisAsString != null, "The listOfUrisAsString must be non null.");
            Fx.Assert(uriCollection != null, "The uriCollection must be non null.");

            string[] uriStrings = listOfUrisAsString.Split(whiteSpaceChars, StringSplitOptions.RemoveEmptyEntries);
            if (uriStrings.Length > 0)
            {
                for (int i = 0; i < uriStrings.Length; i++)
                {
                    try
                    {
                        uriCollection.Add(new Uri(uriStrings[i], uriKind));
                    }
                    catch (FormatException fe)
                    {
                        if (uriKind == UriKind.Absolute)
                        {
                            throw FxTrace.Exception.AsError(new XmlException(SR2.DiscoveryXmlAbsoluteUriFormatError(uriStrings[i]), fe));
                        }
                        else
                        {
                            throw FxTrace.Exception.AsError(new XmlException(SR2.DiscoveryXmlUriFormatError(uriStrings[i]), fe));
                        }
                    }
                }
            }
        }
Exemple #6
0
        public static Book GetBook(string url, UriKind urikind)
        {
            Book result = new Book();
            string content = AtFile.GetContent(url, 4);
            MemoryStream stream = new MemoryStream(Encoding.UTF8.GetBytes(content));
            StreamReader reader = null;
            try
            {
                reader = new StreamReader(stream);
                string str2 = null;
                while ((str2 = reader.ReadLine()) != null)
                {
                    string[] strArray = str2.Replace("&&", "&").Split(new char[] { '&' });
                    if (strArray.Length >= 3)
                    {
                        Chapter item = new Chapter();
                        item.Title = strArray[0];
                        item.FileName = strArray[1];
                        item.Size = int.Parse(strArray[2]);
                        result.Chapters.Add(item);
                    }
                }
                reader.Close();
            }
            catch (NullReferenceException ex)
            {

            }
            return result;
        }
 public static Image GetImage(String uri, Style style, UriKind uriKind)
 {
     return new Image 
     {
         Source = GetImageSource(uri, uriKind),
         Style = style,
     };
 }
Exemple #8
0
 //获取Rich Content
 void GetRichContent(string uri, UriKind uk)
 {
     Container.Children.Clear();
     ControlHtmlHost chtml = new ControlHtmlHost();
     HtmlHost hh = chtml.FindName("htmlHost") as HtmlHost;
     hh.SourceUri = new Uri(uri, uk);
     Container.Children.Add(chtml);
 }
Exemple #9
0
 void LoadImage(string path, UriKind uriKind = UriKind.Absolute)
 {
     var bitmap = new BitmapImage();
     bitmap.BeginInit();
     bitmap.UriSource = new Uri(path, uriKind);
     bitmap.EndInit();
     Model.ImageSource = bitmap;
 }
Exemple #10
0
        // MonoAndroid parses relative URI's and adds a "file://" protocol, which causes the matcher to fail
        public static bool TryParse(string url, UriKind kind, out Uri output)
        {
            bool systemResult = Uri.TryCreate(url, kind, out output);

            bool isAndroidFalsePositive = systemResult && output.Scheme == "file" && !url.StartsWith("file://", StringComparison.Ordinal);

            return systemResult && !isAndroidFalsePositive;
        }
        public static Uri ToUri(string value, UriKind uriKind)
        {
            Uri uri;

            Uri.TryCreate(value, UriKind.RelativeOrAbsolute, out uri);

            return uri;
        }
 /// <summary>
 /// 将图像文件(使用相对路径)转为BitmapSource对象
 /// </summary>
 /// <param name="ImageFileFullName"></param>
 /// <returns></returns>
 public static BitmapSource GetBitmapSourceFromImageFileName(string ImageFileName, UriKind uriKind)
 {
     BitmapImage myBitmapImage = new BitmapImage();
     myBitmapImage.BeginInit();
     myBitmapImage.UriSource = new Uri(ImageFileName, uriKind);
     myBitmapImage.EndInit();
     return myBitmapImage;
 }
        public static Uri ToUri(this string target, UriKind uriKind)
        {
            if (target == null)
            {
                return null;
            }

            return new Uri(target, uriKind);
        }
 /// <summary>
 /// Adds a thumbnail to the project type.
 /// </summary>
 /// <param name="location"></param>
 /// <param name="kind"></param>
 /// <param name="pt"></param>
 /// <returns></returns>
 public static ProjectType AddThumbnail(string location, UriKind kind, ProjectType pt)
 {
     BitmapImage logo = new BitmapImage();
     logo.BeginInit();
     logo.UriSource = new Uri(location, kind);
     logo.EndInit();
     pt.Icon = logo;
     return pt;
 }
Exemple #15
0
 internal static Uri IsValidUri(out bool isValid, string url, UriKind kind = UriKind.RelativeOrAbsolute)
 {
     isValid = false;
     if(string.IsNullOrEmpty(url))
         return null;
     Uri temp;
     isValid = Uri.TryCreate(url, kind, out temp);
     return temp;
 }
        public static bool TryParseComponents(string uri, UriKind kind, out UriElements elements, out string error)
        {
            uri = uri.Trim();

            ParserState state = new ParserState(uri, kind);
            elements = state.elements;
            error = null;

            if (uri.Length == 0 && (kind == UriKind.Relative || kind == UriKind.RelativeOrAbsolute))
            {
                state.elements.isAbsoluteUri = false;
                return true;
            }

            if (uri.Length <= 1 && kind == UriKind.Absolute)
            {
                error = "Absolute URI is too short";
                return false;
            }

            bool ok = ParseFilePath(state) &&
                ParseScheme(state);

            var scheme = state.elements.scheme;
            UriParser parser = null;
            if (!StringUtilities.IsNullOrEmpty(scheme))
            {
                parser = UriParser.GetParser(scheme);
                if (parser != null && !(parser is DefaultUriParser))
                    return true;
            }

            ok = ok &&
                ParseAuthority(state) &&
                ParsePath(state) &&
                ParseQuery(state) &&
                ParseFragment(state);

            if (StringUtilities.IsNullOrEmpty(state.elements.host) &&
                (scheme == Uri.UriSchemeHttp || scheme == Uri.UriSchemeGopher || scheme == Uri.UriSchemeNntp ||
                scheme == Uri.UriSchemeHttps || scheme == Uri.UriSchemeFtp))
                state.error = "Invalid URI: The Authority/Host could not be parsed.";

            if (!StringUtilities.IsNullOrEmpty(state.elements.host) &&
                Uri.CheckHostName(state.elements.host) == UriHostNameType.Unknown)
                state.error = "Invalid URI: The hostname could not be parsed.";

            if (!StringUtilities.IsNullOrEmpty(state.error))
            {
                elements = null;
                error = state.error;
                return false;
            }

            return true;
        }
		public static UriElements ParseComponents (string uri, UriKind kind)
		{
			UriElements elements;
			string error;

			if (!TryParseComponents (uri, kind, out elements, out error))
				throw new UriFormatException (error);

			return elements;
		}
Exemple #18
0
		public Uri CreateUri(object parameters, UriKind kind = UriKind.Relative) {
			string href = this.Href;
			foreach (PropertyInfo substitution in parameters.GetType().GetProperties()) {
				string name = substitution.Name;
				object value = substitution.GetValue(parameters, null);
				string substituionValue = value == null ? null : Uri.EscapeDataString(value.ToString());
				href = href.Replace(string.Format("{{{0}}}", name), substituionValue);
			}
			return new Uri(href, kind);
		}
Exemple #19
0
        public FastBitmap(string filename, UriKind uriKind = UriKind.Absolute)
        {
            // Use BitmapCacheOption.OnLoad to avoid file locks (thanks Mikhail-Fiadosenka).
            // http://social.msdn.microsoft.com/forums/en-US/wpf/thread/3738345b-a6cc-421d-a98f-d907292d6e35/
            var image = new BitmapImage();
            image.BeginInit();
            image.CacheOption = BitmapCacheOption.OnLoad;
            image.UriSource = new Uri(filename, uriKind);
            image.EndInit();

            InnerBitmap = new WriteableBitmap(ConvertFormat(image));
        }
        public NavigationItem(string containerRegisteredName, UriKind uriKind)
        {

            if (String.IsNullOrEmpty(containerRegisteredName))
            {
                throw new ArgumentNullException("containerRegisteredName");
            }

            ContainerRegisteredName = containerRegisteredName;
            Uri = new Uri(ContainerRegisteredName, UriKind.Relative);

        }
Exemple #21
0
        internal static Uri MakeUri(string path, bool isDirectory, UriKind kind, string throwParameterName = "path") {
            try {
                if (isDirectory && !string.IsNullOrEmpty(path) && !HasEndSeparator(path)) {
                    path += Path.DirectorySeparatorChar;
                }

                return new Uri(path, kind);

            } catch (UriFormatException ex) {
                throw new ArgumentException("Path was invalid", throwParameterName, ex);
            } catch (ArgumentException ex) {
                throw new ArgumentException("Path was invalid", throwParameterName, ex);
            }
        }
Exemple #22
0
 public static byte[] GetBytes(string url, UriKind urikind)
 {
     Uri uriResource = new Uri(url, urikind);
     StreamResourceInfo resourceStream = Application.GetResourceStream(uriResource);
     MemoryStream stream = new MemoryStream();
     int count = 0x800;
     byte[] buffer = new byte[count];
     while (count > 0)
     {
         count = resourceStream.Stream.Read(buffer, 0, count);
         stream.Write(buffer, 0, count);
     }
     return stream.GetBuffer();
 }
Exemple #23
0
        public Uri(string uriString, UriKind uriKind)
            : this(uriString)
        {
            switch (uriKind)
            {
                case UriKind.Absolute:
                    if(!IsAbsolute) throw new UriFormatException();
                    break;

                case UriKind.Relative:
                    if (IsAbsolute) throw new UriFormatException();
                    break;
            }
        }
Exemple #24
0
		private static IntPtr Ctor2 (string uri_string, UriKind uri_kind)
		{
			try {
				return ToGCHandlePtr (ToGCHandle (new Uri (uri_string, uri_kind)));
			} catch (Exception ex) {
#if DEBUG
				try {
					Console.WriteLine ("UriHelper.Ctor2 ({0}, {2}): {1}", uri_string, ex.Message, uri_kind);
				} catch {
				}
#endif
				return IntPtr.Zero;
			}
		}
Exemple #25
0
		private static Uri TryCreateUri(string value, UriKind kind)
		{
			if (string.IsNullOrEmpty(value))
				return null;

			try
			{
				return new Uri(value, kind);
			}
			catch (UriFormatException)
			{
				return null;
			}
		}
Exemple #26
0
		public void AddImage(string path, TileMode tile = TileMode.None, Rect? targetArea = null, Stretch stretch = Stretch.Fill, Rectangle rect = null, UriKind kind = UriKind.Relative)
		{
			BitmapImage bm = new BitmapImage(new Uri(path, kind));
			UIElement el = null;
			if (tile != TileMode.None && rect == null)
			{
				Rectangle r = new Rectangle();
				if (targetArea.HasValue)
				{
					r.Width = targetArea.Value.Width;
					r.Height = targetArea.Value.Height;
				}
				else
				{
					r.Width = this.ActualWidth;
					r.Height = this.ActualHeight;
				}
				Rect rr = new Rect();
				rr.Width = bm.PixelWidth;
				rr.Height = bm.PixelHeight;
				ImageDrawing d = new ImageDrawing(bm, rr);
				DrawingBrush brush = new DrawingBrush(d);
				brush.Viewport = rr;
				brush.ViewportUnits = BrushMappingMode.Absolute;
				brush.TileMode = tile;
				brush.Stretch = Stretch.Fill;
				r.Fill = brush;
				el = r;
			}
			else
			{
				Image img = new Image();
				img.Width = bm.Width;
				img.Height = bm.Height;
				img.Source = bm;
				el = img;
			}
			RenderCanvas.Children.Add(el);
			if (targetArea.HasValue)
			{
				Canvas.SetLeft(el, targetArea.Value.X);
				Canvas.SetTop(el, targetArea.Value.Y);
			}
			else
			{
				Canvas.SetLeft(el, 0);
				Canvas.SetTop(el, 0);
			}
		}
Exemple #27
0
    public NodeUri(string uriString, UriKind uriKind) : base(uriString, uriKind)
    {
      if (IsAbsoluteUri)
      {
        if (Segments.Length == 0)
        {
          throw new UriFormatException("Node URI format invalid");
        }

        if (!UriScheme.Equals(Scheme, StringComparison.InvariantCultureIgnoreCase))
        {
          throw new UriFormatException("Node URI scheme invalid");
        }
      }
    }
Exemple #28
0
 public bool IsValidUri(string uri, UriKind allowedUriKind)
 {
     if (string.IsNullOrWhiteSpace(uri))
     {
         return true;
     }
     Uri checkedUri;
     if (!Uri.TryCreate(uri, allowedUriKind, out checkedUri))
     {
         return false;
     }
     if (checkedUri.IsAbsoluteUri)
     {
         IEnumerable<string> validSchemes = new[] { "http", "https" };
         return validSchemes.Any(s => s == checkedUri.Scheme);
     }
     return true;
 }
        public static void SetupESRI.ArcGIS.Mapping.Controls.ArcGISOnline(string configFilePath, UriKind configFilePathUriKind)
        {
            Uri uri = new Uri(configFilePath, configFilePathUriKind);
            ESRI.ArcGIS.Mapping.Controls.ArcGISOnline.WebUtil.OpenReadAsync(uri, null, (sender2, e2) =>
            {
                XDocument xml = XDocument.Load(e2.Result);

                var v = (from next in xml.Descendants("ArcGISOnline")
                         select new
                         {
                             Url = next.Element("Url").Value,
                             UrlSecure = next.Element("UrlSecure").Value
                         }).SingleOrDefault();
                ESRI.ArcGIS.Mapping.Controls.ArcGISOnline.ArcGISOnlineEnvironment.ArcGISOnline.Initialize(v.Url, v.UrlSecure);
                ESRI.ArcGIS.Mapping.Controls.ArcGISOnline.ArcGISOnlineEnvironment.ArcGISOnline.User.SignedInOut += User_SignedInOut;
                ESRI.ArcGIS.Mapping.Controls.ArcGISOnline.BasemapSupport.GetBasemaps(null);
            });
        }
Exemple #30
0
        /// <summary>
        /// Create a Uri as entry or feed id
        /// </summary>
        /// <param name="value">Uri value</param>
        /// <param name="kind">UriKind</param>
        /// <param name="swallowEmpty">if swallowEmpty is true, an empty value will be parsed as null Uri, otherwise invalid Uri format exception will throw. </param>
        /// <returns>Created Uri from value</returns>
        internal static Uri CreateUriAsEntryOrFeedId(string value, UriKind kind, bool swallowEmpty = true)
        {
            if (swallowEmpty && value == string.Empty || value == null)
            {
                return null;
            }

            Uri uri;
            try
            {
                uri = new Uri(value, kind);
            }
            catch (FormatException)
            {
                throw new ODataException(Strings.ODataUriUtils_InvalidUriFormatForEntryIdOrFeedId(value));
            }

            return uri;
        }
Exemple #31
0
 //
 // All public ctors go through here
 //
 private void CreateThis(string?uri, bool dontEscape, UriKind uriKind, in UriCreationOptions creationOptions = default)
 public DerivedUri(string uri, UriKind kind) : base(uri, kind)
 {
 }
Exemple #33
0
 public UriCombine(string uriString, UriKind uriKind)
     : base(uriString, uriKind)
 {
 }
Exemple #34
0
 /// <summary>
 /// Create a UriRef from this string with a given kind
 /// </summary>
 /// <returns></returns>
 public static UriRef ToUriRef(this string uriString, UriKind uriKind)
 {
     return(new UriRef(uriString, uriKind));
 }
Exemple #35
0
        public GalleryuriData(string uriString, UriKind uriKind,object ExternInfo)
        {
            _uri = new Uri(uriString,uriKind);
            _externInfo = ExternInfo;

        }
Exemple #36
0
 private ResourceIdentity(string uri, UriKind kind) : base(uri, kind)
 {
 }
Exemple #37
0
 static Uri \u202E‭‎‍‏‎‭‎‮‫‬‭‎‮‬‌‫‪‪‌‭‮‫‭‎‪‏‮([In] string obj0, [In] UriKind obj1)
 {
     return(new Uri(obj0, obj1));
 }
Exemple #38
0
        [MethodImpl(MethodImplOptions.NoInlining)] // required
        private static void CreateThisPatched(Uri thisUri, string uri, bool dontEscape, UriKind uriKind)
        {
            uri = RemoveLongPathPrefix(uri);
            mStringUriFld.Value.SetValue(thisUri, uri);
            var flagsLong = (ulong)mFlagsUriFld.Value.GetValue(thisUri);

            if (dontEscape)
            {
                flagsLong |= 0x00080000;
            }
            var flags   = Enum.Parse(mFlagsUriFld.Value.FieldType, flagsLong.ToString(CultureInfo.InvariantCulture));
            var mSyntax = mSyntaxUriFld.Value.GetValue(thisUri);

            object[] args = { uri, flags, mSyntax };
            var      err  = uriParseScheme.Value.Invoke(null, args);

            mFlagsUriFld.Value.SetValue(thisUri, args[1]);
            mSyntaxUriFld.Value.SetValue(thisUri, args[2]);

            args = new[] { err, uriKind, null };
            uriInitializeUri.Value.Invoke(thisUri, args);

            if (args[2] is UriFormatException e)
            {
                throw e;
            }
        }
Exemple #39
0
        private void InitializeUri(ParsingError err, UriKind uriKind, out UriFormatException e)
        {
            if (err == ParsingError.None)
            {
                if (IsImplicitFile)
                {
                    // V1 compat
                    // A relative Uri wins over implicit UNC path unless the UNC path is of the form "\\something" and
                    // uriKind != Absolute
                    // A relative Uri wins over implicit Unix path unless uriKind == Absolute
                    if (NotAny(Flags.DosPath) &&
                        uriKind != UriKind.Absolute &&
                        ((uriKind == UriKind.Relative || (_string.Length >= 2 && (_string[0] != '\\' || _string[1] != '\\'))) ||
                         (!IsWindowsSystem && InFact(Flags.UnixPath))))
                    {
                        _syntax = null;              //make it be relative Uri
                        _flags &= Flags.UserEscaped; // the only flag that makes sense for a relative uri
                        e       = null;
                        return;
                        // Otherwise an absolute file Uri wins when it's of the form "\\something"
                    }
                    //
                    // V1 compat issue
                    // We should support relative Uris of the form c:\bla or c:/bla
                    //
                    else if (uriKind == UriKind.Relative && InFact(Flags.DosPath))
                    {
                        _syntax = null;              //make it be relative Uri
                        _flags &= Flags.UserEscaped; // the only flag that makes sense for a relative uri
                        e       = null;
                        return;
                        // Otherwise an absolute file Uri wins when it's of the form "c:\something"
                    }
                }
            }
            else if (err > ParsingError.LastRelativeUriOkErrIndex)
            {
                //This is a fatal error based solely on scheme name parsing
                _string = null; // make it be invalid Uri
                e       = GetException(err);
                return;
            }

            bool hasUnicode = false;

            _iriParsing = (s_IriParsing && ((_syntax == null) || _syntax.InFact(UriSyntaxFlags.AllowIriParsing)));

            if (_iriParsing &&
                (CheckForUnicode(_string) || CheckForEscapedUnreserved(_string)))
            {
                _flags    |= Flags.HasUnicode;
                hasUnicode = true;
                // switch internal strings
                _originalUnicodeString = _string; // original string location changed
            }

            if (_syntax != null)
            {
                if (_syntax.IsSimple)
                {
                    if ((err = PrivateParseMinimal()) != ParsingError.None)
                    {
                        if (uriKind != UriKind.Absolute && err <= ParsingError.LastRelativeUriOkErrIndex)
                        {
                            // RFC 3986 Section 5.4.2 - http:(relativeUri) may be considered a valid relative Uri.
                            _syntax = null;              // convert to relative uri
                            e       = null;
                            _flags &= Flags.UserEscaped; // the only flag that makes sense for a relative uri
                            return;
                        }
                        else
                        {
                            e = GetException(err);
                        }
                    }
                    else if (uriKind == UriKind.Relative)
                    {
                        // Here we know that we can create an absolute Uri, but the user has requested only a relative one
                        e = GetException(ParsingError.CannotCreateRelative);
                    }
                    else
                    {
                        e = null;
                    }
                    // will return from here

                    if (_iriParsing && hasUnicode)
                    {
                        // In this scenario we need to parse the whole string
                        EnsureParseRemaining();
                    }
                }
                else
                {
                    // offer custom parser to create a parsing context
                    _syntax = _syntax.InternalOnNewUri();

                    // in case they won't call us
                    _flags |= Flags.UserDrivenParsing;

                    // Ask a registered type to validate this uri
                    _syntax.InternalValidate(this, out e);

                    if (e != null)
                    {
                        // Can we still take it as a relative Uri?
                        if (uriKind != UriKind.Absolute && err != ParsingError.None &&
                            err <= ParsingError.LastRelativeUriOkErrIndex)
                        {
                            _syntax = null;              // convert it to relative
                            e       = null;
                            _flags &= Flags.UserEscaped; // the only flag that makes sense for a relative uri
                        }
                    }
                    else // e == null
                    {
                        if (err != ParsingError.None || InFact(Flags.ErrorOrParsingRecursion))
                        {
                            // User parser took over on an invalid Uri
                            SetUserDrivenParsing();
                        }
                        else if (uriKind == UriKind.Relative)
                        {
                            // Here we know that custom parser can create an absolute Uri, but the user has requested only a
                            // relative one
                            e = GetException(ParsingError.CannotCreateRelative);
                        }

                        if (_iriParsing && hasUnicode)
                        {
                            // In this scenario we need to parse the whole string
                            EnsureParseRemaining();
                        }
                    }
                    // will return from here
                }
            }
            // If we encountered any parsing errors that indicate this may be a relative Uri,
            // and we'll allow relative Uri's, then create one.
            else if (err != ParsingError.None && uriKind != UriKind.Absolute &&
                     err <= ParsingError.LastRelativeUriOkErrIndex)
            {
                e       = null;
                _flags &= (Flags.UserEscaped | Flags.HasUnicode); // the only flags that makes sense for a relative uri
                if (_iriParsing && hasUnicode)
                {
                    // Iri'ze and then normalize relative uris
                    _string = EscapeUnescapeIri(_originalUnicodeString, 0, _originalUnicodeString.Length,
                                                (UriComponents)0);
                }
            }
            else
            {
                _string = null; // make it be invalid Uri
                e       = GetException(err);
            }
        }
Exemple #40
0
        /// <summary>
        /// Creates an emissive image material.
        /// </summary>
        /// <param name="uri">The uri of the image.</param>
        /// <param name="diffuseBrush">The diffuse brush.</param>
        /// <param name="uriKind">Kind of the <paramref name="uri" />.</param>
        /// <param name="freeze">Freeze the material if set to <c>true</c>.</param>
        /// <returns>The image material.</returns>
        public static Material CreateEmissiveImageMaterial(string uri, Brush diffuseBrush, UriKind uriKind, bool freeze = true)
        {
            var image = GetImage(uri, uriKind);

            if (image == null)
            {
                return(null);
            }

            return(CreateEmissiveImageMaterial(image, diffuseBrush, freeze: freeze));
        }
Exemple #41
0
        private static Uri ParseUri(string s)
        {
            UriKind uriKind = (s.StartsWith("http") || s.StartsWith("https")) ? UriKind.Absolute : UriKind.Relative;

            return(new Uri(s, uriKind));
        }
Exemple #42
0
 public XmlUriData(string uriString, UriKind uriKind, XmlQualifiedName elementQualifiedName)
 {
     UriString            = uriString;
     UriKind              = uriKind;
     ElementQualifiedName = elementQualifiedName;
 }
 public static Uri TryParseUri(this string str, UriKind uriKind = UriKind.RelativeOrAbsolute)
 {
     return(Uri.TryCreate(str, uriKind, out Uri value)
                         ? value
                         : null);
 }
Exemple #44
0
#pragma warning restore CS0618 // Type or member is obsolete

        public ConvertUri(string uriString, UriKind uriKind) : base(uriString, uriKind)
        {
        }
Exemple #45
0
 public Uri ResolveUri(UriKind uriKind, IDictionary <string, object> variables)
 {
     return(new Uri(Resolve(variables), uriKind));
 }
Exemple #46
0
 /// <summary>
 /// Same as "new Uri" except that it can handle UNIX style paths that start with '/'
 /// </summary>
 public static Uri CreateSourceUri(string source, UriKind kind = UriKind.Absolute)
 {
     source = FixSourceUri(source);
     return(new Uri(source, kind));
 }
Exemple #47
0
 /// <summary>new Uri(string uriString, UriKind uriKind)</summary>
 /// <param name="value">value</param>
 /// <param name="kind">kind</param>
 /// <returns>new Uri(value, kind)</returns>
 internal static Uri CreateUri(string value, UriKind kind)
 {
     return(value == null ? null : new Uri(value, kind));
 }
Exemple #48
0
 static Uri \u202D‍‍​‭‍‍‎‌‏‪​‬‫‮‌‏‭‫‌‭‪‎‌‎‍‏‭‮([In] string obj0, [In] UriKind obj1)
 {
     return(new Uri(obj0, obj1));
 }
Exemple #49
0
 /// <summary>
 /// Creates an UriRef from a string with a given UriKind.
 /// </summary>
 /// <param name="uriString"></param>
 /// <param name="uriKind"></param>
 public UriRef(string uriString, UriKind uriKind) : base(uriString, uriKind)
 {
 }
Exemple #50
0
 public void IsWellFormedUriString(string uriString, UriKind uriKind, bool expected)
 {
     Assert.Equal(expected, Uri.IsWellFormedUriString(uriString, uriKind));
 }
        /// <summary>
        /// The <see cref="UriKind"/> to use when converting.
        /// This is used when doing <see cref="Uri"/> conversions.
        /// </summary>
        /// <param name="uriKind">Kind of the URI.</param>
        public virtual ParameterMap UriKind(UriKind uriKind)
        {
            parameterMap.Data.TypeConverterOptions.UriKind = uriKind;

            return(parameterMap);
        }
 public void SetBackgroundVideo(string path, UriKind uriKind = UriKind.Relative)
 {
     mediaelement.Source = new Uri(path, uriKind);
     mediaelement.Play();
 }
Exemple #53
0
 private UriHeaderParser(UriKind uriKind)
     : base(false)
 {
     _uriKind = uriKind;
 }
 public void TryParse_should_return_true_for_valid_input(string uri, UriKind kind)
 {
     UriParser.TryParse(uri, out var res).Should().BeTrue();
     res.Should().BeEquivalentTo(new Uri(uri, kind));
 }
Exemple #55
0
 internal void Add(ThemeType type, string source, UriKind kind)
 {
     Add(type, new ResourceDictionary {
         Source = new Uri(source, kind)
     });
 }
Exemple #56
0
 public MonoUri(string uriString, UriKind uriKind)
     : base(uriString, uriKind)
 {
 }
Exemple #57
0
 /// <summary>
 /// A new hyperlink with the specified URI and kind
 /// </summary>
 /// <param name="uriString">The URI</param>
 /// <param name="uriKind">Kind (absolute/relative or indeterminate)</param>
 public ExcelHyperLink(string uriString, UriKind uriKind) :
     base(uriString, uriKind)
 {
     OriginalUri = (Uri)this;
 }
Exemple #58
0
 public Href(string uriString, UriKind uriKind)
 {
     _value = new Uri(uriString, uriKind);
 }
Exemple #59
0
 public UriPlus(string uriString, UriKind uriKind)
     : base(uriString, uriKind)
 {
 }
        internal RequestBuilder(IRequestObserver observer, HttpClient client, string path, UriKind kind = UriKind.Relative)
        {
            Observer = observer;
            _client  = client;

            var uri = new Uri(path, kind);

            if (!uri.IsAbsoluteUri)
            {
                uri = new Uri(client.BaseAddress, uri);
            }

            _keyValue = HttpUtility.ParseQueryString(uri.Query);
            _uri      = new Uri(uri.GetLeftPart(UriPartial.Path));

            Message = new HttpRequestMessage();
        }