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


C# Project.Remove方法代码示例

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


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

示例1: RenameFile

			public static bool RenameFile(Project Project, string file, string NewFileName)
			{
				var absPath = Project.ToAbsoluteFileName(file);
				var newFilePath =Path.Combine(Project.BaseDirectory, Path.GetDirectoryName(NewFileName),Util.PurifyFileName(Path.GetFileName(NewFileName)));
				var ret = Util.MoveFile(absPath, newFilePath);
				if (ret)
				{
					Project.Remove(file);
					Project.Add(newFilePath);
					Project.Save();

					foreach (var e in Instance.Editors)
						if (e.AbsoluteFilePath == absPath)
						{
							e.AbsoluteFilePath = newFilePath;
							e.Reload();
						}
				}
				return ret;
			}
开发者ID:DinrusGroup,项目名称:D-IDE,代码行数:20,代码来源:FileManagement.cs

示例2: ExcludeDirectoryFromProject

			public static bool ExcludeDirectoryFromProject(Project prj, string RelativePath)
			{
				if (prj == null || string.IsNullOrEmpty(RelativePath))
					return false;

				/*
				 * - Delete all subdirectory references
				 * - Delete all files that are inside of these directories
				 */
				var affectedFiles = (from f in prj.Files
									 where Path.GetDirectoryName(f.FileName).Contains(RelativePath)
									 select prj.ToAbsoluteFileName(f.FileName)).ToArray();

				foreach (var ed in Instance.Editors.Where(e => affectedFiles.Contains(e.AbsoluteFilePath)))
					ed.Close();

				foreach (var s in prj.SubDirectories.Where(d => d == RelativePath || d.Contains(RelativePath)).ToArray())
					prj.SubDirectories.Remove(s);

				foreach (var s in affectedFiles)
					prj.Remove(s);

				prj.Save();

				Instance.UpdateGUI();
				return true;
			}
开发者ID:DinrusGroup,项目名称:D-IDE,代码行数:27,代码来源:FileManagement.cs

示例3: ExludeFileFromProject

			public static bool ExludeFileFromProject(Project Project, string file)
			{
				var absFile = Project.ToAbsoluteFileName(file);
				// Close (all) editor(s) that represent our file
				foreach (var ed in Instance.Editors.Where(e => e.AbsoluteFilePath == absFile).ToArray())
					if (!ed.Close())
						return false;

				var r = Project.Remove(file);
				if (r)
				{
					Project.Save();
					Instance.MainWindow.RefreshProjectExplorer();
				}
				return r;
			}
开发者ID:DinrusGroup,项目名称:D-IDE,代码行数:16,代码来源:FileManagement.cs

示例4: MoveFile

			public static bool MoveFile(Project Project, string FileName, Project TargetProject, string NewDirectory)
			{
				/*
				 * - Copy file
				 * - Delete old physically
				 * - Delete old one from project
				 */
				Instance.CanUpdateGUI = false;
				if (CopyFile(Project, FileName, TargetProject, NewDirectory) && 
					Project.Remove(FileName))
				{
					var oldDir_rel = Path.GetDirectoryName(Project.ToRelativeFileName(FileName));

					foreach(var ed in IDEManager.Instance.Editors)
						if (ed.AbsoluteFilePath == Project.ToAbsoluteFileName(FileName))
						{
							ed.FileName = TargetProject.ToAbsoluteFileName(Path.Combine(NewDirectory, Path.GetFileName(FileName)));
						}

					try
					{
						File.Delete(Project.ToAbsoluteFileName(FileName));
					}
					catch (Exception ex)
					{
						IDELogger.Log(ex);
					}
					// If directory empty, keep it managed by the project
					if (!Project.SubDirectories.Contains(oldDir_rel) && !string.IsNullOrEmpty(oldDir_rel))
						Project.SubDirectories.Add(oldDir_rel);
					Project.Save();
				}
				Instance.CanUpdateGUI = true;
				Instance.UpdateGUI();
				return false;
			}
开发者ID:DinrusGroup,项目名称:D-IDE,代码行数:36,代码来源:FileManagement.cs


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