当前位置: 首页>>代码示例>>C#>>正文


C# System.UrlInfo类代码示例

本文整理汇总了C#中System.UrlInfo的典型用法代码示例。如果您正苦于以下问题:C# UrlInfo类的具体用法?C# UrlInfo怎么用?C# UrlInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


UrlInfo类属于System命名空间,在下文中一共展示了UrlInfo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SetUp

		public void SetUp()
		{
			Layout = null;
			PropertyBag = new Hashtable(StringComparer.InvariantCultureIgnoreCase);
			Helpers = new HelperDictionary();
			var services = new StubMonoRailServices 
			{ 
				UrlBuilder = new DefaultUrlBuilder(new StubServerUtility(), new StubRoutingEngine()), 
				UrlTokenizer = new DefaultUrlTokenizer()
			};
			var urlInfo = new UrlInfo(
				"example.org", "test", "/TestBrail", "http", 80,
				"http://test.example.org/test_area/test_controller/test_action.tdd",
				Area, ControllerName, Action, "tdd", "no.idea");
			StubEngineContext = new StubEngineContext(new StubRequest(), new StubResponse(), services,
													  urlInfo);
			StubEngineContext.AddService<IUrlBuilder>(services.UrlBuilder);
			StubEngineContext.AddService<IUrlTokenizer>(services.UrlTokenizer);

			ViewComponentFactory = new DefaultViewComponentFactory();
			ViewComponentFactory.Service(StubEngineContext);
			ViewComponentFactory.Initialize();

			StubEngineContext.AddService<IViewComponentFactory>(ViewComponentFactory);
			ControllerContext = new ControllerContext
			{
				Helpers = Helpers, 
				PropertyBag = PropertyBag
			};
			StubEngineContext.CurrentControllerContext = ControllerContext;


			Helpers["formhelper"] = Helpers["form"] = new FormHelper(StubEngineContext);
			Helpers["urlhelper"] = Helpers["url"] = new UrlHelper(StubEngineContext);
			Helpers["dicthelper"] = Helpers["dict"] = new DictHelper(StubEngineContext);
			Helpers["DateFormatHelper"] = Helpers["DateFormat"] = new DateFormatHelper(StubEngineContext);

			var viewPath = Path.Combine(viewSourcePath, "Views");

			var loader = new FileAssemblyViewSourceLoader(viewPath);
			loader.AddAssemblySource(
				new AssemblySourceInfo(Assembly.GetExecutingAssembly().FullName,
									   "Castle.MonoRail.Views.Brail.Tests.ResourcedViews"));

			BooViewEngine = new BooViewEngine
			{
				Options = new BooViewEngineOptions
				{
					SaveDirectory = Environment.CurrentDirectory,
					SaveToDisk = false,
					Debug = true,
					BatchCompile = false
				}
			};

			BooViewEngine.SetViewSourceLoader(loader);
			BooViewEngine.Initialize();

			BeforEachTest();
		}
开发者ID:smoothdeveloper,项目名称:Castle.MonoRail,代码行数:60,代码来源:BaseViewOnlyTestFixture.cs

示例2: MockRailsEngineContext

		/// <summary>
		/// Initializes a new instance of the <see cref="MockRailsEngineContext"/> class.
		/// </summary>
		/// <param name="request">The request.</param>
		/// <param name="response">The response.</param>
		/// <param name="trace">The trace.</param>
		/// <param name="urlInfo">The URL info.</param>
		public MockRailsEngineContext(IRequest request, IResponse response, ITrace trace, UrlInfo urlInfo) : this()
		{
			this.request = request;
			this.response = response;
			this.trace = trace;
			this.urlInfo = urlInfo; 
		}
开发者ID:nats,项目名称:castle-1.0.3-mono,代码行数:14,代码来源:MockRailsEngineContext.cs

示例3: OverridingArea

		public void OverridingArea()
		{
			var url = new UrlInfo("", "controller", "action", "", ".castle");

			Assert.AreEqual("/admin/cars/new.castle",
							urlBuilder.BuildUrl(url, DictHelper.Create("area=admin", "controller=cars", "action=new")));
		}
开发者ID:smoothdeveloper,项目名称:Castle.MonoRail,代码行数:7,代码来源:DefaultUrlBuilderTestCase.cs

示例4: UsesMoreThanASingleLevelAppPath

		public void UsesMoreThanASingleLevelAppPath()
		{
			var url = new UrlInfo("", "controller", "action", "/app/some", ".castle");

			Assert.AreEqual("/app/some/controller/new.castle",
							urlBuilder.BuildUrl(url, DictHelper.Create("action=new")));
		}
开发者ID:smoothdeveloper,项目名称:Castle.MonoRail,代码行数:7,代码来源:DefaultUrlBuilderTestCase.cs

