Browse Source

Delete old ProjectImporterExporter addin.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@571 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Daniel Grunwald 20 years ago
parent
commit
7acfbfc9b4
  1. 36
      src/AddIns/Misc/ProjectImporterExporter/Project/AssemblyInfo.cs
  2. 64
      src/AddIns/Misc/ProjectImporterExporter/Project/Commands/ExportProjectCommand.cs
  3. 39
      src/AddIns/Misc/ProjectImporterExporter/Project/Commands/ImportProjectCommand.cs
  4. 25
      src/AddIns/Misc/ProjectImporterExporter/Project/Converters/AbstractInputConverter.cs
  5. 22
      src/AddIns/Misc/ProjectImporterExporter/Project/Converters/AbstractOutputConverter.cs
  6. 180
      src/AddIns/Misc/ProjectImporterExporter/Project/Converters/LanguageConversion/AbstractLanguageConverterOutput.cs
  7. 60
      src/AddIns/Misc/ProjectImporterExporter/Project/Converters/LanguageConversion/CSharpToVBNetLanguageConverterOutput.cs
  8. 59
      src/AddIns/Misc/ProjectImporterExporter/Project/Converters/LanguageConversion/VBNetToCSharpLanguageConverterOutput.cs
  9. 341
      src/AddIns/Misc/ProjectImporterExporter/Project/Converters/VSNet/SolutionConverterTool.cs
  10. 251
      src/AddIns/Misc/ProjectImporterExporter/Project/Converters/VSNet/SolutionInputConverter.cs
  11. 199
      src/AddIns/Misc/ProjectImporterExporter/Project/Converters/VSNet/SolutionOutputConverter.cs
  12. 91
      src/AddIns/Misc/ProjectImporterExporter/Project/Converters/VSNet/SolutionOutputConverterTool.cs
  13. 168
      src/AddIns/Misc/ProjectImporterExporter/Project/Converters/VSNet/VSProjectInputConverter.cs
  14. 66
      src/AddIns/Misc/ProjectImporterExporter/Project/Dialogs/ChooseProjectLocationDialog.cs
  15. 179
      src/AddIns/Misc/ProjectImporterExporter/Project/Dialogs/ExportProjectDialog.cs
  16. 123
      src/AddIns/Misc/ProjectImporterExporter/Project/Dialogs/ImportProjectDialog.cs
  17. 133
      src/AddIns/Misc/ProjectImporterExporter/Project/Resources/CSSolutionConversion.xsl
  18. 57
      src/AddIns/Misc/ProjectImporterExporter/Project/Resources/ChooseProjectLocationDialog.xfrm
  19. 139
      src/AddIns/Misc/ProjectImporterExporter/Project/Resources/ExportProjectDialog.xfrm
  20. 108
      src/AddIns/Misc/ProjectImporterExporter/Project/Resources/ImportProjectDialog.xfrm
  21. 48
      src/AddIns/Misc/ProjectImporterExporter/Project/Resources/ProjectImporterExporter.addin
  22. 110
      src/AddIns/Misc/ProjectImporterExporter/Project/Resources/ProjectToVSNetProjectConversion.xsl
  23. 121
      src/AddIns/Misc/ProjectImporterExporter/Project/Resources/VBSolutionConversion.xsl

36
src/AddIns/Misc/ProjectImporterExporter/Project/AssemblyInfo.cs

