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


C# System.Uri类代码示例

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


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

示例1: CSBuildProject

        public CSBuildProject(
            string moduleName,
            string projectPathName,
            Bam.Core.PackageIdentifier packageId,
            Bam.Core.ProxyModulePath proxyPath)
        {
            this.ProjectName = moduleName;
            this.PathName = projectPathName;
            this.PackageDirectory = packageId.Location;
            if (null != proxyPath)
            {
                this.PackageDirectory = proxyPath.Combine(packageId.Location);
            }

            var packagePath = this.PackageDirectory.GetLocations()[0].AbsolutePath;

            var isPackageDirAbsolute = Bam.Core.RelativePathUtilities.IsPathAbsolute(packagePath);
            var kind = isPackageDirAbsolute ? System.UriKind.Absolute : System.UriKind.Relative;

            if (packagePath[packagePath.Length - 1] == System.IO.Path.DirectorySeparatorChar)
            {
                this.PackageUri = new System.Uri(packagePath, kind);
            }
            else
            {
                this.PackageUri = new System.Uri(packagePath + System.IO.Path.DirectorySeparatorChar, kind);
            }

            this.ProjectGuid = new DeterministicGuid(this.PathName).Guid;
        }
开发者ID:markfinal,项目名称:bam-csharp,代码行数:30,代码来源:CSBuildProject.cs

示例2: DebugTest2

        static void DebugTest2()
        {
            string path1 = "/Users/Elyn/Projects/UnityPlugins/Unity Sandbox Project/Assets/Modules/GameCenter/Editor/iOS/GameCenterManager.m";
            string path2 = "/Users/Elyn/Projects/UnityPlugins/Unity Sandbox Project/XCode/.";

            System.Uri fileURI = new System.Uri( path1 );
            System.Uri rootURI = new System.Uri( path2 );
            Debug.Log( fileURI.MakeRelativeUri( rootURI ).ToString() );
            Debug.Log( rootURI.MakeRelativeUri( fileURI ).ToString() );

            //			string projectPath = Path.Combine( Directory.GetParent( Application.dataPath ).ToString(), "XCode" );

            //			string[] files = System.IO.Directory.GetFiles( projectPath, "Info.plist" );
            //			string contents = System.IO.File.OpenText( files[0] ).ReadToEnd();

            //			string[] projects = System.IO.Directory.GetDirectories( projectPath, "*.xcodeproj" );
            //			string projPath = System.IO.Path.Combine( projects[0], "project.pbxproj" );
            //			string contents = System.IO.File.OpenText( projPath ).ReadToEnd();
            //			Debug.Log( System.IO.File.OpenText( projPath ).ReadToEnd );

            //			PBXParser parser = new PBXParser();
            //			Hashtable test = (Hashtable)parser.Decode( contents );
            //			PBXDictionary test = parser.Decode( contents );
            //			Debug.Log( MiniJSON.jsonEncode( test ) );
            //			Debug.Log( test + " - " + test.Count );
            //			Debug.Log( parser.Encode( test ) );
        }
开发者ID:darktable,项目名称:XCodeEditor-for-Unity,代码行数:27,代码来源:XCodeEditorMenu.cs

示例3: getRelativePathTo

 public static string getRelativePathTo(this string path, string basePath)
 {
     System.Uri uri1 = new System.Uri(path);
     System.Uri uri2 = new System.Uri(basePath);
     System.Uri relativeUri = uri2.MakeRelativeUri(uri1);
     return relativeUri.ToString();
 }
开发者ID:polycular,项目名称:oekogotschi,代码行数:7,代码来源:PathExtensions.cs

示例4: IsPathAbsolute

 IsPathAbsolute(
     string path)
 {
     var pathUri = new System.Uri(path, System.UriKind.RelativeOrAbsolute);
     var isAbsolute = pathUri.IsAbsoluteUri;
     return isAbsolute;
 }
开发者ID:knocte,项目名称:BuildAMation,代码行数:7,代码来源:RelativePathUtilities.cs

