本文整理汇总了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;
}
示例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;
}
示例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;
}