DownloadUriIntoDataUri() public static method

Downloads and converts a remote resource URI into a data URI in the form data:<MimeType>;base64,<ImageData>, where <MimeType> is the MIME type of the specified resource, and <ImageData> is the data encoded as a Base 64 string.
public static DownloadUriIntoDataUri ( string uri ) : string
uri string The URI of the resource to convert.
return string
コード例 #1
0
        /// <summary>
        /// Resolves a URI, producing a new URI for inclusion in a CZML document.
        /// </summary>
        /// <param name="uri">The source URI.</param>
        /// <returns>A URI suitable for CZML.</returns>
        public string ResolveUri(string uri)
        {
            if (uri == null)
            {
                throw new ArgumentNullException("uri");
            }

            LinkedListNode <CacheItem> node;

            if (m_dictionary.TryGetValue(uri, out node))
            {
                if (m_lruList.First != node)
                {
                    //move to front
                    m_lruList.Remove(node);
                    m_lruList.AddFirst(node);
                }
                return(node.Value.ResolvedUri);
            }

            //load image into data URI
            string resolvedUri = CesiumFormattingHelper.DownloadUriIntoDataUri(uri);

            AddUri(uri, resolvedUri);
            return(resolvedUri);
        }
コード例 #2
0
        /// <summary>
        /// Resolves a URI, producing a new URI for inclusion in a CZML document.
        /// </summary>
        /// <param name="uri">The source URI.</param>
        /// <returns>A URI suitable for CZML.</returns>
        public Uri ResolveUri(Uri uri)
        {
            LinkedListNode <CacheItem> node;

            if (m_dictionary.TryGetValue(uri, out node))
            {
                if (m_lruList.First != node)
                {
                    //move to front
                    m_lruList.Remove(node);
                    m_lruList.AddFirst(node);
                }
                return(node.Value.ResolvedUri);
            }

            //load image into data URI
            Uri resolvedUri = CesiumFormattingHelper.DownloadUriIntoDataUri(uri);

            AddUri(uri, resolvedUri);
            return(resolvedUri);
        }