Example #1
0
 // Token: 0x060044E1 RID: 17633 RVA: 0x00138574 File Offset: 0x00136774
 private static void ValidateUri(Uri item)
 {
     if (item == null)
     {
         throw new ArgumentException(SR.Get("CustomDictionaryNullItem"));
     }
     if (item.IsAbsoluteUri && !item.IsUnc && !item.IsFile && !PackUriHelper.IsPackUri(item))
     {
         throw new NotSupportedException(SR.Get("CustomDictionarySourcesUnsupportedURI"));
     }
 }
Example #2
0
        private void DoNavigate(Uri source, ref object targetFrameName, ref object postData, ref object headers, bool ignoreEscaping = false)
        {
            base.VerifyAccess();
            NativeMethods.IOleCommandTarget oleCommandTarget = (NativeMethods.IOleCommandTarget) this.AxIWebBrowser2;
            object obj = false;

            oleCommandTarget.Exec(null, 23, 0, new object[]
            {
                obj
            }, 0);
            this.LastNavigation = Guid.NewGuid();
            if (source == null)
            {
                this.NavigatingToAboutBlank = true;
                source = new Uri("about:blank");
            }
            else
            {
                this.CleanInternalState();
            }
            if (!source.IsAbsoluteUri)
            {
                throw new ArgumentException(SR.Get("AbsoluteUriOnly"), "source");
            }
            if (PackUriHelper.IsPackUri(source))
            {
                source = BaseUriHelper.ConvertPackUriToAbsoluteExternallyVisibleUri(source);
            }
            if (!string.IsNullOrEmpty((string)targetFrameName))
            {
                new WebPermission(PermissionState.Unrestricted).Demand();
            }
            else if (!this.NavigatingToAboutBlank)
            {
                SecurityHelper.DemandWebPermission(source);
            }
            object obj2 = null;
            object obj3 = ignoreEscaping ? source.AbsoluteUri : BindUriHelper.UriToString(source);

            try
            {
                this.AxIWebBrowser2.Navigate2(ref obj3, ref obj2, ref targetFrameName, ref postData, ref headers);
            }
            catch (COMException ex)
            {
                this.CleanInternalState();
                if (ex.ErrorCode != -2147023673)
                {
                    throw;
                }
            }
        }
Example #3
0
        /// <summary>
        /// This method is invoked whenever the source property changes.
        /// </summary>
        private void UriSourcePropertyChangedHook(DependencyPropertyChangedEventArgs e)
        {
            // Decided against comparing the URI because the user might want to change the shader on the filesystem
            // and reload it.

            // We do not support async loading of shaders here. If that is desired the user needs to use the SetStreamSource
            // API.

            Uri    newUri = (Uri)e.NewValue;
            Stream stream = null;

            try {
                if (newUri != null)
                {
                    if (!newUri.IsAbsoluteUri)
                    {
                        newUri = BaseUriHelper.GetResolvedUri(BaseUriHelper.BaseUri, newUri);
                    }

                    Debug.Assert(newUri.IsAbsoluteUri);

                    // Now the URI is an absolute URI.

                    //
                    // Only allow file and pack URIs.
                    if (!newUri.IsFile &&
                        !PackUriHelper.IsPackUri(newUri))
                    {
                        throw new ArgumentException(SR.Get(SRID.Effect_SourceUriMustBeFileOrPack));
                    }

                    stream = WpfWebRequestHelper.CreateRequestAndGetResponseStream(newUri);
                }

                LoadPixelShaderFromStreamIntoMemory(stream);
            }
            finally
            {
                if (stream != null)
                {
                    stream.Dispose();
                }
            }
        }