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


C# FullPath.ToString方法代码示例

本文整理汇总了C#中FullPath.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# FullPath.ToString方法的具体用法?C# FullPath.ToString怎么用?C# FullPath.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在FullPath的用法示例。


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

示例1: TestPaths

        public void TestPaths()
        {
            FullPath root;
            FullPath full;
            RelativePath rel;
            string str1, str2;

            string[,] cases = 
      {
          // root:        // full:          // full canonical:    // relative canonical:
        { @"C:\a/b/c/",   @"D:\a/b/",       @"D:\a\b\",           @"D:\a\b\" },
                                            
        { @"C:\a\b\c",    @"C:\a\b\c",      @"C:\a\b\c",          @"" },
        { @"C:\a\b\c",    @"C:\a\b\c\",     @"C:\a\b\c\",         @"" },
        { @"C:\a\b\c\",   @"C:\a\b\c",      @"C:\a\b\c",          @"" },
        { @"C:\a\b\c\",   @"C:\a\b\c\",     @"C:\a\b\c\",         @"" },
                                            
        { @"C:\a\b\c",    @"C:\a\b",        @"C:\a\b",            @".." },
        { @"C:\a\b\c\",   @"C:\a\b",        @"C:\a\b",            @".." },
                                            
        { @"C:\a\b\c",    @"C:\",           @"C:\",                @"..\..\.." },
        { @"C:\a\b\c\",   @"C:\",           @"C:\",                @"..\..\.." },
                                            
        { @"C:\a\b\c\",   @"C:\a\b\x\y\z",  @"C:\a\b\x\y\z",      @"..\x\y\z" },
        { @"C:\a\b\cd\",  @"C:\a\b\c",      @"C:\a\b\c",          @"..\c" },
        { @"C:\a\b\cd",   @"C:\a\b\c",      @"C:\a\b\c",          @"..\c" },
        { @"C:\a\b\cd\",  @"C:\a\b\c\d",    @"C:\a\b\c\d",          @"..\c\d" },
        { @"C:\a\b\cd",   @"C:\a\b\c\d",    @"C:\a\b\c\d",          @"..\c\d" },
      };

            for (int i = 0; i < cases.GetLength(0); i++)
            {
                root = new FullPath(cases[i, 0]);
                full = new FullPath(cases[i, 1]);
                rel = new RelativePath(root, full);

                Assert.AreEqual(full.ToString(), cases[i, 2]);

                Assert.AreEqual(rel.ToString(), cases[i, 3]);

                str1 = full;
                if (str1[str1.Length - 1] == '\\') str1 = str1.Substring(0, str1.Length - 1);

                str2 = rel.ToFullPath(root);
                if (str2[str2.Length - 1] == '\\') str2 = str2.Substring(0, str2.Length - 1);

                Assert.AreEqual(str1, str2);

                Assert.AreEqual(RelativePath.ParseCanonical(cases[i, 3]).ToString(), cases[i, 3]);
            }
        }
开发者ID:dw4dev,项目名称:Phalanger,代码行数:51,代码来源:RelativePathTests.cs

示例2: GenerateDuckInterfaces

        /// <summary>
        /// Generates duck type interfaces for given <paramref name="sourceAsts"/>.
        /// </summary>
        /// <param name="sourceAsts">Enumeration of <see cref="GlobalCode"/> - AST of source files containing PHP source code.</param>
        /// <param name="duckPath">Target path.</param>
        /// <param name="duckNamespace">Target namespace.</param>
        public static void GenerateDuckInterfaces(IEnumerable<GlobalCode>/*!!*/ sourceAsts, string duckPath, string duckNamespace)
        {
            // check parameters:
            if (sourceAsts == null)
                throw new ArgumentNullException("sourceAsts");
            if (duckPath == null)
                throw new ArgumentNullException("duckPath");

            // create directory for duck types if not exists:
            Directory.CreateDirectory(duckPath);

            // process source code:
            foreach (var ast in sourceAsts)
            {
                DuckTypeGenerator.Instance.ProcessModule(ast);
            }

            foreach (CodeCompileUnit unit in DuckTypeGenerator.Instance.GenerateCodeUnits(new FullPath(duckPath), duckNamespace))
            {
                string file = unit.UserData["ID"].ToString() + ".cs";
                FullPath path = new FullPath(file, new FullPath(duckPath));

                string dir = Path.GetDirectoryName(path);
                if (!Directory.Exists(dir)) Directory.CreateDirectory(dir);

                CodeDomProvider provider = CodeDomProvider.CreateProvider("csharp");
                using (StreamWriter wr = new StreamWriter(path.ToString()))
                {
                    provider.GenerateCodeFromCompileUnit(unit, wr, new CodeGeneratorOptions());
                }
            }
        }
开发者ID:dw4dev,项目名称:Phalanger,代码行数:38,代码来源:Generator.CLR.cs

示例3: StaticInclude

		public bool StaticInclude(int level, string relativeSourcePath, RuntimeTypeHandle includee, InclusionTypes inclusionType)
		{
			ApplicationConfiguration app_config = Configuration.Application;

            var included_full_path =
            //PhpSourceFile source_file = new PhpSourceFile(
            //	app_config.Compiler.SourceRoot,
                new FullPath(app_config.Compiler.SourceRoot, new RelativePath((sbyte)level, relativeSourcePath));
			//);

            if (scripts.ContainsKey(included_full_path.ToString()))
			{
				// the script has been included => returns whether it should be included again:
				return !InclusionTypesEnum.IsOnceInclusion(inclusionType);
			}
			else
			{
				// the script has not been included yet:
                scripts.Add(included_full_path.ToString(), new ScriptInfo(Type.GetTypeFromHandle(includee)));

				// the script should be included:
				return true;
			}
		}
开发者ID:hansdude,项目名称:Phalanger,代码行数:24,代码来源:ScriptContext.CLR.cs


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