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


C# FilePath.Combine方法代码示例

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


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

示例1: AndroidToolbox

		public AndroidToolbox (FilePath androidPath, FilePath javaBinPath)
		{
			this.androidToolsPath = androidPath.Combine ("tools");
			this.androidPlatformToolsPath = androidPath.Combine ("platform-tools");
			this.javaBinPath = javaBinPath;
			
			pathOverride = Environment.GetEnvironmentVariable ("PATH");
			if (string.IsNullOrEmpty (pathOverride))
				pathOverride = javaBinPath;
			else
				pathOverride = javaBinPath + Path.PathSeparator + pathOverride;
		}
开发者ID:poke,项目名称:monodevelop,代码行数:12,代码来源:AndroidToolbox.cs

示例2: ValidateSdkLocation

		internal static bool ValidateSdkLocation (FilePath location, out FilePath versionPlist)
		{
			versionPlist = location.Combine ("..", "version.plist");
			if (System.IO.File.Exists (versionPlist))
				return true;
			
			versionPlist = location.Combine ("Library", "version.plist");
			if (System.IO.File.Exists (versionPlist))
				return true;
			
			versionPlist = FilePath.Empty;
			return false;
		}
开发者ID:nieve,项目名称:monodevelop,代码行数:13,代码来源:AppleSdkSettings.cs

示例3: GetDirectoryDotSvn

		public virtual string GetDirectoryDotSvn (FilePath path)
		{
			if (Directory.Exists (path.Combine (".svn")))
				return path;

			return String.Empty;
		}
开发者ID:gAdrev,项目名称:monodevelop,代码行数:7,代码来源:SubversionVersionControl.cs

示例4: ValidatePaths

		static bool ValidatePaths (FilePath xcode, FilePath vplist, FilePath devroot)
		{
			return Directory.Exists (xcode)
				&& Directory.Exists (devroot)
				&& File.Exists (vplist)
				&& File.Exists (xcode.Combine ("Contents", "Info.plist"));
		}
开发者ID:nocache,项目名称:monodevelop,代码行数:7,代码来源:AppleSdkSettings.cs

示例5: GetPath

		static FilePath GetPath (XmlElement xmlElement, string attributeName, FilePath baseDirectory)
		{
			string directory = GetAttribute (xmlElement, attributeName, null);
			if (directory == null)
				return FilePath.Null;

			return baseDirectory.Combine (directory).FullPath;
		}
开发者ID:PlayScriptRedux,项目名称:monodevelop,代码行数:8,代码来源:ProjectTemplatePackageReference.cs

示例6: CreateGitIgnoreFile

		void CreateGitIgnoreFile (FilePath solutionPath)
		{
			FilePath gitIgnoreFilePath = solutionPath.Combine (".gitignore");
			if (!File.Exists (gitIgnoreFilePath)) {
				FilePath sourceGitIgnoreFilePath = GetSourceGitIgnoreFilePath ();
				File.Copy (sourceGitIgnoreFilePath, gitIgnoreFilePath);
			}
		}
开发者ID:pabloescribanoloza,项目名称:monodevelop,代码行数:8,代码来源:ProjectTemplateHandler.cs

示例7: GetRepositoryReference

		public override Repository GetRepositoryReference (FilePath path, string id)
		{
			if (path.IsEmpty || path.ParentDirectory.IsEmpty || path.IsNull || path.ParentDirectory.IsNull)
				return null;
			if (System.IO.Directory.Exists (path.Combine (".git")))
				return new GitRepository (path, null);
			else
				return GetRepositoryReference (path.ParentDirectory, id);
		}
开发者ID:acken,项目名称:monodevelop,代码行数:9,代码来源:GitVersionControl.cs

示例8: GetDirectoryDotSvn

		internal static string GetDirectoryDotSvn (FilePath path)
		{
			if (path.IsEmpty || path.ParentDirectory.IsEmpty || path.IsNull || path.ParentDirectory.IsNull)
				return String.Empty;

			if (Directory.Exists (path.Combine (".svn")))
				return path;

			return GetDirectoryDotSvn (path.ParentDirectory);
		}
开发者ID:pjt33,项目名称:monodevelop,代码行数:10,代码来源:SubversionVersionControl.cs