@ -1,36 +0,0 @@ @@ -1,36 +0,0 @@
using System;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Security;
using System.Security.Permissions;
// Information about this assembly is defined by the following
// attributes.
//
// change them to the information which is associated with the assembly
// you compile.
[assembly:UIPermissionAttribute(SecurityAction.RequestMinimum, Window = UIPermissionWindow.AllWindows)]
[assembly: AssemblyTitle("")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("")]
[assembly: AssemblyCopyright("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// The assembly version has following format :
//
// Major.Minor.Build.Revision
//
// You can specify all values by your own or you can build default build and revision
// numbers with the '*' character (the default):
[assembly: AssemblyVersion("2.0.0.1")]
// The following attributes specify the key for the sign of your assembly. See the
// .NET Framework documentation for more information about signing.
// This is not required, if you don't want signing let these attributes like they're.
[assembly: AssemblyDelaySign(false)]
[assembly: AssemblyKeyFile("")]

64
src/AddIns/Misc/ProjectImporterExporter/Project/Commands/ExportProjectCommand.cs

@ -1,64 +0,0 @@ @@ -1,64 +0,0 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Mike Krger" email="mike@icsharpcode.net"/>
// <version value="$version"/>
// </file>
using System;
using System.Collections;
using System.Text;
using System.Text.RegularExpressions;
using System.IO;
using System.Windows.Forms;
using System.Xml.Xsl;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop.Internal.Project;
using ICSharpCode.SharpDevelop.Gui;
using MSjogren.GacTool.FusionNative;
using ICSharpCode.SharpDevelop.Commands;
using ICSharpCode.SharpDevelop.ProjectImportExporter.Converters;
using ICSharpCode.SharpDevelop.ProjectImportExporter.Dialogs;
namespace ICSharpCode.SharpDevelop.ProjectImportExporter.Commands
{
public class ExportProjectCommand : AbstractMenuCommand
{
public override void Run()
{
using (ExportProjectDialog exportProjectDialog = new ExportProjectDialog("Visual Studio.NET 2003 Solutions")) {
exportProjectDialog.Owner = (Form)WorkbenchSingleton.Workbench;
exportProjectDialog.ShowDialog(ICSharpCode.SharpDevelop.Gui.WorkbenchSingleton.MainForm);
}
}
}
public class ExportProjectToCSharpCommand : AbstractMenuCommand
{
public override void Run()
{
IProjectService projectService = (IProjectService)ICSharpCode.Core.ServiceManager.Services.GetService(typeof(IProjectService));
using (ExportProjectDialog exportProjectDialog = new ExportProjectDialog("Convert VB.NET to C#", projectService.CurrentSelectedProject != null ? projectService.CurrentSelectedProject.Name : null)) {
exportProjectDialog.Owner = (Form)WorkbenchSingleton.Workbench;
exportProjectDialog.ShowDialog(ICSharpCode.SharpDevelop.Gui.WorkbenchSingleton.MainForm);
}
}
}
public class ExportProjectToVBNetCommand : AbstractMenuCommand
{
public override void Run()
{
IProjectService projectService = (IProjectService)ICSharpCode.Core.ServiceManager.Services.GetService(typeof(IProjectService));
using (ExportProjectDialog exportProjectDialog = new ExportProjectDialog("Convert C# to VB.NET", projectService.CurrentSelectedProject != null ? projectService.CurrentSelectedProject.Name : null)) {
exportProjectDialog.Owner = (Form)WorkbenchSingleton.Workbench;
exportProjectDialog.ShowDialog(ICSharpCode.SharpDevelop.Gui.WorkbenchSingleton.MainForm);
}
}
}
}

39
src/AddIns/Misc/ProjectImporterExporter/Project/Commands/ImportProjectCommand.cs

@ -1,39 +0,0 @@ @@ -1,39 +0,0 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Mike Krger" email="mike@icsharpcode.net"/>
// <version value="$version"/>
// </file>
using System;
using System.Collections;
using System.Text;
using System.Text.RegularExpressions;
using System.IO;
using System.Windows.Forms;
using System.Xml.Xsl;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop.Internal.Project;
using ICSharpCode.SharpDevelop.Gui;
using MSjogren.GacTool.FusionNative;
using ICSharpCode.SharpDevelop.Commands;
using ICSharpCode.SharpDevelop.ProjectImportExporter.Converters;
using ICSharpCode.SharpDevelop.ProjectImportExporter.Dialogs;
namespace ICSharpCode.SharpDevelop.ProjectImportExporter.Commands
{
public class ImportProjectCommand : AbstractMenuCommand
{
public override void Run()
{
using (ImportProjectDialog importProjectDialog = new ImportProjectDialog()) {
importProjectDialog.Owner = (Form)WorkbenchSingleton.Workbench;
importProjectDialog.ShowDialog(ICSharpCode.SharpDevelop.Gui.WorkbenchSingleton.MainForm);
}
}
}
}

25
src/AddIns/Misc/ProjectImporterExporter/Project/Converters/AbstractInputConverter.cs

@ -1,25 +0,0 @@ @@ -1,25 +0,0 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Mike Krueger" email="mike@icsharpcode.net"/>
// <version value="$version"/>
// </file>
using System;
namespace ICSharpCode.SharpDevelop.ProjectImportExporter.Converters
{
public abstract class AbstractInputConverter
{
public abstract string FormatName {
get;
}
public abstract string OutputFile {
get;
}
public abstract bool CanConvert(string fileName);
public abstract bool Convert(string inputFile, string outputPath);
}
}

22
src/AddIns/Misc/ProjectImporterExporter/Project/Converters/AbstractOutputConverter.cs

@ -1,22 +0,0 @@ @@ -1,22 +0,0 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Mike Krueger" email="mike@icsharpcode.net"/>
// <version value="$version"/>
// </file>
using System;
using ICSharpCode.SharpDevelop.Gui;
namespace ICSharpCode.SharpDevelop.ProjectImportExporter.Converters
{
public abstract class AbstractOutputConverter
{
public abstract string FormatName {
get;
}
public abstract void ConvertCombine(IProgressMonitor progressMonitor, string inputCombine, string outputPath);
public abstract void ConvertProject(IProgressMonitor progressMonitor, string inputProject, string outputPath);
}
}

180
src/AddIns/Misc/ProjectImporterExporter/Project/Converters/LanguageConversion/AbstractLanguageConverterOutput.cs

@ -1,180 +0,0 @@ @@ -1,180 +0,0 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Mike Krueger" email="mike@icsharpcode.net"/>
// <version value="$version"/>
// </file>
using System;
using System.Collections;
using System.IO;
using System.Reflection;
using System.Xml;
using System.Xml.Xsl;
using System.CodeDom.Compiler;
using ICSharpCode.SharpDevelop.Internal.Project;
using ICSharpCode.SharpDevelop.Gui;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop.Internal.Templates;
namespace ICSharpCode.SharpDevelop.ProjectImportExporter.Converters
{
/// <summary>
/// Description of AbstractLanguageConverterOutput.
/// </summary>
public abstract class AbstractLanguageConverterOutput : AbstractOutputConverter
{
protected abstract string Extension {
get;
}
public override void ConvertCombine(IProgressMonitor progressMonitor,string inputCombine, string outputPath)
{
string inputPath = Path.GetFullPath(Path.GetDirectoryName(inputCombine));
Combine combine = new Combine();
combine.LoadCombine(inputCombine);
Combine outputCombine = new Combine();
ArrayList projects = Combine.GetAllProjects(combine);
if (progressMonitor != null) {
progressMonitor.BeginTask("Convert", projects.Count + 1);
}
foreach (ProjectCombineEntry project in projects) {
string projectFileName = Path.GetFullPath(Path.Combine(inputPath, project.Filename));
string relativeFileName = projectFileName.Substring(inputPath.Length + 1);
string output = TranslateProject(null, projectFileName, Path.Combine(outputPath, Path.GetDirectoryName(relativeFileName)));
outputCombine.AddEntry(output);
if (progressMonitor != null) {
progressMonitor.Worked(1);
}
}
outputCombine.SaveCombine(Path.Combine(outputPath, Path.GetFileName(inputCombine)));
if (progressMonitor != null) {
progressMonitor.Done();;
}
}
public override void ConvertProject(IProgressMonitor progressMonitor,string inputProject, string outputPath)
{
TranslateProject(progressMonitor, inputProject, outputPath);
}
protected virtual IProject CreateProject(string outputPath, IProject originalProject)
{
return CreateProject(outputPath, originalProject, originalProject.ProjectType);
}
protected IProject CreateProject(string outputPath, IProject originalProject, string targetLanguage)
{
LanguageBindingService languageBindingService = (LanguageBindingService)ServiceManager.Services.GetService(typeof(LanguageBindingService));
ILanguageBinding binding = languageBindingService.GetBindingPerLanguageName(targetLanguage);
ProjectCreateInformation info = new ProjectCreateInformation();
info.CombinePath = outputPath;
info.ProjectBasePath = outputPath;
info.ProjectName = originalProject.Name + " converted";
return binding.CreateProject(info, null);
}
bool CopyFile(string original, string newFile)
{
try {
File.Copy(original, newFile);
} catch(IOException) {
return false;
}
return true;
}
bool SaveFile(string fileName, string content)
{
try {
if (!Directory.Exists(Path.GetDirectoryName(fileName))) {
Directory.CreateDirectory(Path.GetDirectoryName(fileName));
}
StreamWriter sw = new StreamWriter(fileName);
sw.Write(content);
sw.Close();
} catch (Exception e) {
Console.WriteLine("Error while saving file : " + e);
return false;
}
return true;
}
protected abstract string ConvertFile(string fileName);
string TranslateProject(IProgressMonitor progressMonitor, string inputProject, string outputPath)
{
IProjectService projectService = (IProjectService)ICSharpCode.Core.ServiceManager.Services.GetService(typeof(IProjectService));
IProject inProject = projectService.LoadProject(inputProject);
int len = inProject.BaseDirectory.Length;
IProject project = CreateProject(outputPath, inProject);
if (progressMonitor != null) {
progressMonitor.BeginTask("Convert", inProject.ProjectFiles.Count + 1);
}
foreach (ProjectFile file in inProject.ProjectFiles) {
if (file.BuildAction == BuildAction.EmbedAsResource) {
string outFile;
// resource files can be outside of the project path
if(file.Name.StartsWith(outputPath)) {
// Path.GetFilename can't be used because the filename can be
// a relative path that shouldn't get lost
outFile = Path.Combine(outputPath, file.Name.Substring(len + 1));
} else {
outFile = Path.Combine(outputPath, Path.GetFileName(file.Name));
}
if (CopyFile(file.Name, outFile)) {
ProjectFile pf = new ProjectFile(outFile);
pf.BuildAction = BuildAction.EmbedAsResource;
project.ProjectFiles.Add(pf);
}
} else if(file.Subtype != Subtype.Directory && File.Exists(file.Name)) {
string outPut;
try {
outPut = ConvertFile(file.Name);
} catch (Exception e) {
outPut = "Conversion Error : " + e.ToString();
}
// Path.GetFilename can't be used because the filename can be
// a relative path that shouldn't get lost
string outFile = Path.Combine(outputPath, file.Name.Substring(len + 1));
outFile = Path.ChangeExtension(outFile, Extension);
if (SaveFile(outFile, outPut)) {
project.ProjectFiles.Add(new ProjectFile(outFile));
}
}
if (progressMonitor != null) {
progressMonitor.Worked(1);
}
}
string output = Path.Combine(outputPath, project.Name + ".prjx");
try {
project.SaveProject(output);
} catch (Exception e) {
Console.WriteLine("Error while saving project : " + e);
return null;
}
if (progressMonitor != null) {
progressMonitor.Done();;
}
return output;
}
}
}

60
src/AddIns/Misc/ProjectImporterExporter/Project/Converters/LanguageConversion/CSharpToVBNetLanguageConverterOutput.cs

@ -1,60 +0,0 @@ @@ -1,60 +0,0 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Mike Krueger" email="mike@icsharpcode.net"/>
// <version value="$version"/>
// </file>
using System;
using System.Collections;
using System.IO;
using System.Reflection;
using System.Xml;
using System.Xml.Xsl;
using System.CodeDom.Compiler;
using ICSharpCode.SharpDevelop.Internal.Project;
using ICSharpCode.SharpDevelop.Gui;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop.Internal.Templates;
using ICSharpCode.NRefactory.PrettyPrinter;
using ICSharpCode.NRefactory.Parser;
namespace ICSharpCode.SharpDevelop.ProjectImportExporter.Converters
{
/// <summary>
/// Description of CSharpToVBNetLanguageConverterOutput.
/// </summary>
public class CSharpToVBNetLanguageConverterOutput : AbstractLanguageConverterOutput
{
public override string FormatName {
get {
return "Convert C# to VB.NET";
}
}
protected override string Extension {
get {
return ".vb";
}
}
protected override IProject CreateProject(string outputPath, IProject originalProject)
{
return CreateProject(outputPath, originalProject, "VBNET");
}
protected override string ConvertFile(string fileName)
{
ICSharpCode.NRefactory.Parser.IParser p = ICSharpCode.NRefactory.Parser.ParserFactory.CreateParser(SupportedLanguages.CSharp, new StreamReader(fileName));
p.Parse();
ICSharpCode.NRefactory.PrettyPrinter.VBNetOutputVisitor vbv = new ICSharpCode.NRefactory.PrettyPrinter.VBNetOutputVisitor();
vbv.Visit(p.CompilationUnit, null);
return vbv.Text;
}
}
}

59
src/AddIns/Misc/ProjectImporterExporter/Project/Converters/LanguageConversion/VBNetToCSharpLanguageConverterOutput.cs

@ -1,59 +0,0 @@ @@ -1,59 +0,0 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Mike Krueger" email="mike@icsharpcode.net"/>
// <version value="$version"/>
// </file>
using System;
using System.Collections;
using System.IO;
using System.Reflection;
using System.Xml;
using System.Xml.Xsl;
using System.CodeDom.Compiler;
using ICSharpCode.SharpDevelop.Internal.Project;
using ICSharpCode.SharpDevelop.Gui;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop.Internal.Templates;
using ICSharpCode.NRefactory.PrettyPrinter;
using ICSharpCode.NRefactory.Parser;
namespace ICSharpCode.SharpDevelop.ProjectImportExporter.Converters
{
/// <summary>
/// Description of CSharpToVBNetLanguageConverterOutput.
/// </summary>
public class VBNetToCSharpLanguageConverterOutput : AbstractLanguageConverterOutput
{
public override string FormatName {
get {
return "Convert VB.NET to C#";
}
}
protected override string Extension {
get {
return ".cs";
}
}
protected override IProject CreateProject(string outputPath, IProject originalProject)
{
return CreateProject(outputPath, originalProject, "C#");
}
protected override string ConvertFile(string fileName)
{
ICSharpCode.NRefactory.Parser.IParser p = ICSharpCode.NRefactory.Parser.ParserFactory.CreateParser(SupportedLanguages.CSharp, new StreamReader(fileName));
p.Parse();
ICSharpCode.NRefactory.PrettyPrinter.CSharpOutputVisitor vbv = new ICSharpCode.NRefactory.PrettyPrinter.CSharpOutputVisitor();
vbv.Visit(p.CompilationUnit, null);
return vbv.Text;
}
}
}

341
src/AddIns/Misc/ProjectImporterExporter/Project/Converters/VSNet/SolutionConverterTool.cs

@ -1,341 +0,0 @@ @@ -1,341 +0,0 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
// <version value="$version"/>
// </file>
using System;
using System.Collections;
using System.IO;
using System.Text;
using System.Text.RegularExpressions;
using System.Security;
using System.Security.Permissions;
using System.Windows.Forms;
using MSjogren.GacTool.FusionNative;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop.ProjectImportExporter.Commands;
namespace ICSharpCode.SharpDevelop.ProjectImportExporter.Converters
{
// [UIPermissionAttribute(SecurityAction.Demand, Window = UIPermissionWindow.AllWindows, Unrestricted = true)]
public class SolutionConversionTool
{
public ArrayList copiedFiles = new ArrayList();
Hashtable GacReferences = new Hashtable();
string projectTitle;
string projectInputDirectory;
string projectOutputDirectory;
void WriteLine(string str)
{
Console.WriteLine(str);
//
// TaskService.CompilerOutput += str + "\n";
// TaskService.NotifyTaskChange();
}
public SolutionConversionTool(string projectTitle, string projectInputDirectory, string projectOutputDirectory)
{
GenerateGacReferences();
this.projectTitle = projectTitle;
this.projectInputDirectory = projectInputDirectory;
this.projectOutputDirectory = projectOutputDirectory;
}
void GenerateGacReferences()
{
IApplicationContext applicationContext = null;
IAssemblyEnum assemblyEnum = null;
IAssemblyName assemblyName = null;
Fusion.CreateAssemblyEnum(out assemblyEnum, null, null, 2, 0);
while (assemblyEnum.GetNextAssembly(out applicationContext, out assemblyName, 0) == 0) {
uint nChars = 0;
assemblyName.GetDisplayName(null, ref nChars, 0);
StringBuilder sb = new StringBuilder((int)nChars);
assemblyName.GetDisplayName(sb, ref nChars, 0);
string[] info = sb.ToString().Split(',');
string aName = info[0];
string aVersion = info[1].Substring(info[1].LastIndexOf('=') + 1);
GacReferences[aName] = sb.ToString();
}
}
static string[] commonAssemblies = new string[] {
"mscorlib",
"Accessibility",
"Microsoft.Vsa",
"System.Configuration.Install",
"System.Data",
"System.Design",
"System.DirectoryServices",
"System",
"System.Drawing.Design",
"System.Drawing",
"System.EnterpriseServices",
"System.Management",
"System.Messaging",
"System.Runtime.Remoting",
"System.Runtime.Serialization.Formatters.Soap",
"System.Security",
"System.ServiceProcess",
"System.Web",
"System.Web.RegularExpressions",
"System.Web.Services",
"System.Windows.Forms",
"System.XML"
};
public bool ShouldGenerateReference(bool filter, string assemblyName, string hintPath)
{
if (filter) {
foreach (string reference in commonAssemblies) {
if (reference.ToUpper() == assemblyName.ToUpper()) {
return false;
}
}
}
if (hintPath != null && hintPath.Length > 0) {
string assemblyLocation = Path.Combine(this.projectInputDirectory, hintPath);
if (File.Exists(assemblyLocation)) {
return true;
}
}
if (!File.Exists(Path.Combine(this.projectInputDirectory, assemblyName))) {
if (GacReferences[assemblyName] != null) {
return true;
}
} else {
return true;
}
this.WriteLine("Can't import reference " + assemblyName + " (" + hintPath + ")");
return false;
}
public string GenerateReferenceType(string assemblyName, string hintPath)
{
if (hintPath != null && hintPath.Length > 0) {
string assemblyLocation = Path.Combine(this.projectInputDirectory, hintPath);
if (File.Exists(assemblyLocation)) {
return "Assembly";
}
}
if (!File.Exists(Path.Combine(this.projectInputDirectory, assemblyName))) {
if (GacReferences[assemblyName] == null) {
this.WriteLine("Can't find Assembly reference " + assemblyName);
} else {
return "Gac";
}
} else {
return "Assembly";
}
this.WriteLine("Can't determine reference type for " + assemblyName);
return "Assembly";
}
public string GenerateReference(string assemblyName, string hintPath)
{
if (hintPath != null && hintPath.Length > 0) {
string assemblyLocation = Path.Combine(this.projectInputDirectory, hintPath);
if (File.Exists(assemblyLocation)) {
VerifyFileLocation(hintPath);
return hintPath;
}
}
if (!File.Exists(Path.Combine(this.projectInputDirectory, assemblyName))) {
if (GacReferences[assemblyName] == null) {
this.WriteLine("Can't find Assembly reference " + assemblyName);
} else {
return GacReferences[assemblyName].ToString();
}
} else {
return "." + Path.DirectorySeparatorChar + assemblyName;
}
this.WriteLine("Created illegal, empty reference (should never happen) remove manually");
return null;
}
public string VerifyFileLocation(string itemFile)
{
if (itemFile.Length == 0) {
return String.Empty;
}
string itemInputFile = Path.Combine(this.projectInputDirectory, itemFile);
if (itemInputFile.StartsWith("..")) {
string correctLocation = this.projectOutputDirectory + Path.DirectorySeparatorChar +
"MovedFiles" + Path.DirectorySeparatorChar + Path.GetFileName(itemFile);
try {
if (File.Exists(correctLocation)) {
File.Delete(correctLocation);
}
this.WriteLine("Copy file " + itemInputFile + " to " + correctLocation);
copiedFiles.Add(new DictionaryEntry(itemInputFile, correctLocation));
} catch (Exception) {
//
// MessageService.ShowError(e, "Can't copy " + itemInputFile + " to " + correctLocation +"\nCheck for write permission.");
}
return "." + correctLocation.Substring(this.projectOutputDirectory.Length);
}
copiedFiles.Add(new DictionaryEntry(itemInputFile, this.projectOutputDirectory + Path.DirectorySeparatorChar + itemFile));
return itemFile.StartsWith(".") ? itemFile : "." + Path.DirectorySeparatorChar + itemFile;
}
public string EnsureBool(string txt)
{
if (txt.ToUpper() == "TRUE") {
return true.ToString();
}
return false.ToString();
}
public string Negate(string txt)
{
if (txt.ToUpper() == "TRUE") {
return false.ToString();
}
return true.ToString();
}
/// <summary>
/// Imports a resource file.
/// </summary>
/// <param name="resourceFile">The resource file.</param>
/// <param name="dependentFile">The dependent source file.</param>
/// <returns>The output resource file path.</returns>
public string ImportDependentResource(string resourceFile, string dependentFile, string rootNamespace)
{
WriteLine("Import resource " + resourceFile);
WriteLine("Searching namespace in " + dependentFile);
string resourceOutputFile;
string Namespace = null;
if (dependentFile != null && dependentFile.Length > 0)
Namespace = GetNamespaceFromFile(Path.Combine(this.projectInputDirectory, dependentFile));
if (Namespace == null)
Namespace = rootNamespace;
WriteLine(" Namespace is '" + Namespace + "'");
if (Namespace != null && Namespace.Length > 0) {
resourceOutputFile = Path.Combine(Path.GetDirectoryName(resourceFile),
Namespace + "." + Path.GetFileName(resourceFile));
} else {
resourceOutputFile = resourceFile;
}
return CopyResource(resourceFile, resourceOutputFile);
}
#region GetNamespace
// TODO: Get namespace using the parser, not with regular expressions.
/// <summary>Gets the class namespace from a piece of code.</summary>
/// <param name="code">The code to extract the namespace from.</param>
/// <returns>The namespace of the classes in the source code.</returns>
private string GetCSharpNamespace(string code)
{
// The regular expression that extracts the text
// "namespace Name {" from a code string.
string pattern = @"^[ \t]*namespace\s+([\w\d\.]+)\s*{";
Regex regex = new Regex(pattern, RegexOptions.Multiline);
Match match = regex.Match(code);
if (match.Success)
return match.Groups[1].Value;
else
return null;
}
/// <summary>Gets the class's namespace from a piece of code.</summary>
/// <param name="code">The code to extract the namespace from.</param>
/// <returns>The namespace of the classes in the source code.</returns>
private string GetVBNamespace(string code)
{
string pattern = @"^[ \t]*Namespace\s+([\w\d\.]+)[ \t]*$";
Regex regex = new Regex(pattern, RegexOptions.Multiline | RegexOptions.IgnoreCase);
Match match = regex.Match(code);
if (match.Success)
return match.Groups[1].Value;
else
return null;
}
/// <summary>
/// Gets the namespace of the first class specified in a file.
/// </summary>
/// <param name="filename">The filename to search for
/// a namespace.</param>
private string GetNamespaceFromFile(string filename)
{
try {
using (StreamReader reader = new StreamReader(filename, true)) {
string extension = Path.GetExtension(filename).ToLower();
if (extension == ".cs") {
return GetCSharpNamespace(reader.ReadToEnd());
} else if (extension == ".vb") {
return GetVBNamespace(reader.ReadToEnd());
}
return null;
}
} catch (Exception ex) {
WriteLine(ex.ToString());
return null;
}
}
#endregion
public string ImportResource(string resourceFile, string rootNamespace)
{
WriteLine("Import resource " + resourceFile + " (ns=" + rootNamespace + ")");
string resourceOutputFile = resourceFile;
if (!Path.IsPathRooted(resourceFile) && !resourceFile.StartsWith("..")) {
resourceOutputFile = resourceOutputFile.Replace(Path.DirectorySeparatorChar, '.');
resourceOutputFile = resourceOutputFile.Replace(Path.AltDirectorySeparatorChar, '.');
if (rootNamespace == null || rootNamespace.Length == 0)
resourceOutputFile = Path.Combine(Path.GetDirectoryName(resourceFile),
resourceOutputFile);
else
resourceOutputFile = Path.Combine(Path.GetDirectoryName(resourceFile),
rootNamespace + "." + resourceOutputFile);
} else {
if (rootNamespace == null || rootNamespace.Length == 0)
resourceOutputFile = Path.GetFileName(resourceFile);
else
resourceOutputFile = rootNamespace + "." + Path.GetFileName(resourceFile);
}
return CopyResource(resourceFile, resourceOutputFile);
}
private string CopyResource(string inputFile, string outputFile) {
inputFile = Path.Combine(this.projectInputDirectory, inputFile);
if (Path.GetExtension(outputFile).ToUpper() == ".RESX") {
outputFile = Path.ChangeExtension(outputFile, ".resources");
}
string outputFileFull = Path.Combine(this.projectOutputDirectory, outputFile);
WriteLine("Needed to copy file " + inputFile + " to " + outputFileFull);
copiedFiles.Add(new DictionaryEntry(inputFile, outputFileFull));
return (outputFile.StartsWith(".") ? "" : "." + Path.DirectorySeparatorChar) + outputFile;
}
}
}

251
src/AddIns/Misc/ProjectImporterExporter/Project/Converters/VSNet/SolutionInputConverter.cs

@ -1,251 +0,0 @@ @@ -1,251 +0,0 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
// <version value="$version"/>
// </file>
using System;
using System.Collections;
using System.Text;
using System.Text.RegularExpressions;
using System.IO;
using System.Windows.Forms;
using System.Reflection;
using System.Security.Permissions;
using System.Resources;
using System.Xml;
using System.Xml.Xsl;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop.Internal.Project;
using ICSharpCode.SharpDevelop.Gui;
using ICSharpCode.SharpDevelop.Commands;
using ICSharpCode.SharpDevelop.ProjectImportExporter.Converters;
using ICSharpCode.SharpDevelop.ProjectImportExporter.Dialogs;
namespace ICSharpCode.SharpDevelop.ProjectImportExporter.Converters
{
public class SolutionInputConverter : AbstractInputConverter
{
string projectTitle;
string projectInputDirectory;
string projectOutputDirectory;
string combineOutputFile;
public override string FormatName {
get {
return "Visual Studio.NET 7 / 2003 Solutions";
}
}
public override string OutputFile {
get {
return combineOutputFile;
}
}
public override bool CanConvert(string fileName)
{
string upperExtension = Path.GetExtension(fileName).ToUpper();
return upperExtension == ".SLN";
}
public override bool Convert(string solutionInputFile, string outputPath)
{
projectTitle = projectInputDirectory = projectOutputDirectory = combineOutputFile = null;
ArrayList projects = ReadSolution(solutionInputFile);
ArrayList convertedProjects = new ArrayList();
for (int i = 0; i < projects.Count; ++i) {
DictionaryEntry entry = (DictionaryEntry)projects[i];
this.projectTitle = entry.Key.ToString();
string projectFile = entry.Value.ToString();
string projectInputFile = Path.Combine(Path.GetDirectoryName(solutionInputFile), projectFile);
this.projectOutputDirectory = Path.Combine(outputPath, Path.GetDirectoryName(projectFile));
if (!File.Exists(projectFile)) {
using (ChooseProjectLocationDialog cpld = new ChooseProjectLocationDialog()) {
cpld.FileName = projectFile;
DialogResult res = cpld.ShowDialog(ICSharpCode.SharpDevelop.Gui.WorkbenchSingleton.MainForm);
if (res == DialogResult.OK) {
projectInputFile = projectFile = cpld.FileName;
this.projectOutputDirectory = Path.Combine(outputPath, Path.GetFileNameWithoutExtension(projectFile));
entry = new DictionaryEntry(entry.Key, Path.Combine(Path.GetFileNameWithoutExtension(projectFile), Path.ChangeExtension(Path.GetFileName(projectFile), ".prjx")));
projects[i] = entry;
} else {
continue;
}
}
}
string projectOutputFile = Path.Combine(projectOutputDirectory, Path.ChangeExtension(Path.GetFileName(projectFile), ".prjx"));
if (!Directory.Exists(projectOutputDirectory)) {
Directory.CreateDirectory(projectOutputDirectory);
}
this.projectInputDirectory = Path.GetDirectoryName(projectInputFile);
switch (Path.GetExtension(projectFile).ToUpper()) {
case ".VBPROJ":
ConvertProject(projectInputFile, projectOutputFile, "VBSolutionConversion.xsl");
convertedProjects.Add(entry);
break;
case ".CSPROJ":
ConvertProject(projectInputFile, projectOutputFile, "CSSolutionConversion.xsl");
convertedProjects.Add(entry);
break;
default:
StringParser.Properties["ProjectFile"] = projectFile;
MessageService.ShowError("${res:ICSharpCode.SharpDevelop.ProjectImportExporter.Converters.SolutionInputConverter.CantConvertProjectFileError}");
break;
}
}
combineOutputFile = Path.Combine(outputPath, Path.ChangeExtension(Path.GetFileName(solutionInputFile), ".cmbx"));
WriteCombine(combineOutputFile, convertedProjects);
return true;
}
void ConvertResource(string inputFile, string outputFile)
{
Hashtable resources = new Hashtable();
// read .resx file
try {
Stream s = File.OpenRead(inputFile);
ResXResourceReader rx = new ResXResourceReader(s);
IDictionaryEnumerator n = rx.GetEnumerator();
while (n.MoveNext()) {
if (!resources.ContainsKey(n.Key)) {
resources.Add(n.Key, n.Value);
}
}
rx.Close();
s.Close();
} catch (Exception e) {
MessageService.ShowError(e, "Can't read resource file " + inputFile +"\nCheck file existance.");
}
// write .resources file
try {
ResourceWriter rw = new ResourceWriter(outputFile);
foreach (DictionaryEntry entry in resources) {
rw.AddResource(entry.Key.ToString(), entry.Value);
}
rw.Generate();
rw.Close();
} catch (Exception e) {
MessageService.ShowError(e, "Can't generate resource file " + outputFile +"\nCheck for write permission.");
}
}
void ConvertProject(string inputFile, string outputFile, string resourceStreamFile)
{
SolutionConversionTool solutionConversionTool = new SolutionConversionTool(projectTitle, projectInputDirectory, projectOutputDirectory);
XsltArgumentList xsltArgumentList = new XsltArgumentList();
xsltArgumentList.AddParam("ProjectTitle", "", projectTitle);
xsltArgumentList.AddExtensionObject("urn:convtool", solutionConversionTool);
try {
ConvertXml.Convert(inputFile,
new XmlTextReader(new StreamReader(Assembly.GetCallingAssembly().GetManifestResourceStream(resourceStreamFile), Encoding.UTF8)),
outputFile,
xsltArgumentList);
} catch (XmlException) {
// try it again with the system encoding instead of UTF-8
ConvertXml.Convert(inputFile,
new XmlTextReader(new StreamReader(Assembly.GetCallingAssembly().GetManifestResourceStream(resourceStreamFile), Encoding.UTF8)),
outputFile,
xsltArgumentList,
Encoding.Default);
}
foreach (DictionaryEntry entry in solutionConversionTool.copiedFiles) {
string srcFile = entry.Key.ToString();
string dstFile = entry.Value.ToString();
if (File.Exists(srcFile)) {
if (!Directory.Exists(Path.GetDirectoryName(dstFile))) {
Directory.CreateDirectory(Path.GetDirectoryName(dstFile));
}
if (Path.GetExtension(srcFile).ToUpper() == ".RESX") {
ConvertResource(srcFile, dstFile);
} else {
if (srcFile.ToLower() == dstFile.ToLower()) continue;
try {
File.Copy(srcFile, dstFile, true);
File.SetAttributes(dstFile, FileAttributes.Normal);
} catch (Exception e) {
MessageService.ShowError(e, "Can't Copy file from " + srcFile +" to " + dstFile +". Copy it manually.");
}
}
}
}
solutionConversionTool.copiedFiles = new ArrayList();
}
ArrayList ReadSolution(string fileName)
{
StreamReader sr = File.OpenText(fileName);
Regex projectLinePattern = new Regex("Project\\(.*\\)\\s+=\\s+\"(?<Title>.*)\",\\s*\"(?<Location>.*)\",", RegexOptions.Compiled);
ArrayList projects = new ArrayList();
while (true) {
string line = sr.ReadLine();
if (line == null) {
break;
}
Match match = projectLinePattern.Match(line);
if (match.Success) {
projects.Add(new DictionaryEntry(match.Result("${Title}"), match.Result("${Location}")));
}
}
sr.Close();
return projects;
}
void WriteCombine(string fileName, ArrayList projects)
{
StreamWriter sw = File.CreateText(fileName);
sw.WriteLine("<Combine fileversion=\"1.0\" name=\"" + Path.GetFileNameWithoutExtension(fileName) + "\" description=\"Converted Visual Studio.NET Solution\">");
string firstEntry = null;
sw.WriteLine("<Entries>");
foreach (DictionaryEntry entry in projects) {
if (firstEntry == null) {
firstEntry = entry.Key.ToString();
}
sw.WriteLine("\t<Entry filename=\"." + Path.DirectorySeparatorChar + Path.ChangeExtension(entry.Value.ToString(), ".prjx") + "\" />");
}
sw.WriteLine("</Entries>");
sw.WriteLine("<StartMode startupentry=\"" + firstEntry + "\" single=\"True\"/>");
sw.WriteLine("<Configurations active=\"Debug\">");
sw.WriteLine("<Configuration name=\"Debug\">");
foreach (DictionaryEntry entry in projects) {
sw.WriteLine("\t<Entry name=\"" + entry.Key + "\" configurationname=\"Debug\" build=\"False\" />");
}
sw.WriteLine("</Configuration>");
sw.WriteLine("<Configuration name=\"Release\">");
foreach (DictionaryEntry entry in projects) {
sw.WriteLine("\t<Entry name=\"" + entry.Key + "\" configurationname=\"Release\" build=\"False\" />");
}
sw.WriteLine("</Configuration>");
sw.WriteLine("</Configurations>");
sw.WriteLine("</Combine>");
sw.Close();
}
}
}

199
src/AddIns/Misc/ProjectImporterExporter/Project/Converters/VSNet/SolutionOutputConverter.cs

@ -1,199 +0,0 @@ @@ -1,199 +0,0 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Mike Krueger" email="mike@icsharpcode.net"/>
// <version value="$version"/>
// </file>
using System;
using System.Collections;
using System.IO;
using System.Reflection;
using System.Xml;
using System.Xml.Xsl;
using ICSharpCode.SharpDevelop.Internal.Project;
using ICSharpCode.SharpDevelop.Gui;
namespace ICSharpCode.SharpDevelop.ProjectImportExporter.Converters
{
public class SolutionOutputConverter : AbstractOutputConverter
{
Hashtable GUIDHash = new Hashtable();
Hashtable typeGUIDHash = new Hashtable();
Hashtable configHash = new Hashtable();
static Hashtable projectTypeGUIDHash = new Hashtable();
static Hashtable languageNameHash = new Hashtable();
static SolutionOutputConverter()
{
projectTypeGUIDHash[".csproj"] = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}";
projectTypeGUIDHash[".vbproj"] = "{F184B08F-C81C-45F6-A57F-5ABD9991F28F}";
languageNameHash[".csproj"] = "CSHARP";
languageNameHash[".vbproj"] = "VisualBasic";
}
public override string FormatName {
get {
return "Visual Studio.NET 2003 Solutions";
}
}
string CreateGUID(string projectFileName)
{
string name = Path.GetFileNameWithoutExtension(projectFileName);
string result = (string)GUIDHash[name];
if (result == null) {
result = String.Concat('{', Guid.NewGuid().ToString().ToUpper(), '}');
GUIDHash[name] = result;
}
return result;
}
string GetVSNetProjectFileExtension(string projectFileName)
{
XmlTextReader reader = new XmlTextReader(projectFileName);
reader.MoveToContent();
if (reader.MoveToAttribute("projecttype")) {
switch (reader.Value) {
case "C#":
return ".csproj";
case "VBNET":
return ".vbproj";
default:
throw new System.NotSupportedException("Project type " + reader.Value + " is currently not supported.");
}
}
return ".csproj";
}
public override void ConvertCombine(IProgressMonitor progressMonitor, string inputCombine, string outputPath)
{
string inputPath = Path.GetFullPath(Path.GetDirectoryName(inputCombine));
Combine combine = new Combine();
combine.LoadCombine(inputCombine);
StreamWriter streamWriter = new StreamWriter(Path.Combine(outputPath, Path.ChangeExtension(Path.GetFileName(inputCombine), ".sln")));
streamWriter.WriteLine("Microsoft Visual Studio Solution File, Format Version 8.00");
ArrayList projects = Combine.GetAllProjects(combine);
if (progressMonitor != null) {
progressMonitor.BeginTask("Convert", projects.Count + 2);
}
foreach (ProjectCombineEntry project in projects) {
string projectFileName = Path.GetFullPath(Path.Combine(inputPath, project.Filename));
string relativeFileName = projectFileName.Substring(inputPath.Length + 1);
string newExtension = GetVSNetProjectFileExtension(projectFileName);
//CreateGUID(projectFileName);
streamWriter.WriteLine("Project(\"{3}\") = \"{1}\", \"{2}\", \"{0}\"",
CreateGUID(projectFileName),
project.Name,
Path.ChangeExtension(relativeFileName, newExtension),
projectTypeGUIDHash[newExtension]);
typeGUIDHash[Path.GetFileNameWithoutExtension(projectFileName)] = projectTypeGUIDHash[newExtension];
streamWriter.WriteLine("\tProjectSection(ProjectDependencies) = postProject");
streamWriter.WriteLine("\tEndProjectSection");
}
if (progressMonitor != null) {
progressMonitor.Worked(1);
}
foreach (ProjectCombineEntry project in projects) {
string projectFileName = Path.GetFullPath(Path.Combine(inputPath, project.Filename));
string relativeFileName = projectFileName.Substring(inputPath.Length + 1);
ConvertProject(null, projectFileName, Path.Combine(outputPath, Path.GetDirectoryName(relativeFileName)));
if (progressMonitor != null) {
progressMonitor.Worked(1);
}
}
streamWriter.WriteLine("EndProject");
streamWriter.WriteLine("Global");
streamWriter.WriteLine("\tGlobalSection(SolutionConfiguration) = preSolution");
SortedList allConfigs = new SortedList();
foreach (ProjectCombineEntry project in projects) {
string projectFileName = Path.GetFullPath(Path.Combine(inputPath, project.Filename));
foreach (string config in (ArrayList)configHash[projectFileName]) {
allConfigs[config] = "1";
}
}
foreach (DictionaryEntry entry in allConfigs) {
streamWriter.WriteLine("\t\t{0} = {0}", entry.Key);
}
streamWriter.WriteLine("\tEndGlobalSection");
streamWriter.WriteLine("\tGlobalSection(ProjectConfiguration) = postSolution");
foreach (ProjectCombineEntry project in projects) {
string projectFileName = Path.GetFullPath(Path.Combine(inputPath, project.Filename));
foreach (string config in (ArrayList)configHash[projectFileName]) {
string name = Path.GetFileNameWithoutExtension(projectFileName);
streamWriter.WriteLine("\t\t{0}.{1}.ActiveCfg = {1}|.NET", GUIDHash[name], config);
streamWriter.WriteLine("\t\t{0}.{1}.Build.0 = {1}|.NET", GUIDHash[name], config);
}
}
streamWriter.WriteLine("\tEndGlobalSection");
streamWriter.WriteLine("\tGlobalSection(ExtensibilityGlobals) = postSolution");
streamWriter.WriteLine("\tEndGlobalSection");
streamWriter.WriteLine("\tGlobalSection(ExtensibilityAddIns) = postSolution");
streamWriter.WriteLine("\tEndGlobalSection");
streamWriter.WriteLine("EndGlobal");
streamWriter.Close();
if (progressMonitor != null) {
progressMonitor.Done();
}
}
public override void ConvertProject(IProgressMonitor progressMonitor, string inputProject, string outputPath)
{
if (progressMonitor != null) {
progressMonitor.BeginTask("Convert", 3);
}
string newExtension = GetVSNetProjectFileExtension(inputProject);
string frameworkPath = System.Runtime.InteropServices.RuntimeEnvironment.GetRuntimeDirectory();
if (!frameworkPath.EndsWith(Path.DirectorySeparatorChar.ToString()))
frameworkPath += Path.DirectorySeparatorChar;
XsltArgumentList xsltArgumentList = new XsltArgumentList();
xsltArgumentList.AddParam("LanguageName", "", languageNameHash[newExtension]);
xsltArgumentList.AddParam("FrameworkPath", "", frameworkPath);
SolutionOutputConverterTool solutionConversionTool = new SolutionOutputConverterTool();
solutionConversionTool.projectGUIDHash = GUIDHash;
solutionConversionTool.projectTypeGUIDHash = projectTypeGUIDHash;
xsltArgumentList.AddExtensionObject("urn:convtool", solutionConversionTool);
string outputFile = Path.Combine(outputPath, Path.ChangeExtension(Path.GetFileName(inputProject), newExtension));
if (!Directory.Exists(Path.GetDirectoryName(outputFile))) {
Directory.CreateDirectory(Path.GetDirectoryName(outputFile));
}
if (progressMonitor != null) {
progressMonitor.Worked(1);
}
ConvertXml.Convert(inputProject,
new XmlTextReader(Assembly.GetCallingAssembly().GetManifestResourceStream("ProjectToVSNetProjectConversion.xsl")),
outputFile,
xsltArgumentList);
if (progressMonitor != null) {
progressMonitor.Worked(1);
}
foreach (string fileName in solutionConversionTool.copiedFiles) {
string srcFile = Path.Combine(Path.GetDirectoryName(inputProject), fileName);
string dstFile = Path.Combine(outputPath, fileName);
if (srcFile.ToLower() == dstFile.ToLower()) continue;
if (File.Exists(srcFile)) {
if (!Directory.Exists(Path.GetDirectoryName(dstFile))) {
Directory.CreateDirectory(Path.GetDirectoryName(dstFile));
}
File.Copy(srcFile, dstFile, true);
File.SetAttributes(dstFile, FileAttributes.Normal);
}
}
configHash[inputProject] = solutionConversionTool.configurations;
if (progressMonitor != null) {
progressMonitor.Done();
}
}
}
}

91
src/AddIns/Misc/ProjectImporterExporter/Project/Converters/VSNet/SolutionOutputConverterTool.cs

@ -1,91 +0,0 @@ @@ -1,91 +0,0 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
// <version value="$version"/>
// </file>
using System;
using System.Collections;
using System.IO;
using System.Text;
using System.Security;
using System.Security.Permissions;
using System.Windows.Forms;
using MSjogren.GacTool.FusionNative;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop.ProjectImportExporter.Commands;
namespace ICSharpCode.SharpDevelop.ProjectImportExporter.Converters
{
public class SolutionOutputConverterTool
{
public ArrayList copiedFiles = new ArrayList();
public ArrayList configurations = new ArrayList();
public Hashtable projectGUIDHash;
public Hashtable projectTypeGUIDHash;
public string AddConfig(string config)
{
configurations.Add(config);
return config;
}
public string VerifyFileLocation(string itemFile)
{
if (itemFile.Length == 0) {
return String.Empty;
}
copiedFiles.Add(itemFile);
if (itemFile.StartsWith(@".\")) {
itemFile = itemFile.Substring(2);
}
return itemFile;
}
public string ConvertBuildAction(string buildAction)
{
switch (buildAction) {
case "EmbedAsResource":
return "EmbeddedResource";
}
return buildAction;
}
public string FileNameWithoutExtension(string txt)
{
return Path.GetFileNameWithoutExtension(txt);
}
public string Negate(string txt)
{
if (txt.ToUpper() == "TRUE") {
return false.ToString();
}
return true.ToString();
}
public string GetProjectGUID(string projectFileName)
{
string result = (string)projectGUIDHash[projectFileName];
if (result == null) {
result = String.Concat('{', Guid.NewGuid().ToString().ToUpper(), '}');
projectGUIDHash[projectFileName] = result;
}
return result;
}
public string GetPackageGUID(string projectFileName)
{
string result = (string)projectTypeGUIDHash[projectFileName];
if (result == null) {
result = String.Concat('{', Guid.NewGuid().ToString().ToUpper(), '}');
projectTypeGUIDHash[projectFileName] = result;
}
return result;
}
}
}

168
src/AddIns/Misc/ProjectImporterExporter/Project/Converters/VSNet/VSProjectInputConverter.cs

@ -1,168 +0,0 @@ @@ -1,168 +0,0 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
// <version value="$version"/>
// </file>
using System;
using System.Collections;
using System.Text;
using System.Text.RegularExpressions;
using System.IO;
using System.Windows.Forms;
using System.Reflection;
using System.Security.Permissions;
using System.Resources;
using System.Xml;
using System.Xml.Xsl;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop.Internal.Project;
using ICSharpCode.SharpDevelop.Gui;
using ICSharpCode.SharpDevelop.Commands;
using ICSharpCode.SharpDevelop.ProjectImportExporter.Converters;
using ICSharpCode.SharpDevelop.ProjectImportExporter.Dialogs;
namespace ICSharpCode.SharpDevelop.ProjectImportExporter.Converters
{
public class VSProjectInputConverter : AbstractInputConverter
{
string projectTitle;
string projectInputDirectory;
string combineOutputFile;
string projectOutputDirectory;
public override string FormatName {
get {
return "Visual Studio.NET 7 / 2003 C# and VB.NET Projects";
}
}
public override string OutputFile {
get {
return combineOutputFile;
}
}
public override bool CanConvert(string fileName)
{
string upperExtension = Path.GetExtension(fileName).ToUpper();
return upperExtension == ".VBPROJ" || upperExtension == ".CSPROJ";
}
public override bool Convert(string solutionInputFile, string outputPath)
{
this.projectOutputDirectory = outputPath;
string projectOutputFile = Path.Combine(projectOutputDirectory, Path.ChangeExtension(Path.GetFileName(solutionInputFile), ".prjx"));
projectTitle = Path.GetFileNameWithoutExtension(solutionInputFile);
projectInputDirectory = Path.GetDirectoryName(solutionInputFile);
combineOutputFile = Path.Combine(outputPath, Path.ChangeExtension(Path.GetFileName(solutionInputFile), ".prjx"));
switch (Path.GetExtension(solutionInputFile).ToUpper()) {
case ".VBPROJ":
ConvertProject(solutionInputFile, projectOutputFile, "VBSolutionConversion.xsl");
break;
case ".CSPROJ":
ConvertProject(solutionInputFile, projectOutputFile, "CSSolutionConversion.xsl");
break;
default:
MessageService.ShowError("${res:ICSharpCode.SharpDevelop.ProjectImportExporter.Converters.SolutionInputConverter.CantConvertProjectFileError}");
break;
}
return true;
}
void ConvertProject(string inputFile, string outputFile, string resourceStreamFile)
{
SolutionConversionTool solutionConversionTool = new SolutionConversionTool(projectTitle, projectInputDirectory, projectOutputDirectory);
XsltArgumentList xsltArgumentList = new XsltArgumentList();
xsltArgumentList.AddParam("ProjectTitle", "", projectTitle);
xsltArgumentList.AddExtensionObject("urn:convtool", solutionConversionTool);
try {
ConvertXml.Convert(inputFile,
new XmlTextReader(new StreamReader(Assembly.GetCallingAssembly().GetManifestResourceStream(resourceStreamFile), Encoding.UTF8)),
outputFile,
xsltArgumentList);
} catch (XmlException) {
// try it again with the system encoding instead of UTF-8
ConvertXml.Convert(inputFile,
new XmlTextReader(new StreamReader(Assembly.GetCallingAssembly().GetManifestResourceStream(resourceStreamFile), Encoding.UTF8)),
outputFile,
xsltArgumentList,
Encoding.Default);
}
foreach (DictionaryEntry entry in solutionConversionTool.copiedFiles) {
string srcFile = entry.Key.ToString();
string dstFile = entry.Value.ToString();
if (File.Exists(srcFile)) {
if (!Directory.Exists(Path.GetDirectoryName(dstFile))) {
Directory.CreateDirectory(Path.GetDirectoryName(dstFile));
}
if (Path.GetExtension(srcFile).ToUpper() == ".RESX") {
ConvertResource(srcFile, dstFile);
} else {
if (srcFile.ToLower() == dstFile.ToLower()) continue;
try {
File.Copy(srcFile, dstFile, true);
File.SetAttributes(dstFile, FileAttributes.Normal);
} catch (Exception e) {
MessageService.ShowError(e, "Can't Copy file from " + srcFile +" to " + dstFile +". Copy it manually.");
}
}
}
}
solutionConversionTool.copiedFiles = new ArrayList();
}
void ConvertResource(string inputFile, string outputFile)
{
Hashtable resources = new Hashtable();
// read .resx file
try {
Stream s = File.OpenRead(inputFile);
ResXResourceReader rx = new ResXResourceReader(s);
IDictionaryEnumerator n = rx.GetEnumerator();
while (n.MoveNext()) {
if (!resources.ContainsKey(n.Key)) {
resources.Add(n.Key, n.Value);
}
}
rx.Close();
s.Close();
} catch (Exception e) {
MessageService.ShowError(e, "Can't read resource file " + inputFile +"\nCheck file existance.");
}
// write .resources file
try {
ResourceWriter rw = new ResourceWriter(outputFile);
foreach (DictionaryEntry entry in resources) {
rw.AddResource(entry.Key.ToString(), entry.Value);
}
rw.Generate();
rw.Close();
} catch (Exception e) {
MessageService.ShowError(e, "Can't generate resource file " + outputFile +"\nCheck for write permission.");
}
}
}
}

66
src/AddIns/Misc/ProjectImporterExporter/Project/Dialogs/ChooseProjectLocationDialog.cs

@ -1,66 +0,0 @@ @@ -1,66 +0,0 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Mike Krueger" email="mike@icsharpcode.net"/>
// <version value="$version"/>
// </file>
using System;
using System.Collections;
using System.Reflection;
using System.Windows.Forms;
using ICSharpCode.SharpDevelop.Internal.Project;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop.Gui;
using ICSharpCode.SharpDevelop.Gui.XmlForms;
using ICSharpCode.SharpDevelop.ProjectImportExporter.Converters;
namespace ICSharpCode.SharpDevelop.ProjectImportExporter.Dialogs
{
public class ChooseProjectLocationDialog : BaseSharpDevelopForm
{
public string FileName {
get {
return ControlDictionary["fileNameTextBox"].Text;
}
set {
ControlDictionary["fileNameTextBox"].Text = value;
}
}
public ChooseProjectLocationDialog()
{
SetupFromXmlStream(Assembly.GetCallingAssembly().GetManifestResourceStream("ChooseProjectLocationDialog.xfrm"));
Icon = null;
ControlDictionary["okButton"].Click += new EventHandler(OkButtonClick);
ControlDictionary["browseButton"].Click += new EventHandler(BrowseProject);
}
void OkButtonClick(object sender, EventArgs e)
{
if (!FileUtilityService.IsValidFileName(FileName)) {
MessageService.ShowError("${res:ICSharpCode.SharpDevelop.ProjectImportExporter.Dialogs.ImportProjectDialog.InputFileInvalidError}");
return;
}
if (FileUtilityService.TestFileExists(FileName)) {
DialogResult = DialogResult.OK;
}
}
void BrowseProject(object sender, EventArgs e)
{
using (OpenFileDialog fdiag = new OpenFileDialog()) {
fdiag.AddExtension = true;
fdiag.Filter = StringParser.Parse("${res:SharpDevelop.FileFilter.AllFiles}|*.*");
fdiag.Multiselect = false;
fdiag.CheckFileExists = true;
if (fdiag.ShowDialog(ICSharpCode.SharpDevelop.Gui.WorkbenchSingleton.MainForm) == DialogResult.OK) {
ControlDictionary["fileNameTextBox"].Text = fdiag.FileName;
}
}
}
}
}

179
src/AddIns/Misc/ProjectImporterExporter/Project/Dialogs/ExportProjectDialog.cs

@ -1,179 +0,0 @@ @@ -1,179 +0,0 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Mike Krueger" email="mike@icsharpcode.net"/>
// <version value="$version"/>
// </file>
using System;
using System.Collections;
using System.Reflection;
using System.Windows.Forms;
using ICSharpCode.SharpDevelop.Internal.Project;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop.Gui;
using ICSharpCode.SharpDevelop.Gui.XmlForms;
using ICSharpCode.SharpDevelop.ProjectImportExporter.Converters;
namespace ICSharpCode.SharpDevelop.ProjectImportExporter.Dialogs
{
public class ExportProjectDialog : BaseSharpDevelopForm, IProgressMonitor
{
ArrayList outputConvertes;
public ExportProjectDialog() : this(null, null)
{
}
public ExportProjectDialog(string formatName) : this(formatName, null)
{
}
public ExportProjectDialog(string formatName, string projectName)
{
SetupFromXmlStream(Assembly.GetCallingAssembly().GetManifestResourceStream("ExportProjectDialog.xfrm"));
Icon = null;
ControlDictionary["outputLocationBrowseButton"].Click += new EventHandler(BrowseOutputLocation);
ControlDictionary["startButton"].Click += new EventHandler(StartConversion);
outputConvertes = RetrieveOutputConverters();
FillOutputFormat(formatName);
FillProjectList(projectName);
((RadioButton)ControlDictionary["singleProjectRadioButton"]).CheckedChanged += new EventHandler(RadioButtonChecked);
((RadioButton)ControlDictionary["wholeCombineRadioButton"]).CheckedChanged += new EventHandler(RadioButtonChecked);
RadioButtonChecked(null, null);
ControlDictionary["outputLocationTextBox"].Text = PropertyService.Get("ICSharpCode.SharpDevelop.ProjectImportExporter.Dialogs.ExportProjectDialog.OutputPath", "C:\\output");
}
void FillOutputFormat(string formatName)
{
int index = 0;
for (int i = 0; i < outputConvertes.Count; ++i) {
AbstractOutputConverter outputConverter = (AbstractOutputConverter)outputConvertes[i];
((ComboBox)ControlDictionary["outputFormatComboBox"]).Items.Add(StringParser.Parse(outputConverter.FormatName));
if (formatName == outputConverter.FormatName) {
index = i;
}
}
((ComboBox)ControlDictionary["outputFormatComboBox"]).SelectedIndex = index;
}
void FillProjectList(string projectName)
{
IProjectService projectService = (IProjectService)ICSharpCode.Core.ServiceManager.Services.GetService(typeof(IProjectService));
if (projectService.CurrentOpenCombine == null) {
return;
}
ArrayList allProjects = Combine.GetAllProjects(projectService.CurrentOpenCombine);
int index = 0;
for (int i = 0; i < allProjects.Count; ++i) {
ProjectCombineEntry entry = (ProjectCombineEntry)allProjects[i];
((ComboBox)ControlDictionary["projectListComboBox"]).Items.Add(entry.Project.Name);
if (entry.Project.Name == projectName) {
index = i;
((RadioButton)ControlDictionary["singleProjectRadioButton"]).Checked = true;
}
}
if (allProjects.Count > 0) {
((ComboBox)ControlDictionary["projectListComboBox"]).SelectedIndex = index;
}
}
void RadioButtonChecked(object sender, EventArgs e)
{
SetEnabledStatus(((RadioButton)ControlDictionary["singleProjectRadioButton"]).Checked, "projectListComboBox");
}
ArrayList RetrieveOutputConverters()
{
ArrayList converters = new ArrayList();
Assembly asm = Assembly.GetCallingAssembly();
foreach (Type t in asm.GetTypes()) {
if (!t.IsAbstract && t.IsSubclassOf(typeof(AbstractOutputConverter))) {
converters.Add(asm.CreateInstance(t.FullName));
}
}
return converters;
}
void BrowseOutputLocation(object sender, EventArgs e)
{
FolderDialog fd = new FolderDialog();
if (fd.DisplayDialog("Choose combine output location.") == DialogResult.OK) {
ControlDictionary["outputLocationTextBox"].Text = fd.Path;
}
}
void StartConversion(object sender, EventArgs e)
{
string outputPath = ControlDictionary["outputLocationTextBox"].Text;
if (!FileUtilityService.IsValidFileName(outputPath)) {
MessageService.ShowError("${res:ICSharpCode.SharpDevelop.ProjectImportExporter.Dialogs.ImportProjectDialog.OutputFileInvalidError}");
return;
}
if (!FileUtilityService.IsDirectory(outputPath)) {
MessageService.ShowError("${res:ICSharpCode.SharpDevelop.ProjectImportExporter.Dialogs.ImportProjectDialog.OutputPathDoesntExistError}");
return;
}
IProjectService projectService = (IProjectService)ICSharpCode.Core.ServiceManager.Services.GetService(typeof(IProjectService));
AbstractOutputConverter outputConverter = (AbstractOutputConverter)outputConvertes[((ComboBox)ControlDictionary["outputFormatComboBox"]).SelectedIndex];
if (((RadioButton)ControlDictionary["singleProjectRadioButton"]).Checked) {
ArrayList allProjects = Combine.GetAllProjects(projectService.CurrentOpenCombine);
IProject project = ((ProjectCombineEntry)allProjects[((ComboBox)ControlDictionary["projectListComboBox"]).SelectedIndex]).Project;
outputConverter.ConvertProject(this, projectService.GetFileName(project), outputPath);
} else {
outputConverter.ConvertCombine(this, projectService.GetFileName(projectService.CurrentOpenCombine), outputPath);
}
MessageService.ShowMessage("${res:ICSharpCode.SharpDevelop.ProjectImportExporter.Dialogs.ExportProjectDialog.ConversionDoneMessage}");
PropertyService.Set("ICSharpCode.SharpDevelop.ProjectImportExporter.Dialogs.ExportProjectDialog.OutputPath", ControlDictionary["outputLocationTextBox"].Text);
}
#region IProgressMonitor interface
int curWork = 0;
public void BeginTask(string name, int totalWork)
{
((ProgressBar)ControlDictionary["progressBar"]).Minimum = 0;
((ProgressBar)ControlDictionary["progressBar"]).Maximum = totalWork;
((ProgressBar)ControlDictionary["progressBar"]).Value = curWork = 0;
}
public void Worked(int work)
{
curWork += work;
((ProgressBar)ControlDictionary["progressBar"]).Value = curWork;
}
public void Done()
{
((ProgressBar)ControlDictionary["progressBar"]).Value = ((ProgressBar)ControlDictionary["progressBar"]).Maximum;
}
public bool Canceled {
get {
return false;
}
set {
}
}
public string TaskName {
get {
return "Export";
}
set {
}
}
#endregion
}
}

123
src/AddIns/Misc/ProjectImporterExporter/Project/Dialogs/ImportProjectDialog.cs

@ -1,123 +0,0 @@ @@ -1,123 +0,0 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Mike Krger" email="mike@icsharpcode.net"/>
// <version value="$version"/>
// </file>
using System;
using System.IO;
using System.Collections;
using System.Reflection;
using System.Windows.Forms;
using ICSharpCode.SharpDevelop.Gui;
using ICSharpCode.SharpDevelop.Gui.XmlForms;
using ICSharpCode.SharpDevelop.ProjectImportExporter.Converters;
using ICSharpCode.Core;
namespace ICSharpCode.SharpDevelop.ProjectImportExporter.Dialogs
{
public class ImportProjectDialog : BaseSharpDevelopForm
{
ArrayList inputConvertes;
public ImportProjectDialog()
{
SetupFromXmlStream(Assembly.GetCallingAssembly().GetManifestResourceStream("ImportProjectDialog.xfrm"));
Icon = null;
ControlDictionary["startButton"].Click += new EventHandler(StartConversion);
ControlDictionary["projectBrowseButton"].Click += new EventHandler(BrowseProject);
ControlDictionary["outputLocationBrowseButton"].Click += new EventHandler(BrowseOutputLocation);
inputConvertes = RetrieveInputConverters();
foreach (AbstractInputConverter converter in inputConvertes) {
((RichTextBox)ControlDictionary["formatsRichTextBox"]).AppendText(StringParser.Parse(converter.FormatName) + Environment.NewLine);
}
}
ArrayList RetrieveInputConverters()
{
ArrayList converters = new ArrayList();
Assembly asm = Assembly.GetCallingAssembly();
foreach (Type t in asm.GetTypes()) {
if (!t.IsAbstract && t.IsSubclassOf(typeof(AbstractInputConverter))) {
converters.Add(asm.CreateInstance(t.FullName));
}
}
return converters;
}
void BrowseProject(object sender, EventArgs e)
{
using (OpenFileDialog fdiag = new OpenFileDialog()) {
fdiag.AddExtension = true;
fdiag.Filter = StringParser.Parse("${res:SharpDevelop.FileFilter.VSNetSolutionFiles}|*.sln;*.csproj;*.vbproj|${res:SharpDevelop.FileFilter.BorlandStudioFiles}|*.bdsproj;*.bdsgroup|${res:SharpDevelop.FileFilter.AllFiles}|*.*");
fdiag.Multiselect = false;
fdiag.CheckFileExists = true;
if (fdiag.ShowDialog(ICSharpCode.SharpDevelop.Gui.WorkbenchSingleton.MainForm) == DialogResult.OK) {
ControlDictionary["projectTextBox"].Text = fdiag.FileName;
string projectDefaultPath = PropertyService.Get("ICSharpCode.SharpDevelop.Gui.NewProjectDialog.DefaultPath", Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal), "SharpDevelop Projects"));
ControlDictionary["outputLocationTextBox"].Text = Path.Combine(projectDefaultPath, Path.GetFileNameWithoutExtension(fdiag.FileName));
}
}
}
void BrowseOutputLocation(object sender, EventArgs e)
{
FolderDialog fd = new FolderDialog();
if (fd.DisplayDialog("Choose combine output location.") == DialogResult.OK) {
ControlDictionary["outputLocationTextBox"].Text = fd.Path;
}
}
void StartConversion(object sender, EventArgs e)
{
string inputFile = ControlDictionary["projectTextBox"].Text;
string outputPath = ControlDictionary["outputLocationTextBox"].Text;
if (!FileUtilityService.IsValidFileName(inputFile)) {
MessageService.ShowError("${res:ICSharpCode.SharpDevelop.ProjectImportExporter.Dialogs.ImportProjectDialog.InputFileInvalidError}");
return;
}
if (!FileUtilityService.IsValidFileName(outputPath)) {
MessageService.ShowError("${res:ICSharpCode.SharpDevelop.ProjectImportExporter.Dialogs.ImportProjectDialog.OutputFileInvalidError}");
return;
}
try {
if (!Directory.Exists(outputPath)) {
Directory.CreateDirectory(outputPath);
}
} catch (Exception) {}
if (!FileUtilityService.IsDirectory(outputPath)) {
MessageService.ShowError("${res:ICSharpCode.SharpDevelop.ProjectImportExporter.Dialogs.ImportProjectDialog.OutputPathDoesntExistError}");
return;
}
if (FileUtilityService.TestFileExists(inputFile)) {
foreach (AbstractInputConverter converter in inputConvertes) {
if (converter.CanConvert(inputFile)) {
if (converter.Convert(inputFile, outputPath)) {
MessageService.ShowMessage("${res:ICSharpCode.SharpDevelop.ProjectImportExporter.Dialogs.ImportProjectDialog.ConversionDoneMessage}");
DialogResult = DialogResult.OK;
if (((CheckBox) ControlDictionary["openAfterImportCheckBox"]).Checked) {
IProjectService projectService = (IProjectService)ICSharpCode.Core.ServiceManager.Services.GetService(typeof(IProjectService));
projectService.OpenCombine(converter.OutputFile);
}
}
return;
}
}
MessageService.ShowError("${res:ICSharpCode.SharpDevelop.ProjectImportExporter.Dialogs.ImportProjectDialog.NoConverterFoundError}");
}
}
}
}