示例5: SetUp

		public void SetUp()
		{
			string siteRoot = GetSiteRoot();
			string viewPath = Path.Combine(siteRoot, "RenderingTests\\Views");
			Layout = null;
			PropertyBag = new Hashtable(StringComparer.InvariantCultureIgnoreCase);
			Helpers = new HelperDictionary();
			StubMonoRailServices services = new StubMonoRailServices();
			services.UrlBuilder = new DefaultUrlBuilder(new StubServerUtility(), new StubRoutingEngine());
			services.UrlTokenizer = new DefaultUrlTokenizer();
			UrlInfo urlInfo = new UrlInfo(
				"example.org", "test", "/TestBrail", "http", 80,
				"http://test.example.org/test_area/test_controller/test_action.tdd",
				Area, ControllerName, Action, "tdd", "no.idea");
			StubEngineContext = new StubEngineContext(new StubRequest(), new StubResponse(), services,
													  urlInfo);
			StubEngineContext.AddService<IUrlBuilder>(services.UrlBuilder);
			StubEngineContext.AddService<IUrlTokenizer>(services.UrlTokenizer);
			StubEngineContext.AddService<IViewComponentFactory>(ViewComponentFactory);
			StubEngineContext.AddService<ILoggerFactory>(new ConsoleFactory());
			StubEngineContext.AddService<IViewSourceLoader>(new FileAssemblyViewSourceLoader(viewPath));
			

			ViewComponentFactory = new DefaultViewComponentFactory();
			ViewComponentFactory.Service(StubEngineContext);
			ViewComponentFactory.Initialize();

			ControllerContext = new ControllerContext();
			ControllerContext.Helpers = Helpers;
			ControllerContext.PropertyBag = PropertyBag;
			StubEngineContext.CurrentControllerContext = ControllerContext;


			Helpers["urlhelper"] = Helpers["url"] = new UrlHelper(StubEngineContext);
			Helpers["htmlhelper"] = Helpers["html"] = new HtmlHelper(StubEngineContext);
			Helpers["dicthelper"] = Helpers["dict"] = new DictHelper(StubEngineContext);
			Helpers["DateFormatHelper"] = Helpers["DateFormat"] = new DateFormatHelper(StubEngineContext);


			//FileAssemblyViewSourceLoader loader = new FileAssemblyViewSourceLoader(viewPath);
//			loader.AddAssemblySource(
//				new AssemblySourceInfo(Assembly.GetExecutingAssembly().FullName,
//									   "Castle.MonoRail.Views.Brail.Tests.ResourcedViews"));

			viewEngine = new AspViewEngine();
			viewEngine.Service(StubEngineContext);
			AspViewEngineOptions options = new AspViewEngineOptions();
			options.CompilerOptions.AutoRecompilation = true;
			options.CompilerOptions.KeepTemporarySourceFiles = false;
			ICompilationContext context = 
				new CompilationContext(
					new DirectoryInfo(AppDomain.CurrentDomain.BaseDirectory),
					new DirectoryInfo(siteRoot),
					new DirectoryInfo(Path.Combine(siteRoot, "RenderingTests\\Views")),
					new DirectoryInfo(siteRoot));

			List<ICompilationContext> compilationContexts = new List<ICompilationContext>();
			compilationContexts.Add(context);
			viewEngine.Initialize(compilationContexts, options);
		}
开发者ID:ralescano,项目名称:castle,代码行数:60,代码来源:IntegrationViewTestFixture.cs

示例6: InheritsControllerAndAreaWhenCreatingUrl

		public void InheritsControllerAndAreaWhenCreatingUrl()
		{
			var url = new UrlInfo("", "controller", "action", "", ".castle");

			Assert.AreEqual("/controller/new.castle",
							urlBuilder.BuildUrl(url, DictHelper.Create("action=new")));
		}
开发者ID:smoothdeveloper,项目名称:Castle.MonoRail,代码行数:7,代码来源:DefaultUrlBuilderTestCase.cs

示例7: UsesAppPath

		public void UsesAppPath()
		{
			UrlInfo url = new UrlInfo("", "controller", "action", "/app", ".castle");

			Assert.AreEqual("/app/controller/new.castle",
							urlBuilder.BuildUrl(url, DictHelper.Create("action=new")));
		}
开发者ID:candland,项目名称:Castle.MonoRail,代码行数:7,代码来源:DefaultUrlBuilderTestCase.cs