示例9: GetRepositoryReference

		public override Repository GetRepositoryReference (FilePath path, string id)
		{
			if (path.IsEmpty || path.ParentDirectory.IsEmpty || path.IsNull || path.ParentDirectory.IsNull)
				return null;
			if (System.IO.Directory.Exists (path.Combine (".git"))) {
				GitRepository repo;
				if (!repositories.TryGetValue (path.CanonicalPath, out repo))
					repositories [path.CanonicalPath] = repo = new GitRepository (path, null);
				return repo;
			}
			return GetRepositoryReference (path.ParentDirectory, id);
		}
开发者ID:llucenic,项目名称:monodevelop,代码行数:12,代码来源:GitVersionControl.cs

示例10: CanCreateVariousPaths

		public void CanCreateVariousPaths ()
		{
			FilePath path;
			string expected;

			expected = Path.Combine ("this", "is", "a", "path");
			path = FilePath.Build ("this", "is", "a", "path");
			Assert.AreEqual (expected, path.ToString ());

			expected = "";
			path = FilePath.Empty;
			Assert.AreEqual (expected, path.ToString ());
			Assert.IsTrue (path.IsEmpty);
			Assert.IsTrue (path.IsNullOrEmpty);

			expected = null;
			path = FilePath.Null;
			Assert.AreEqual (expected, path.ToString ());
			Assert.IsTrue (path.IsNull);
			Assert.IsTrue (path.IsNullOrEmpty);

			expected = Path.Combine ("this", "is", "a", "path");
			path = new FilePath (expected);
			Assert.AreEqual (expected, path.ToString ());

			expected = Path.Combine (expected, "and", "more");
			path = path.Combine ("and", "more");
			Assert.AreEqual (expected, path.ToString ());

			expected = "file.txt";
			path = new FilePath ("file").ChangeExtension (".txt");
			Assert.AreEqual (expected, path.ToString ());

			expected = "file.txt";
			path = new FilePath ("file.type").ChangeExtension (".txt");
			Assert.AreEqual (expected, path.ToString ());

			// TODO: Test file:// scheme
		}
开发者ID:pabloescribanoloza,项目名称:monodevelop,代码行数:39,代码来源:FilePathTests.cs

示例11: CreateFileFromTemplate

        static void CreateFileFromTemplate(Project project, SolutionItem policyItem, FilePath templateSourceDirectory, string fileTemplateName)
        {
            string templateFileName = templateSourceDirectory.Combine (fileTemplateName + ".xft.xml");
            using (Stream stream = File.OpenRead (templateFileName)) {
                var document = new XmlDocument ();
                document.Load (stream);

                foreach (XmlElement templateElement in document.DocumentElement["TemplateFiles"].ChildNodes.OfType<XmlElement> ()) {
                    var template = FileDescriptionTemplate.CreateTemplate (templateElement, templateSourceDirectory);
                    template.AddToProject (policyItem, project, "C#", project.BaseDirectory, null);
                }
            }
        }
开发者ID:twing207,项目名称:monodevelop-dnx-addin,代码行数:13,代码来源:FileTemplateProcessor.cs

示例12: FallbackProbeDirectoryDotSvn

		static bool FallbackProbeDirectoryDotSvn (FilePath path)
		{
			while (!path.IsNullOrEmpty) {
				if (Directory.Exists (path.Combine (".svn")))
					return true;
				path = path.ParentDirectory;
			}
			return false;
		}
开发者ID:FreeBSD-DotNet,项目名称:monodevelop,代码行数:9,代码来源:SvnClient.cs

示例13: GetExeLocation

		static string GetExeLocation (TargetRuntime runtime, string toolsVersion, bool requiresMicrosoftBuild)
		{
			var builderDir = new FilePath (typeof(MSBuildProjectService).Assembly.Location).ParentDirectory.Combine ("MSBuild");

			var version = Version.Parse (toolsVersion);
			bool useMicrosoftBuild = 
				requiresMicrosoftBuild ||
				((version >= new Version (15, 0)) && Runtime.Preferences.BuildWithMSBuild) ||
				(version >= new Version (4, 0) && runtime is MsNetTargetRuntime);

			if (useMicrosoftBuild) {
				toolsVersion = "dotnet." + (version >= new Version (15, 0) ? "14.1" : toolsVersion);
			}

			var exe = builderDir.Combine (toolsVersion, "MonoDevelop.Projects.Formats.MSBuild.exe");
			if (File.Exists (exe))
				return exe;
			
			throw new InvalidOperationException ("Unsupported MSBuild ToolsVersion '" + version + "'");
		}