133
src/AddIns/Misc/ProjectImporterExporter/Project/Resources/CSSolutionConversion.xsl

@ -1,133 +0,0 @@ @@ -1,133 +0,0 @@
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:convtool="urn:convtool">
<xsl:param name="ProjectTitle"/>
<xsl:template match="/VisualStudioProject/CSHARP">
<Project name = "{$ProjectTitle}"
standardNamespace="{Build/Settings/@RootNamespace}"
description = ""
newfilesearch = "None"
enableviewstate = "True"
version = "1.1"
projecttype = "C#">
<!-- Transform Contents -->
<Contents>
<xsl:for-each select="Files/Include/File[@BuildAction ='Compile']">
<xsl:choose>
<xsl:when test="@Link">
<File name = "{convtool:VerifyFileLocation(@Link)}"
buildaction="Compile"
subtype = "Code"/>
</xsl:when>
<xsl:otherwise>
<File name = "{convtool:VerifyFileLocation(@RelPath)}"
buildaction="Compile"
subtype = "Code"/>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
<!-- convert 'resources' -->
<xsl:for-each select="Files/Include/File[@BuildAction ='EmbeddedResource']">
<xsl:choose>
<xsl:when test="@Link">
<xsl:choose>
<xsl:when test="@DependentUpon">
<File name = "{convtool:ImportDependentResource(@Link,@DependentUpon,/VisualStudioProject/CSHARP/Build/Settings/@RootNamespace)}"
buildaction="EmbedAsResource"
subtype = "Code"/>
</xsl:when>
<xsl:otherwise>
<File name = "{convtool:ImportResource(@Link,/VisualStudioProject/CSHARP/Build/Settings/@RootNamespace)}"
buildaction="EmbedAsResource"
subtype = "Code"/>
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise>
<xsl:choose>
<xsl:when test="@DependentUpon">
<File name = "{convtool:ImportDependentResource(@RelPath,@DependentUpon,/VisualStudioProject/CSHARP/Build/Settings/@RootNamespace)}"
buildaction="EmbedAsResource"
subtype = "Code"/>
</xsl:when>
<xsl:otherwise>
<File name = "{convtool:ImportResource(@RelPath,/VisualStudioProject/CSHARP/Build/Settings/@RootNamespace)}"
buildaction="EmbedAsResource"
subtype = "Code"/>
</xsl:otherwise>
</xsl:choose>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
<!-- Non-buildable files part of the project -->
<xsl:for-each select="Files/Include/File[(@BuildAction ='None') or (@BuildAction ='Content')]">
<xsl:choose>
<xsl:when test="@Link">
<File name = "{convtool:VerifyFileLocation(@Link)}"
buildaction="Nothing"
subtype = "Code"/>
</xsl:when>
<xsl:otherwise>
<File name = "{convtool:VerifyFileLocation(@RelPath)}"
buildaction="Nothing"
subtype = "Code"/>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</Contents>
<DeploymentInformation target="" script="" strategy="File" />
<!-- Transform Settings -->
<xsl:apply-templates select="Build/Settings"/>
<!-- Transform References -->
<xsl:apply-templates select="Build/References"/>
</Project>
</xsl:template>
<!-- Transform settings (easy) -->
<xsl:template match="Settings">
<Configurations active="Debug">
<xsl:for-each select="Config">
<Configuration runwithwarnings="{convtool:Negate(@TreatWarningsAsErrors)}" name="{@Name}">
<CodeGeneration runtime="MsNet"
compiler="Csc"
warninglevel="{@WarningLevel}"
includedebuginformation="{convtool:EnsureBool(@DebugSymbols)}"
optimize="{convtool:EnsureBool(@Optimize)}"
unsafecodeallowed="{convtool:EnsureBool(@AllowUnsafeBlocks)}"
generateoverflowchecks="{convtool:EnsureBool(@CheckForOverflowUnderflow)}"
mainclass="{../@StartupObject}"
target="{../@OutputType}"
definesymbols="{@DefineConstants}"
generatexmldocumentation="False"
win32Icon="{convtool:VerifyFileLocation(../@ApplicationIcon)}" />
<Execution commandlineparameters=""
consolepause="True" />
<Output directory="{convtool:VerifyFileLocation(@OutputPath)}"
assembly="{../@AssemblyName}" />
</Configuration>
</xsl:for-each>
</Configurations>
</xsl:template>
<!-- Transform references (a bit like frungy) -->
<xsl:template match="References">
<References>
<xsl:for-each select="Reference[@AssemblyName]">
<xsl:if test="convtool:ShouldGenerateReference('True', @AssemblyName, @HintPath)">
<Reference type = "{convtool:GenerateReferenceType(@AssemblyName, @HintPath)}"
refto = "{convtool:GenerateReference(@AssemblyName, @HintPath)}"/>
</xsl:if>
</xsl:for-each>
<xsl:for-each select="Reference[@Project]">
<Reference type = "Project"
refto = "{@Name}"/>
</xsl:for-each>
</References>
</xsl:template>
</xsl:stylesheet>