示例5: HandleOpenURL

		public override bool HandleOpenURL(UIApplication application, NSUrl url)
		{
			if (url == null)
				return false;
			var uri = new System.Uri(url.ToString());

//			if (Slideout != null)
//			{
//				if (!string.IsNullOrEmpty(uri.Host))
//				{
//					string username = uri.Host;
//					string repo = null;
//
//					if (uri.Segments.Length > 1)
//						repo = uri.Segments[1].Replace("/", "");
//
//					if (repo == null)
//						Slideout.SelectView(new CodeBucket.ViewControllers.ProfileViewController(username));
//					else
//						Slideout.SelectView(new CodeBucket.ViewControllers.RepositoryInfoViewController(username, repo, repo));
//				}
//			}

			return true;
		}
开发者ID:jsuo,项目名称:CodeBucket,代码行数:25,代码来源:AppDelegate.cs

示例6: Write

        public static void Write(HttpContext context, string file)
        {
            var md = new MarkdownSharp.Markdown();
            context.Response.ContentType = "text/html";

            // < html xmlns = ""http://www.w3.org/1999/xhtml"">
            context.Response.Output.Write(@"<!DOCTYPE html>
            <html>
            <head>
            <meta http-equiv=""X-UA-Compatible"" content=""IE=edge,chrome=1"" />
            <meta charset=""utf-8"">
            <meta http-equiv=""Content-Type"" content=""text/html; charset=utf-8"" />
            <title>");

            context.Response.Output.Write(System.IO.Path.GetFileNameWithoutExtension(file));

            context.Response.Output.Write(@"</title>
            <meta http-equiv=""cache-control"" content=""max-age=0"" />
            <meta http-equiv=""cache-control"" content=""no-cache"" />
            <meta http-equiv=""expires"" content=""0"" />
            <meta http-equiv=""expires"" content=""Tue, 01 Jan 1980 1:00:00 GMT"" />
            <meta http-equiv=""pragma"" content=""no-cache"" />

            <base href =""/ajax/Resource.ashx/");
            context.Response.Output.Write(System.Web.HttpUtility.UrlPathEncode(
            Base64Encode(System.IO.Path.GetDirectoryName(file))
             ));
            context.Response.Output.Write(@"/"" />
            <link rel=""canonical"" href=""");

            string str = new System.Uri(file).AbsoluteUri;
            context.Response.Output.Write(str);

            context.Response.Output.Write(@""" />");

            context.Response.Output.Write("<style type=\"text/css\">");

            // http://stackoverflow.com/questions/6784799/what-is-this-char-65279
            // It's a zero-width no-break space. It's more commonly used as a byte-order mark (BOM).
            // context.Response.WriteFile(System.Web.Hosting.HostingEnvironment.MapPath("~/style.css"));
            // http://www.fileformat.info/info/unicode/char/feff/index.htm
            // \32\32\32\32\32\32\32\32\32\32\32\32\32\32\32\32\64\102\111\110\116\45\102\97\99\101\32\123
            // \32\32\32\32\32\32\32\32\32\32\32\32\32\32\32\32\65279\64\102\111\110\116\45\102\97\99\101\32\123

            context.Response.Output.Write(
                System.IO.File.ReadAllText(System.Web.Hosting.HostingEnvironment.MapPath("~/style.css"), System.Text.Encoding.UTF8)
            );
            context.Response.Output.Write("</style>");

            context.Response.Output.Write(@"
            <link type=""text/css"" rel=""stylesheet"" href=""Content/style.css"" />
            <script type=""text/javascript"" src=""./Scripts/libs/jquery.js""></script>
            </head>
            <body>
            ");

            context.Response.Output.Write(md.Transform(System.IO.File.ReadAllText(file)));
            context.Response.Output.Write(@"</body></html>");
        }
开发者ID:ststeiger,项目名称:Svg3Dtest,代码行数:59,代码来源:MarkDownWriter.cs

示例7: DefaultUrlService

        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="baseUri">The base Uri of all services.</param>
        /// <param name="servicePrefix">If we need a prefix to be appended to the base Uri.</param>
        public DefaultUrlService(System.Uri baseUri, string servicePrefix)
        {
            if(baseUri == null)
                throw new System.ArgumentNullException("baseUri");

            _baseUri = baseUri;
            ServicePrefix = servicePrefix;
        }
开发者ID:KCL5South,项目名称:WhippedCream,代码行数:13,代码来源:DefaultUrlService.cs

示例8: OnStartup

 protected override void OnStartup(StartupEventArgs e)
 {
     if (e.Args.Any())
     {
         Properties["ArbitraryArgName"] = new System.Uri(e.Args[0]);
     }
     base.OnStartup(e);
 }
开发者ID:domaspaukstys,项目名称:ChordsKaraoke,代码行数:8,代码来源:App.xaml.cs

示例9: testWebRequestGet

 public void testWebRequestGet()
 {
     var uri = new Uri("http://www.google.com");
     using(var stream  = WebInvoke( uri, Verb.Get, null,true))
     {
         AssertTrue(stream.Length > 100);
     }
 }
开发者ID:Xtremrules,项目名称:dot42,代码行数:8,代码来源:TestHttpWebRequest.cs

示例10: Constructor_BaseUrlReturnsCorrectValue

        public void Constructor_BaseUrlReturnsCorrectValue()
        {
            System.Uri baseUri = new System.Uri("http://www.google.com");
            IUrlService service = new DefaultUrlService(baseUri, null);

            Assert.AreEqual(baseUri.ToString(), service.BaseUrl, @"
            The BaseUrl property should return the value of the uri that was passed to the constructor.
            ");
        }
开发者ID:KCL5South,项目名称:WhippedCream,代码行数:9,代码来源:DefaultUrlServiceTests.cs

示例11: GetWebResponse

 protected override System.Net.WebResponse GetWebResponse(System.Net.WebRequest request)
 {
     System.Net.WebResponse response = base.GetWebResponse(request);
     if (response != null)
     {
         _responseUri = response.ResponseUri;
     }
     return response;
 }
开发者ID:RyanFu,项目名称:A51C1B616A294D4BBD6D3D46FD7F78A7,代码行数:9,代码来源:ResponseUriClient.cs

示例12: PhotoVersion

		public PhotoVersion (Photo photo, uint version_id, System.Uri uri, string md5_sum, string name, bool is_protected)
		{
			this.photo = photo;
			this.version_id = version_id;
			this.uri = uri;
			this.md5_sum = md5_sum;
			this.name = name;
			this.is_protected = is_protected;
		}
开发者ID:guadalinex-archive,项目名称:guadalinex-v6,代码行数:9,代码来源:PhotoVersion.cs

示例13: GetServiceUri_PathNoPreceedingSlash

        public void GetServiceUri_PathNoPreceedingSlash()
        {
            System.Uri baseUri = new System.Uri("https://www.cnn.gov");
            IUrlService service = new DefaultUrlService(baseUri, "api");

            Assert.AreEqual(new System.Uri("https://www.cnn.gov/api/RelativeServicePath/PathAgain"), service.GetServiceUri("RelativeServicePath/PathAgain"), @"
            The GetServiceUri should take in a path and append the service prefix to the base url, then append
            the path to the result of that.
            ");
        }
开发者ID:KCL5South,项目名称:WhippedCream,代码行数:10,代码来源:DefaultUrlServiceTests.cs

示例14: DnnUnitTest

        public DnnUnitTest()
        {
            var uri = new System.Uri(Assembly.GetExecutingAssembly().CodeBase);
            string path = HttpUtility.UrlDecode(Path.GetFullPath(uri.AbsolutePath));

            WebsiteAppPath = "http://localhost/DNN_Platform";
            var websiteRootPath = path.Substring(0, path.IndexOf("DNN Platform", System.StringComparison.Ordinal));
            WebsitePhysicalAppPath = Path.Combine(websiteRootPath, "Website");
            HighlightDataPath = Path.Combine(websiteRootPath, "DNN Platform//Modules//PreviewProfileManagement//Resources//highlightDevices.xml");
        }
开发者ID:rjallepalli,项目名称:PIX_CMS,代码行数:10,代码来源:DnnUnitTest.cs

示例15: GetServiceUri_PathNull

        public void GetServiceUri_PathNull()
        {
            System.Uri baseUri = new System.Uri("https://www.cnn.gov");
            IUrlService service = new DefaultUrlService(baseUri, "api");

            Assert.AreEqual(new System.Uri("https://www.cnn.gov/api"), service.GetServiceUri(null), @"
            The GetServiceUri should take in a path and append the service prefix to the base url, then append
            the path to the result of that.

            If we pass null in for the path, then it should be ignored.
            ");
        }
开发者ID:KCL5South,项目名称:WhippedCream,代码行数:12,代码来源:DefaultUrlServiceTests.cs


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