开发者ID:PlayScriptRedux,项目名称:monodevelop,代码行数:20,代码来源:MSBuildProjectService.cs

示例14: FromFrameworkDirectory

		public static TargetFramework FromFrameworkDirectory (TargetFrameworkMoniker moniker, FilePath dir)
		{
			var fxList = dir.Combine ("RedistList", "FrameworkList.xml");
			if (!File.Exists (fxList))
				return null;
			
			var fx = new TargetFramework (moniker);
			
			using (var reader = System.Xml.XmlReader.Create (fxList)) {
				if (!reader.ReadToDescendant ("FileList"))
					throw new Exception ("Missing FileList element");
				
				//not sure what this is for
				//if (reader.MoveToAttribute ("Redist") && reader.ReadAttributeValue ())
				//	redist = reader.ReadContentAsString ();
				
				if (reader.MoveToAttribute ("Name") && reader.ReadAttributeValue ())
					fx.name = reader.ReadContentAsString ();
				
				if (reader.MoveToAttribute ("RuntimeVersion") && reader.ReadAttributeValue ()) {
					string runtimeVersion = reader.ReadContentAsString ();
					switch (runtimeVersion) {
					case "2.0":
						fx.clrVersion = ClrVersion.Net_2_0;
						break;
					case "4.0":
						fx.clrVersion = ClrVersion.Net_4_0;
						break;
					//The concept of "ClrVersion" breaks down hard after 4.5 and is essentially meaningless
					default:
						fx.clrVersion = ClrVersion.Net_4_5;
						break;
					}
				}
				
				if (reader.MoveToAttribute ("ToolsVersion") && reader.ReadAttributeValue ()) {
					string toolsVersion = reader.ReadContentAsString ();
					switch (toolsVersion) {
					case "2.0":
						fx.toolsVersion = TargetFrameworkToolsVersion.V2_0;
						break;
					case "3.5":
						fx.toolsVersion = TargetFrameworkToolsVersion.V3_5;
						break;
					case "4.0":
						fx.toolsVersion = TargetFrameworkToolsVersion.V4_0;
						break;
					case "4.5":
						fx.toolsVersion = TargetFrameworkToolsVersion.V4_5;
						break;
					default:
						LoggingService.LogInfo ("Framework {0} has unknown ToolsVersion {1}", moniker, toolsVersion);
						return null;
					}
				}
				
				if (reader.MoveToAttribute ("IncludeFramework") && reader.ReadAttributeValue ()) {
					string include = reader.ReadContentAsString ();
					if (!string.IsNullOrEmpty (include))
						fx.includesFramework = include;
				}
				
				//this is a Mono-specific extension
				if (reader.MoveToAttribute ("TargetFrameworkDirectory") && reader.ReadAttributeValue ()) {
					string targetDir = reader.ReadContentAsString ();
					if (!string.IsNullOrEmpty (targetDir)) {
						targetDir = targetDir.Replace ('\\', System.IO.Path.DirectorySeparatorChar);
						dir = fxList.ParentDirectory.Combine (targetDir).FullPath;
					}
				}
				
				var assemblies = new List<AssemblyInfo> ();
				if (reader.ReadToFollowing ("File")) {
					do {
						var ainfo = new AssemblyInfo ();
						assemblies.Add (ainfo);
						if (reader.MoveToAttribute ("AssemblyName") && reader.ReadAttributeValue ())
							ainfo.Name = reader.ReadContentAsString ();
						if (string.IsNullOrEmpty (ainfo.Name))
							throw new Exception ("Missing AssemblyName attribute");
						if (reader.MoveToAttribute ("Version") && reader.ReadAttributeValue ())
							ainfo.Version = reader.ReadContentAsString ();
						if (reader.MoveToAttribute ("PublicKeyToken") && reader.ReadAttributeValue ())
							ainfo.PublicKeyToken = reader.ReadContentAsString ();
						if (reader.MoveToAttribute ("Culture") && reader.ReadAttributeValue ())
							ainfo.Culture = reader.ReadContentAsString ();
						if (reader.MoveToAttribute ("ProcessorArchitecture") && reader.ReadAttributeValue ())
							ainfo.ProcessorArchitecture = (ProcessorArchitecture)
								Enum.Parse (typeof (ProcessorArchitecture), reader.ReadContentAsString (), true);
						if (reader.MoveToAttribute ("InGac") && reader.ReadAttributeValue ())
							ainfo.InGac = reader.ReadContentAsBoolean ();
					} while (reader.ReadToFollowing ("File"));
				} else if (Directory.Exists (dir)) {
					
					foreach (var f in Directory.EnumerateFiles (dir, "*.dll")) {
						try {
							var an = SystemAssemblyService.GetAssemblyNameObj (dir.Combine (f));
							var ainfo = new AssemblyInfo ();
							ainfo.Update (an);
							assemblies.Add (ainfo);
//.........这里部分代码省略.........
开发者ID:kdubau,项目名称:monodevelop,代码行数:101,代码来源:TargetFramework.cs

示例15: GetDirectoryVersionInfo

		VersionInfo[] GetDirectoryVersionInfo (FilePath localDirectory, string fileName, bool getRemoteStatus, bool recursive)
		{
			StringReader sr = RunCommand ("log -1 --format=format:%H", true);
			string strRev = sr.ReadLine ();
			sr.Close ();
			
			HashSet<FilePath> existingFiles = new HashSet<FilePath> ();
			if (fileName != null) {
				FilePath fp = localDirectory.Combine (fileName).CanonicalPath;
				if (File.Exists (fp))
					existingFiles.Add (fp);
			} else
				CollectFiles (existingFiles, localDirectory, recursive);
			
			GitRevision rev = new GitRevision (this, strRev);
			List<VersionInfo> versions = new List<VersionInfo> ();
			FilePath p = fileName != null ? localDirectory.Combine (fileName) : localDirectory;
			sr = RunCommand ("status -s " + ToCmdPath (p), true);
			string line;
			while ((line = sr.ReadLine ()) != null) {
				char staged = line[0];
				char nostaged = line[1];
				string file = line.Substring (3);
				FilePath srcFile = FilePath.Null;
				int i = file.IndexOf ("->");
				if (i != -1) {
					srcFile = path.Combine (file.Substring (0, i - 1));
					file = file.Substring (i + 3);
				}
				FilePath statFile = path.Combine (file);
				if (statFile.ParentDirectory != localDirectory && (!statFile.IsChildPathOf (localDirectory) || !recursive))
					continue;
				VersionStatus status;
				if (staged == 'M' || nostaged == 'M')
					status = VersionStatus.Versioned | VersionStatus.Modified;
				else if (staged == 'A')
					status = VersionStatus.Versioned | VersionStatus.ScheduledAdd;
				else if (staged == 'D' || nostaged == 'D')
					status = VersionStatus.Versioned | VersionStatus.ScheduledDelete;
				else if (staged == 'U' || nostaged == 'U')
					status = VersionStatus.Versioned | VersionStatus.Conflicted;
				else if (staged == 'R') {
					// Renamed files are in reality files delete+added to a different location.
					existingFiles.Remove (srcFile.CanonicalPath);
					VersionInfo rvi = new VersionInfo (srcFile, "", false, VersionStatus.Versioned | VersionStatus.ScheduledDelete, rev, VersionStatus.Versioned, null);
					versions.Add (rvi);
					status = VersionStatus.Versioned | VersionStatus.ScheduledAdd;
				}
				else
					status = VersionStatus.Unversioned;
				
				existingFiles.Remove (statFile.CanonicalPath);
				VersionInfo vi = new VersionInfo (statFile, "", false, status, rev, VersionStatus.Versioned, null);
				versions.Add (vi);
			}
			
			// Files for which git did not report an status are supposed to be tracked
			foreach (FilePath file in existingFiles) {
				VersionInfo vi = new VersionInfo (file, "", false, VersionStatus.Versioned, rev, VersionStatus.Versioned, null);
				versions.Add (vi);
			}
			
			return versions.ToArray ();
		}
开发者ID:Tak,项目名称:monodevelop-novell,代码行数:64,代码来源:GitRepository.cs


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