57
src/AddIns/Misc/ProjectImporterExporter/Project/Resources/ChooseProjectLocationDialog.xfrm

@ -1,57 +0,0 @@ @@ -1,57 +0,0 @@
<Components version="1.0">
<System.Windows.Forms.Form>
<Name value="XmlForm1" />
<ShowInTaskbar value="False" />
<FormBorderStyle value="FixedDialog" />
<ClientSize value="{Width=456, Height=90}" />
<MinimizeBox value="False" />
<DockPadding value="" />
<Text value="${res:ICSharpCode.SharpDevelop.ProjectImportExporter.Dialogs.ChooseProjectLocation.DialogName}" />
<AcceptButton value="okButton [System.Windows.Forms.Button], Text: ${res:Global.OKButtonText}" />
<CancelButton value="cancelButton [System.Windows.Forms.Button], Text: ${res:Global.CancelButtonText}" />
<Controls>
<System.Windows.Forms.Button>
<Name value="cancelButton" />
<Location value="{X=376,Y=64}" />
<Size value="{Width=72, Height=23}" />
<Text value="${res:Global.CancelButtonText}" />
<Anchor value="Bottom, Right" />
<TabIndex value="4" />
<DialogResult value="Cancel" />
</System.Windows.Forms.Button>
<System.Windows.Forms.Button>
<Name value="okButton" />
<Location value="{X=296,Y=64}" />
<Size value="{Width=72, Height=23}" />
<Text value="${res:Global.OKButtonText}" />
<Anchor value="Bottom, Right" />
<TabIndex value="1" />
</System.Windows.Forms.Button>
<System.Windows.Forms.Button>
<Name value="browseButton" />
<Location value="{X=416,Y=32}" />
<Size value="{Width=32, Height=23}" />
<Text value="..." />
<Anchor value="Top, Right" />
<TabIndex value="3" />
</System.Windows.Forms.Button>
<System.Windows.Forms.TextBox>
<Name value="fileNameTextBox" />
<Anchor value="Top, Left, Right" />
<TabIndex value="2" />
<Location value="{X=0,Y=32}" />
<Size value="{Width=408, Height=20}" />
<Text value="" />
</System.Windows.Forms.TextBox>
<System.Windows.Forms.Label>
<Name value="label1" />
<Text value="${res:ICSharpCode.SharpDevelop.ProjectImportExporter.Dialogs.ChooseProjectLocation.DescriptionLabel}" />
<TextAlign value="BottomLeft" />
<Anchor value="Top, Left, Right" />
<TabIndex value="0" />
<Size value="{Width=448, Height=24}" />
<Location value="{X=0,Y=8}" />
</System.Windows.Forms.Label>
</Controls>
</System.Windows.Forms.Form>
</Components>