示例8: Setup

		public virtual void Setup()
		{
			response = new StubResponse();
			var url = new UrlInfo("eleutian.com", "www", virtualDirectory, "http", 80, 
				Path.Combine(Path.Combine("Area", "Controller"), "Action"), "Area", "Controller", "Action", "rails", "");
			
			var stubEngineContext = new StubEngineContext(new StubRequest(), response, new StubMonoRailServices(), url)
			{
				Server = MockRepository.GenerateMock<IServerUtility>()
			};

			railsContext = stubEngineContext;
			serverUtility = railsContext.Server;

			argumentConversionService = MockRepository.GenerateMock<IArgumentConversionService>();

			controller = new TestController();
			controller.Contextualize(railsContext, MockRepository.GenerateStub<IControllerContext>());
			
			parameters = new Hashtable();
			
			services = MockRepository.GenerateMock<ICodeGeneratorServices>();
			services.Expect(s => s.ArgumentConversionService).Return(argumentConversionService).Repeat.Any();
			services.Expect(s => s.Controller).Return(controller).Repeat.Any();
			services.Expect(s => s.RailsContext).Return(railsContext).Repeat.Any();
			argumentConversionService.Expect(s => s.CreateParameters()).Return(parameters).Repeat.Any();
		}
开发者ID:mgagne-atman,项目名称:Projects,代码行数:27,代码来源:ControllerReferenceTests.cs

示例9: BaseResponse

		/// <summary>
		/// Initializes a new instance of the <see cref="BaseResponse"/> class.
		/// </summary>
		/// <param name="currentUrl">The current URL.</param>
		/// <param name="urlBuilder">The URL builder.</param>
		/// <param name="serverUtility">The server utility.</param>
		/// <param name="routeMatch">The route match.</param>
		/// <param name="referrer">The referrer.</param>
		protected BaseResponse(UrlInfo currentUrl, IUrlBuilder urlBuilder, IServerUtility serverUtility, RouteMatch routeMatch, string referrer)
		{
			this.currentUrl = currentUrl;
			this.urlBuilder = urlBuilder;
			this.serverUtility = serverUtility;
			this.routeMatch = routeMatch;
			this.referrer = referrer;
		}
开发者ID:radiy,项目名称:MonoRail,代码行数:16,代码来源:BaseResponse.cs

示例10: AddDefaultRule

		/// <summary>
		/// Adds the default rule mapping.
		/// </summary>
		/// <remarks>
		/// A defautl rule can associate something like a 'default.castle' 
		/// to a controller/action like 'Home/index.castle'
		/// </remarks>
		/// <param name="url">The URL.</param>
		/// <param name="area">The area.</param>
		/// <param name="controller">The controller.</param>
		/// <param name="action">The action.</param>
		public void AddDefaultRule(string url, string area, string controller, string action)
		{
			if (area == null)
			{
				area = string.Empty;
			}

			defaultUrl2CustomUrlInfo[url] = new UrlInfo(area, controller, action);
		}
开发者ID:nats,项目名称:castle-1.0.3-mono,代码行数:20,代码来源:DefaultUrlTokenizer.cs

示例11: GetDate

 public static UrlSharer.UrlInfo GetDate()
 {
     UrlInfo uInfo = new UrlInfo();
     uInfo.Description = "test";
     uInfo.Title = "test";
     uInfo.Images = new List<string>();
     uInfo.Images.Add("http://google.com");
     return uInfo;
 }
开发者ID:ynrajasekhar,项目名称:RajLab,代码行数:9,代码来源:UrlSharerDemo.aspx.cs

示例12: StubEngineContext

		/// <summary>
		/// Initializes a new instance of the <see cref="StubEngineContext"/> class.
		/// </summary>
		/// <param name="request">The request.</param>
		/// <param name="response">The response.</param>
		/// <param name="services">The services.</param>
		/// <param name="urlInfo">The URL info.</param>
		public StubEngineContext(IMockRequest request, IMockResponse response, IMonoRailServices services, UrlInfo urlInfo)
		{
			this.request = request;
			this.response = response;
			this.services = services;
			this.urlInfo = urlInfo;

			if (response != null)
			{
				response.UrlInfo = urlInfo;
				response.UrlBuilder = services.UrlBuilder;
			}
		}
开发者ID:candland,项目名称:Castle.MonoRail,代码行数:20,代码来源:StubEngineContext.cs

示例13: bindShow

        private void bindShow( ContentPost post ) {
            ctx.SetItem( "ContentPost", post );
            set( "post.Title", post.Title );
            set( "post.CreateTime", post.Created );
            set( "post.ReplyCount", post.Replies );
            set( "post.Source", post.SourceLink );
            set( "post.Hits", post.Hits );

            String siteUrl = new UrlInfo( post.SourceLink ).SiteUrl;
            set( "post.Source", siteUrl );
            String val = WebHelper.GetFlash( post.SourceLink, 500, 400 );
            set( "post.Content", val );
        }
