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


C# Solution.Dispose方法代码示例

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


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

示例1: CreateSolution

		public string CreateSolution(ProjectCreateInformation projectCreateInformation, string defaultLanguage)
		{
			string oldSolutionPath = projectCreateInformation.SolutionPath;
			string oldProjectPath = projectCreateInformation.ProjectBasePath;
			if (relativeDirectory != null && relativeDirectory.Length > 0 && relativeDirectory != ".") {
				projectCreateInformation.SolutionPath     = Path.Combine(projectCreateInformation.SolutionPath, relativeDirectory);
				projectCreateInformation.ProjectBasePath = Path.Combine(projectCreateInformation.SolutionPath, relativeDirectory);
				if (!Directory.Exists(projectCreateInformation.SolutionPath)) {
					Directory.CreateDirectory(projectCreateInformation.SolutionPath);
				}
				if (!Directory.Exists(projectCreateInformation.ProjectBasePath)) {
					Directory.CreateDirectory(projectCreateInformation.ProjectBasePath);
				}
			}
			
			projectCreateInformation.SolutionPath = oldSolutionPath;
			projectCreateInformation.ProjectBasePath = oldProjectPath;
			
			string newSolutionName = StringParser.Parse(name, new StringTagPair("ProjectName", projectCreateInformation.SolutionName));
			
			string solutionLocation = Path.Combine(projectCreateInformation.SolutionPath, newSolutionName + ".sln");
			
			Solution newSolution = new Solution(new ProjectChangeWatcher(solutionLocation));
			projectCreateInformation.Solution = newSolution;
			
			newSolution.Name = newSolutionName;
			
			if (!mainFolder.AddContents(newSolution, projectCreateInformation, defaultLanguage, newSolution)) {
				newSolution.Dispose();
				return null;
			}
			
			// Save solution
			if (File.Exists(solutionLocation)) {
				
				string question = StringParser.Parse("${res:ICSharpCode.SharpDevelop.Internal.Templates.CombineDescriptor.OverwriteProjectQuestion}",
				                                     new StringTagPair("combineLocation", solutionLocation));
				if (MessageService.AskQuestion(question)) {
					newSolution.Save(solutionLocation);
				}
			} else {
				newSolution.Save(solutionLocation);
			}
			ProjectService.OnSolutionCreated(new SolutionEventArgs(newSolution));
			newSolution.Dispose();
			return solutionLocation;
		}
开发者ID:lisiynos,项目名称:pascalabcnet,代码行数:47,代码来源:SolutionDescriptor.cs

示例2: LoadSolutionFile

		public ISolution LoadSolutionFile(FileName fileName, IProgressMonitor progress)
		{
			if (fileName == null)
				throw new ArgumentNullException("fileName");
			if (progress == null)
				throw new ArgumentNullException("progress");
			if (fileName.IsRelative)
				throw new ArgumentException("Path must be rooted!");
			Solution solution = new Solution(fileName, new ProjectChangeWatcher(fileName), SD.FileService);
			bool ok = false;
			try {
				using (var loader = new SolutionLoader(fileName)) {
					loader.ReadSolution(solution, progress);
				}
				ok = true;
			} finally {
				if (!ok)
					solution.Dispose();
			}
			return solution;
		}
开发者ID:RHE24,项目名称:SharpDevelop,代码行数:21,代码来源:ProjectService.cs

示例3: CreateSolution

		public string CreateSolution(ProjectCreateInformation projectCreateInformation, string defaultLanguage)
		{
			Solution newSolution = new Solution();
			projectCreateInformation.Solution = newSolution;
			
			string newCombineName = StringParser.Parse(name, new string[,] {
			                                           	{"ProjectName", projectCreateInformation.ProjectName}
			                                           });
			
			newSolution.Name = newCombineName;
			
			string oldCombinePath = projectCreateInformation.SolutionPath;
			string oldProjectPath = projectCreateInformation.ProjectBasePath;
			if (relativeDirectory != null && relativeDirectory.Length > 0 && relativeDirectory != ".") {
				projectCreateInformation.SolutionPath     = Path.Combine(projectCreateInformation.SolutionPath, relativeDirectory);
				projectCreateInformation.ProjectBasePath = Path.Combine(projectCreateInformation.SolutionPath, relativeDirectory);
				if (!Directory.Exists(projectCreateInformation.SolutionPath)) {
					Directory.CreateDirectory(projectCreateInformation.SolutionPath);
				}
				if (!Directory.Exists(projectCreateInformation.ProjectBasePath)) {
					Directory.CreateDirectory(projectCreateInformation.ProjectBasePath);
				}
			}
			
			projectCreateInformation.SolutionPath = oldCombinePath;
			projectCreateInformation.ProjectBasePath = oldProjectPath;
			
			if (!mainFolder.AddContents(newSolution, projectCreateInformation, defaultLanguage, newSolution)) {
				newSolution.Dispose();
				return null;
			}
			
			string combineLocation = Path.Combine(projectCreateInformation.SolutionPath, newCombineName + ".sln");
			// Save combine
			if (File.Exists(combineLocation)) {
				
				StringParser.Properties["combineLocation"] = combineLocation;
				if (MessageService.AskQuestion("${res:ICSharpCode.SharpDevelop.Internal.Templates.CombineDescriptor.OverwriteProjectQuestion}")) {
					newSolution.Save(combineLocation);
				}
			} else {
				newSolution.Save(combineLocation);
			}
			newSolution.Dispose();
			return combineLocation;
		}
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:46,代码来源:CombineDescriptor.cs


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