139
src/AddIns/Misc/ProjectImporterExporter/Project/Resources/ExportProjectDialog.xfrm

@ -1,139 +0,0 @@ @@ -1,139 +0,0 @@
<Components version="1.0">
<System.Windows.Forms.Form>
<Name value="MyForm" />
<ShowInTaskbar value="False" />
<FormBorderStyle value="FixedDialog" />
<StartPosition value="CenterParent" />
<ClientSize value="{Width=570, Height=288}" />
<MinimizeBox value="False" />
<DockPadding value="" />
<Text value="${res:AddIns.ProjectImportExporter.ExportProjectDialog.DialogName}" />
<AcceptButton value="startButton [System.Windows.Forms.Button], Text: ${res:Global.StartButtonText}" />
<CancelButton value="cancelButton [System.Windows.Forms.Button], Text: ${res:Global.CancelButtonText}" />
<MaximizeBox value="False" />
<Controls>
<System.Windows.Forms.Button>
<Name value="button1" />
<Location value="{X=16,Y=240}" />
<Size value="{Width=16, Height=16}" />
<Text value="+" />
<TabIndex value="8" />
</System.Windows.Forms.Button>
<System.Windows.Forms.Label>
<Name value="label2" />
<Text value="Export progress:" />
<TextAlign value="BottomLeft" />
<Anchor value="Top, Left, Right" />
<TabIndex value="6" />
<Size value="{Width=544, Height=16}" />
<Location value="{X=16,Y=192}" />
</System.Windows.Forms.Label>
<System.Windows.Forms.GroupBox>
<Name value="groupBox" />
<TabIndex value="5" />
<Location value="{X=16,Y=72}" />
<Anchor value="Top, Left, Right" />
<Size value="{Width=544, Height=112}" />
<Text value="${res:AddIns.ProjectImportExporter.ExportProjectDialog.ExportGroupBox}" />
<Controls>
<System.Windows.Forms.ComboBox>
<Name value="projectListComboBox" />
<Anchor value="Top, Left, Right" />
<TabIndex value="2" />
<Location value="{X=24,Y=83}" />
<Size value="{Width=516, Height=21}" />
<DropDownStyle value="DropDownList" />
</System.Windows.Forms.ComboBox>
<System.Windows.Forms.RadioButton>
<Name value="singleProjectRadioButton" />
<Location value="{X=8,Y=54}" />
<Size value="{Width=528, Height=24}" />
<Text value="${res:AddIns.ProjectImportExporter.ExportProjectDialog.SingleProjectComboBox}" />
<Anchor value="Top, Left, Right" />
<TabIndex value="1" />
</System.Windows.Forms.RadioButton>
<System.Windows.Forms.RadioButton>
<Name value="wholeCombineRadioButton" />
<Location value="{X=8,Y=30}" />
<Checked value="True" />
<Size value="{Width=528, Height=24}" />
<Text value="${res:AddIns.ProjectImportExporter.ExportProjectDialog.WholeCombineComboBox}" />
<TabStop value="True" />
<Anchor value="Top, Left, Right" />
<TabIndex value="0" />
</System.Windows.Forms.RadioButton>
</Controls>
</System.Windows.Forms.GroupBox>
<System.Windows.Forms.ComboBox>
<Name value="outputFormatComboBox" />
<Anchor value="Top, Left, Right" />
<TabIndex value="4" />
<Location value="{X=152,Y=40}" />
<Size value="{Width=408, Height=21}" />
<DropDownStyle value="DropDownList" />
</System.Windows.Forms.ComboBox>
<System.Windows.Forms.Label>
<Name value="label" />
<Text value="${res:AddIns.ProjectImportExporter.ExportProjectDialog.OutputFormatLabel}" />
<TextAlign value="MiddleRight" />
<TabIndex value="3" />
<Size value="{Width=144, Height=23}" />
<Location value="{X=8,Y=40}" />
</System.Windows.Forms.Label>
<System.Windows.Forms.Button>
<Name value="outputLocationBrowseButton" />
<Location value="{X=530,Y=8}" />
<Size value="{Width=32, Height=21}" />
<Text value="..." />
<Anchor value="Top, Right" />
<TabIndex value="2" />
</System.Windows.Forms.Button>
<System.Windows.Forms.TextBox>
<Name value="outputLocationTextBox" />
<Anchor value="Top, Left, Right" />
<TabIndex value="1" />
<Location value="{X=152,Y=8}" />
<Size value="{Width=370, Height=21}" />
<Text value="" />
</System.Windows.Forms.TextBox>
<System.Windows.Forms.Label>
<Name value="label" />
<Text value="${res:AddIns.ProjectImportExporter.ExportProjectDialog.OutputLocationLabel}" />
<TextAlign value="MiddleRight" />
<TabIndex value="0" />
<Size value="{Width=144, Height=23}" />
<Location value="{X=8,Y=8}" />
</System.Windows.Forms.Label>
<System.Windows.Forms.Button>
<Name value="cancelButton" />
<Location value="{X=490,Y=258}" />
<Text value="${res:Global.CancelButtonText}" />
<Anchor value="Bottom, Right" />
<TabIndex value="11" />
<DialogResult value="Cancel" />
</System.Windows.Forms.Button>
<System.Windows.Forms.Button>
<Name value="startButton" />
<Location value="{X=410,Y=258}" />
<Text value="${res:Global.StartButtonText}" />
<Anchor value="Bottom, Right" />
<TabIndex value="10" />
</System.Windows.Forms.Button>
<System.Windows.Forms.ProgressBar>
<Name value="progressBar" />
<Size value="{Width=544, Height=23}" />
<Anchor value="Top, Left, Right" />
<TabIndex value="7" />
<Location value="{X=16,Y=208}" />
</System.Windows.Forms.ProgressBar>
<System.Windows.Forms.GroupBox>
<Name value="groupBox1" />
<TabIndex value="19" />
<Location value="{X=24,Y=240}" />
<Anchor value="Top, Left, Right" />
<Size value="{Width=536, Height=16}" />
<Text value="Additional options" />
</System.Windows.Forms.GroupBox>
</Controls>
</System.Windows.Forms.Form>
</Components>

