상속: System.EventArgs
예제 #1
0
        public Stream Load(string url)
        {
            if (url == null)
                throw new ArgumentNullException("url");

            // Take out the path part.

            var e = new HelpResolveEventArgs(url);
            OnResolve(e);
            if (e.Stream != null)
                return e.Stream;

            // Extract the root.

            string root = null;
            string path = url.TrimStart('/');
            int index = path.IndexOf('/');

            if (index != -1)
            {
                root = path.Substring(0, index);
                path = path.Substring(index + 1);
            }

            // Find the registration for this root.

            foreach (var registration in Registrations)
            {
                if (String.Equals(registration.Root, root, StringComparison.OrdinalIgnoreCase))
                    return Load(registration, path);
            }

            return null;
        }
예제 #2
0
        protected virtual void OnResolve(HelpResolveEventArgs e)
        {
            var ev = Resolve;

            if (ev != null)
            {
                ev(this, e);
            }
        }
예제 #3
0
        public Stream Load(string url)
        {
            if (url == null)
            {
                throw new ArgumentNullException("url");
            }

            // Take out the path part.

            var e = new HelpResolveEventArgs(url);

            OnResolve(e);
            if (e.Stream != null)
            {
                return(e.Stream);
            }

            // Extract the root.

            string root  = null;
            string path  = url.TrimStart('/');
            int    index = path.IndexOf('/');

            if (index != -1)
            {
                root = path.Substring(0, index);
                path = path.Substring(index + 1);
            }

            // Find the registration for this root.

            foreach (var registration in Registrations)
            {
                if (String.Equals(registration.Root, root, StringComparison.OrdinalIgnoreCase))
                {
                    return(Load(registration, path));
                }
            }

            return(null);
        }
예제 #4
0
 protected virtual void OnResolve(HelpResolveEventArgs e)
 {
     var ev = Resolve;
     if (ev != null)
         ev(this, e);
 }
예제 #5
0
파일: NiHelp.cs 프로젝트: netide/netide
        void Manager_Resolve(object sender, HelpResolveEventArgs e)
        {
            string path = e.Url;
            int index = path.IndexOf('?');
            if (index != -1)
                path = path.Substring(0, index);

            byte[] bytes;
            if (Resources.TryGetValue(path, out bytes))
                e.Stream = new MemoryStream(bytes);
            else if (path == "/find")
                e.Stream = PerformFind(e.Url);
            else if (path == "/")
                e.Stream = PerformRoot();
        }