开发者ID:2014AmethystCat,项目名称:wojilu,代码行数:13,代码来源:VideoShowController.cs

示例14: MunzeeDfxAtForm

        public MunzeeDfxAtForm(Framework.Interfaces.ICore core): this()
        {
            _core = core;

            this.Text = Utils.LanguageSupport.Instance.GetTranslation(STR_TITLE);
            this.groupBox3.Text = Utils.LanguageSupport.Instance.GetTranslation(STR_MUNZEECOMACCOUNT);
            this.groupBox2.Text = Utils.LanguageSupport.Instance.GetTranslation(STR_SELECTURL);
            this.groupBox1.Text = Utils.LanguageSupport.Instance.GetTranslation(STR_ADD);
            this.label7.Text = Utils.LanguageSupport.Instance.GetTranslation(STR_NAME);
            this.label1.Text = Utils.LanguageSupport.Instance.GetTranslation(STR_URLS);
            this.button2.Text = Utils.LanguageSupport.Instance.GetTranslation(STR_ADD);
            this.button3.Text = Utils.LanguageSupport.Instance.GetTranslation(STR_REMOVE);
            this.button4.Text = Utils.LanguageSupport.Instance.GetTranslation(STR_OK);
            this.label2.Text = Utils.LanguageSupport.Instance.GetTranslation(STR_URL);
            this.label5.Text = Utils.LanguageSupport.Instance.GetTranslation(STR_COMMENT);
            this.label6.Text = Utils.LanguageSupport.Instance.GetTranslation(STR_INFO);

            textBox3.Text = Properties.Settings.Default.AccountName;

            try
            {
                _urlsFile = System.IO.Path.Combine( _core.PluginDataPath, "MunzeeDfxAt.xml" );

                if (System.IO.File.Exists(_urlsFile))
                {
                    XmlDocument doc = new XmlDocument();
                    doc.Load(_urlsFile);
                    XmlElement root = doc.DocumentElement;

                    XmlNodeList bmNodes = root.SelectNodes("url");
                    if (bmNodes != null)
                    {
                        foreach (XmlNode n in bmNodes)
                        {
                            UrlInfo bm = new UrlInfo();
                            bm.Url = n.SelectSingleNode("Url").InnerText;
                            bm.Comment = n.SelectSingleNode("Comment").InnerText;
                            _urlInfos.Add(bm);
                        }
                    }
                    listBox1.Items.AddRange(_urlInfos.ToArray());
                }
            }
            catch
            {
            }

        }
开发者ID:gahadzikwa,项目名称:GAPP,代码行数:48,代码来源:MunzeeDfxAtForm.cs

示例15: test

        public void test()
        {
            Uri uri = new Uri( "http://zhangsan:[email protected]/myapp/Photo/1984?title=eee#top" );

            UrlInfo u = new UrlInfo( uri, "/myapp/", "myPathInfo" );

            Console.WriteLine( "Scheme=>" + u.Scheme );
            Console.WriteLine( "UserName=>" + u.UserName );
            Console.WriteLine( "Password=>" + u.Password );
            Console.WriteLine( "Host=>" + u.Host );
            Console.WriteLine( "Port=>" + u.Port );
            Console.WriteLine( "Path=>" + u.Path );
            Console.WriteLine( "PathAndQuery=>" + u.PathAndQuery );
            Console.WriteLine( "PathInfo=>" + u.PathInfo );
            Console.WriteLine( "AppPath=>" + u.AppPath );

            Console.WriteLine( "PathAndQueryWithouApp=>" + u.PathAndQueryWithouApp );

            Console.WriteLine( "Query=>" + u.Query );
            Console.WriteLine( "Fragment=>" + u.Fragment );

            Console.WriteLine( "SiteUrl=>" + u.SiteUrl );
            Console.WriteLine( "SiteAndAppPath=>" + u.SiteAndAppPath );
            Console.WriteLine( "ToString=>" + u.ToString() );

            /*
            Scheme=>http
            UserName=>zhangsan
            Password=>123
            Host=>www.wojilu.net
            Port=>80
            Path=>/myapp/Photo/1984
            PathAndQuery=>/myapp/Photo/1984?title=eee
            PathInfo=>myPathInfo
            AppPath=>/myapp/
            PathAndQueryWithouApp=>/Photo/1984?title=eee
            Query=>?title=eee
            Fragment=>#top
            SiteUrl=>http://zhangsan:[email protected]
            SiteAndAppPath=>http://zhangsan:[email protected]/myapp/
            ToString=>http://zhangsan:[email protected]/myapp/Photo/1984?title=eee#top

             */
        }
开发者ID:2014AmethystCat,项目名称:wojilu,代码行数:44,代码来源:UrlInfoTest.cs


注:本文中的System.UrlInfo类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。