108
src/AddIns/Misc/ProjectImporterExporter/Project/Resources/ImportProjectDialog.xfrm

@ -1,108 +0,0 @@ @@ -1,108 +0,0 @@
<Components version="1.0">
<System.Windows.Forms.Form>
<Name value="MyForm" />
<ShowInTaskbar value="False" />
<FormBorderStyle value="FixedDialog" />
<StartPosition value="CenterParent" />
<ClientSize value="{Width=442, Height=255}" />
<MinimizeBox value="False" />
<DockPadding value="" />
<Text value="${res:AddIns.ProjectImportExporter.ImportProjectDialog.DialogName}" />
<AcceptButton value="startButton [System.Windows.Forms.Button], Text: ${res:Global.StartButtonText}" />
<CancelButton value="cancelButton [System.Windows.Forms.Button], Text: ${res:Global.CancelButtonText}" />
<MaximizeBox value="False" />
<Controls>
<System.Windows.Forms.CheckBox>
<Name value="openAfterImportCheckBox" />
<Location value="{X=152,Y=64}" />
<Checked value="True" />
<Size value="{Width=280, Height=24}" />
<Text value="${res:AddIns.ProjectImportExporter.ImportProjectDialog.OpenAfterInputCheckBox}" />
<CheckState value="Checked" />
<Anchor value="Top, Left, Right" />
<TabIndex value="10" />
</System.Windows.Forms.CheckBox>
<System.Windows.Forms.RichTextBox>
<Name value="formatsRichTextBox" />
<Anchor value="Top, Bottom, Left, Right" />
<ReadOnly value="True" />
<Size value="{Width=426, Height=88}" />
<Location value="{X=8,Y=128}" />
<Text value="" />
<TabIndex value="7" />
</System.Windows.Forms.RichTextBox>
<System.Windows.Forms.Label>
<Name value="label4" />
<Text value="${res:AddIns.ProjectImportExporter.ImportProjectDialog.SupportedFormatsLabel}" />
<TextAlign value="BottomLeft" />
<Anchor value="Top, Left, Right" />
<TabIndex value="6" />
<Size value="{Width=426, Height=23}" />
<Location value="{X=8,Y=104}" />
</System.Windows.Forms.Label>
<System.Windows.Forms.Button>
<Name value="outputLocationBrowseButton" />
<Location value="{X=402,Y=40}" />
<Size value="{Width=32, Height=21}" />
<Text value="..." />
<Anchor value="Top, Right" />
<TabIndex value="5" />
</System.Windows.Forms.Button>
<System.Windows.Forms.TextBox>
<Name value="outputLocationTextBox" />
<Anchor value="Top, Left, Right" />
<TabIndex value="4" />
<Location value="{X=152,Y=40}" />
<Size value="{Width=242, Height=21}" />
<Text value="" />
</System.Windows.Forms.TextBox>
<System.Windows.Forms.Label>
<Name value="label2" />
<Text value="${res:AddIns.ProjectImportExporter.ImportProjectDialog.OutputLocationLabel}" />
<TextAlign value="MiddleRight" />
<TabIndex value="3" />
<Size value="{Width=152, Height=23}" />
<Location value="{X=0,Y=40}" />
</System.Windows.Forms.Label>
<System.Windows.Forms.Button>
<Name value="projectBrowseButton" />
<Location value="{X=402,Y=8}" />
<Size value="{Width=32, Height=21}" />
<Text value="..." />
<Anchor value="Top, Right" />
<TabIndex value="2" />
</System.Windows.Forms.Button>
<System.Windows.Forms.TextBox>
<Name value="projectTextBox" />
<Anchor value="Top, Left, Right" />
<TabIndex value="1" />
<Location value="{X=152,Y=8}" />
<Size value="{Width=242, Height=21}" />
<Text value="" />
</System.Windows.Forms.TextBox>
<System.Windows.Forms.Label>
<Name value="label" />
<Text value="${res:AddIns.ProjectImportExporter.ImportProjectDialog.ProjectInputLabel}" />
<TextAlign value="MiddleRight" />
<TabIndex value="0" />
<Size value="{Width=144, Height=23}" />
<Location value="{X=8,Y=8}" />
</System.Windows.Forms.Label>
<System.Windows.Forms.Button>
<Name value="cancelButton" />
<Location value="{X=362,Y=225}" />
<Text value="${res:Global.CancelButtonText}" />
<Anchor value="Bottom, Right" />
<TabIndex value="9" />
<DialogResult value="Cancel" />
</System.Windows.Forms.Button>
<System.Windows.Forms.Button>
<Name value="startButton" />
<Location value="{X=282,Y=225}" />
<Text value="${res:Global.StartButtonText}" />
<Anchor value="Bottom, Right" />
<TabIndex value="8" />
</System.Windows.Forms.Button>
</Controls>
</System.Windows.Forms.Form>
</Components>

48
src/AddIns/Misc/ProjectImporterExporter/Project/Resources/ProjectImporterExporter.addin

@ -1,48 +0,0 @@ @@ -1,48 +0,0 @@
<AddIn name = "Project Importer/Exporter"
author = "Mike Krueger"
copyright = "GPL"
url = "unknown"
description = "imports/exports forgein project files"
version = "1.0.0">
<Runtime>
<Import assembly="ProjectImporterExporter.dll"/>
</Runtime>
<Path name = "/SharpDevelop/Workbench/MainMenu/File">
<MenuItem id = "ImportSeparator" insertafter="SaveAll" insertbefore="PrintSeparator" type = "Separator" />
<MenuItem id = "ImportProject"
label = "${res:XML.MainMenu.FileMenu.ImportSolution}"
description = "${res:XML.MainMenu.FileMenu.ImportSolution.Description}"
class = "ICSharpCode.SharpDevelop.ProjectImportExporter.Commands.ImportProjectCommand" />
<Condition iscombineopen="True" action="Disable">
<MenuItem id = "ExportProject"
label = "${res:XML.MainMenu.FileMenu.ExportSolution}"
description = "${res:XML.MainMenu.FileMenu.ExportSolution.Description}"
class = "ICSharpCode.SharpDevelop.ProjectImportExporter.Commands.ExportProjectCommand" />
</Condition>
</Path>
<Path name = "/SharpDevelop/Views/ProjectBrowser/ContextMenu/ProjectBrowserNode">
<MenuItem id = "Convert" insertafter="SetAsStartupProject" label = "${res:ICSharpCode.SharpDevelop.Commands.Convert}">
<MenuItem id = "Convert to C#"
label = "${res:ICSharpCode.SharpDevelop.Commands.VBConvertProjectToCSharp}"
class = "ICSharpCode.SharpDevelop.ProjectImportExporter.Commands.ExportProjectToCSharpCommand"/>
<MenuItem id = "Convert to VB.NET"
label = "${res:ICSharpCode.SharpDevelop.Commands.CharpConvertProjectToVB}"
class = "ICSharpCode.SharpDevelop.ProjectImportExporter.Commands.ExportProjectToVBNetCommand"/>
</MenuItem>
</Path>
<Path name = "/SharpDevelop/Workbench/MainMenu/Project">
<MenuItem id = "Convert" insertafter="SetAsStartupProject" label = "${res:ICSharpCode.SharpDevelop.Commands.Convert}">
<MenuItem id = "Convert to C#"
label = "${res:ICSharpCode.SharpDevelop.Commands.VBConvertProjectToCSharp}"
class = "ICSharpCode.SharpDevelop.ProjectImportExporter.Commands.ExportProjectToCSharpCommand"/>
<MenuItem id = "Convert to VB.NET"
label = "${res:ICSharpCode.SharpDevelop.Commands.CharpConvertProjectToVB}"
class = "ICSharpCode.SharpDevelop.ProjectImportExporter.Commands.ExportProjectToVBNetCommand"/>
</MenuItem>
</Path>
</AddIn>

110
src/AddIns/Misc/ProjectImporterExporter/Project/Resources/ProjectToVSNetProjectConversion.xsl

@ -1,110 +0,0 @@ @@ -1,110 +0,0 @@
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:convtool="urn:convtool">
<xsl:param name="ProjectGUID"/>
<xsl:param name="LanguageName"/>
<xsl:param name="FrameworkPath"/>
<xsl:template match="/Project">
<VisualStudioProject>
<xsl:element name = "{$LanguageName}">
<xsl:attribute name = "ProjectType">Local</xsl:attribute>
<xsl:attribute name = "ProductVersion">7.10.3077</xsl:attribute>
<xsl:attribute name = "SchemaVersion">2.0</xsl:attribute>
<xsl:attribute name = "ProjectGuid"><xsl:value-of select = "$ProjectGUID"/></xsl:attribute>
<Build>
<Settings
ApplicationIcon = "{Configuration/CodeGeneration/@win32icon}"
AssemblyKeyContainerName = ""
AssemblyName = "{Configuration/Output/@assembly}"
AssemblyOriginatorKeyFile = ""
DefaultClientScript = "JScript"
DefaultHTMLPageLayout = "Grid"
DefaultTargetSchema = "IE50"
DelaySign = "false"
OutputType = "{Configuration/CodeGeneration/@target}"
PreBuildEvent = ""
PostBuildEvent = ""
RootNamespace = "{@standardNamespace}"
RunPostBuildEvent = "OnBuildSuccess"
StartupObject = "{Configuration/CodeGeneration/@mainclass}"
>
<xsl:for-each select="Configurations/Configuration">
<Config
Name = "{convtool:AddConfig(@name)}"
AllowUnsafeBlocks = "{CodeGeneration/@unsafecodeallowed}"
BaseAddress = "285212672"
CheckForOverflowUnderflow = "{CodeGeneration/@generateoverflowchecks}"
ConfigurationOverrideFile = ""
DefineConstants = "{CodeGeneration/@definesymbols}"
DocumentationFile = ""
DebugSymbols = "{CodeGeneration/@includedebuginformation}"
FileAlignment = "4096"
IncrementalBuild = "false"
NoStdLib = "{CodeGeneration/@nostdlib}"
NoWarn = "{CodeGeneration/@nowarn}"
Optimize = "{CodeGeneration/@optimize}"
OutputPath = "{Output/@directory}"
RegisterForComInterop = "false"
RemoveIntegerChecks = "false"
TreatWarningsAsErrors = "{convtool:Negate(@runwithwarnings)}"
WarningLevel = "{CodeGeneration/@warninglevel}"
/>
</xsl:for-each>
</Settings>
<References>
<Reference
Name = "System"
AssemblyName = "System"
HintPath = "{$FrameworkPath}System.dll"
/>
<Reference
Name = "System.Data"
AssemblyName = "System.Data"
HintPath = "{$FrameworkPath}System.Data.dll"
/>
<Reference
Name = "System.XML"
AssemblyName = "System.Xml"
HintPath = "{$FrameworkPath}System.XML.dll"
/>
<Reference
Name = "System.Drawing"
AssemblyName = "System.Drawing"
HintPath = "{$FrameworkPath}System.Drawing.dll"
/>
<Reference
Name = "System.Windows.Forms"
AssemblyName = "System.Windows.Forms"
HintPath = "{$FrameworkPath}System.Windows.Forms.dll"
/>
<xsl:for-each select="References/Reference[@type='Assembly']">
<Reference
Name = "{convtool:FileNameWithoutExtension(@refto)}"
AssemblyName = "{convtool:FileNameWithoutExtension(@refto)}"
HintPath = "{convtool:VerifyFileLocation(@refto)}"
/>
</xsl:for-each>
<xsl:for-each select="References/Reference[@type='Project']">
<Reference
Name = "{@refto}"
Project = "{convtool:GetProjectGUID(@refto)}"
Package = "{convtool:GetPackageGUID(@refto)}"
/>
</xsl:for-each>
</References>
</Build>
<Files>
<Include>
<xsl:for-each select="Contents/File[@buildaction!='Exclude' and @subtype!='Directory']">
<File
RelPath = "{convtool:VerifyFileLocation(@name)}"
BuildAction = "{convtool:ConvertBuildAction(@buildaction)}"
/>
</xsl:for-each>
</Include>
</Files>
</xsl:element>
</VisualStudioProject>
</xsl:template>
</xsl:stylesheet>

121
src/AddIns/Misc/ProjectImporterExporter/Project/Resources/VBSolutionConversion.xsl

@ -1,121 +0,0 @@ @@ -1,121 +0,0 @@
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:convtool="urn:convtool">
<xsl:param name="ProjectTitle"/>
<xsl:template match="/VisualStudioProject/VisualBasic">
<Project name = "{$ProjectTitle}"
standardNamespace="{Build/Settings/@RootNamespace}"
description = ""
newfilesearch = "None"
enableviewstate = "True"
version = "1.1"
projecttype = "VBNET">
<!-- Transform Contents -->
<Contents>
<xsl:for-each select="Files/Include/File[@BuildAction ='Compile']">
<xsl:choose>
<xsl:when test="@Link">
<File name = "{convtool:VerifyFileLocation(@Link)}"
buildaction="Compile"
subtype = "Code"/>
</xsl:when>
<xsl:otherwise>
<File name = "{convtool:VerifyFileLocation(@RelPath)}"
buildaction="Compile"
subtype = "Code"/>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
<!-- convert 'resources' -->
<xsl:for-each select="Files/Include/File[@BuildAction ='EmbeddedResource']">
<xsl:choose>
<!-- VB.NET in VS has a different resource management than C# -->
<xsl:when test="@Link">
<File name = "{convtool:ImportDependentResource(@Link,@DependentUpon,/VisualStudioProject/VisualBasic/Build/Settings/@RootNamespace)}"
buildaction="EmbedAsResource"
subtype = "Code"/>
</xsl:when>
<xsl:otherwise>
<File name = "{convtool:ImportDependentResource(@RelPath,@DependentUpon,/VisualStudioProject/VisualBasic/Build/Settings/@RootNamespace)}"
buildaction="EmbedAsResource"
subtype = "Code"/>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
<!-- Non-buildable files part of the project -->
<xsl:for-each select="Files/Include/File[(@BuildAction ='None') or (@BuildAction ='Content')]">
<xsl:choose>
<xsl:when test="@Link">
<File name = "{convtool:VerifyFileLocation(@Link)}"
buildaction="Nothing"
subtype = "Code"/>
</xsl:when>
<xsl:otherwise>
<File name = "{convtool:VerifyFileLocation(@RelPath)}"
buildaction="Nothing"
subtype = "Code"/>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</Contents>
<DeploymentInformation target="" script="" strategy="File" />
<!-- Transform Settings -->
<xsl:for-each select="Build/Settings">
<Configurations active="Debug">
<xsl:for-each select="Config">
<Configuration runwithwarnings="{convtool:Negate(@TreatWarningsAsErrors)}" name="{@Name}">
<xsl:element name = "CodeGeneration" >
<xsl:attribute name = "includedebuginformation"><xsl:value-of select = "convtool:EnsureBool(@DebugSymbols)"/></xsl:attribute>
<xsl:attribute name = "optimize"><xsl:value-of select = "convtool:EnsureBool(@Optimize)"/></xsl:attribute>
<xsl:attribute name = "generateoverflowchecks"><xsl:value-of select = "convtool:EnsureBool(@CheckForOverflowUnderflow)"/></xsl:attribute>
<xsl:attribute name = "rootnamespace"><xsl:value-of select = "../@RootNamespace"/></xsl:attribute>
<xsl:attribute name = "mainclass"><xsl:value-of select = "../@StartupObject"/></xsl:attribute>
<xsl:attribute name = "target"><xsl:value-of select = "../@OutputType"/></xsl:attribute>
<xsl:attribute name = "definesymbols"><xsl:value-of select = "@DefineConstants"/></xsl:attribute>
<xsl:attribute name = "generatexmldocumentation">False</xsl:attribute>
<xsl:attribute name = "win32Icon"><xsl:value-of select = "convtool:VerifyFileLocation(../@ApplicationIcon)"/></xsl:attribute>
<xsl:attribute name = "imports"><xsl:for-each select="/VisualStudioProject/VisualBasic/Build/Imports/Import"><xsl:value-of select = "@Namespace"/>,</xsl:for-each></xsl:attribute>
</xsl:element>
<VBDOC outputfile=""
enablevbdoc="False"
filestoparse=""
commentprefix="" />
<Execution consolepause="True"
commandlineparameters="" />
<Output directory="{@OutputPath}"
assembly="{../@AssemblyName}" />
</Configuration>
</xsl:for-each>
</Configurations>
</xsl:for-each>
<!-- Transform References -->
<xsl:apply-templates select="Build/References"/>
</Project>
</xsl:template>
<!-- Transform references (a bit like frungy) -->
<xsl:template match="References">
<References>
<xsl:for-each select="Reference[@AssemblyName]">
<xsl:if test="convtool:ShouldGenerateReference('True', @AssemblyName, @HintPath)">
<Reference type = "{convtool:GenerateReferenceType(@AssemblyName, @HintPath)}"
refto = "{convtool:GenerateReference(@AssemblyName, @HintPath)}"/>
</xsl:if>
</xsl:for-each>
<xsl:for-each select="Reference[@Project]">
<Reference type = "Project"
refto = "{@Name}"/>
</xsl:for-each>
</References>
</xsl:template>
</xsl:stylesheet>
Loading…
Cancel
Save