Browse Source

Improved prjx imported.

Added importer for VS.NET [2003] projects.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@264 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Daniel Grunwald 20 years ago
parent
commit
2cdb101e4a
  1. 4
      AddIns/ICSharpCode.SharpDevelop.addin
  2. 17
      data/ConversionStyleSheets/CSharp_prjx2csproj.xsl
  3. 104
      data/ConversionStyleSheets/vsnet2msbuild.xsl
  4. 19
      data/ConversionStyleSheets/vsnet2msbuild_user.xsl
  5. 5
      src/AddIns/BackendBindings/CSharpBinding/Project/Src/Parser/ExpressionFinder.cs
  6. 2
      src/AddIns/BackendBindings/CSharpBinding/Project/Src/Project/CSharpProject.cs
  7. 40
      src/AddIns/Misc/SubversionAddIn/Project/Resources/SubversionOptionsPanel.xfrm
  8. 2
      src/AddIns/Misc/SubversionAddIn/Project/Src/AddInOptions.cs
  9. 97
      src/AddIns/Misc/SubversionAddIn/Project/Src/Commands/AutostartCommands.cs
  10. 6
      src/AddIns/Misc/SubversionAddIn/Project/Src/Commands/Checkout/CheckoutCommand.cs
  11. 7
      src/AddIns/Misc/SubversionAddIn/Project/Src/Commands/Export/ExportDialog.cs
  12. 33
      src/AddIns/Misc/SubversionAddIn/Project/Src/Commands/ProjectBrowserCommands.cs
  13. 30
      src/AddIns/Misc/SubversionAddIn/Project/Src/Gui/ProjectBrowserVisitor/OverlayIconManager.cs
  14. 2
      src/AddIns/Misc/SubversionAddIn/Project/Src/Gui/SubversionOptionsPanel.cs
  15. 4
      src/Libraries/ICSharpCode.TextEditor/Project/Resources/VBNET-Mode.xshd
  16. 6
      src/Main/Base/Project/ICSharpCode.SharpDevelop.csproj
  17. 21
      src/Main/Base/Project/Src/Commands/FileMenuCommands.cs
  18. 6
      src/Main/Base/Project/Src/Gui/Pads/ProjectBrowser/ProjectBrowserControl.cs
  19. 26
      src/Main/Base/Project/Src/Gui/Workbench/DefaultWorkbench.cs
  20. 37
      src/Main/Base/Project/Src/Project/Converter/CombineToSolution.cs
  21. 192
      src/Main/Base/Project/Src/Project/Converter/PrjxToSolutionProject.cs
  22. 15
      src/Main/Base/Project/Src/Project/MSBuildProject.cs
  23. 57
      src/Main/Base/Project/Src/Project/Solution/Solution.cs
  24. 33
      src/Main/Base/Project/Src/Services/File/FileEventArgs.cs
  25. 30
      src/Main/Base/Project/Src/Services/File/FileRenameEventArgs.cs
  26. 82
      src/Main/Base/Project/Src/Services/File/FileService.cs
  27. 8
      src/Main/Base/Project/Src/Services/ParserService/ReflectionProjectContent.cs
  28. 6
      src/Main/Base/Project/Src/Services/ProjectService/ProjectService.cs
  29. 4
      src/Main/Base/Project/Src/Services/Tasks/TaskService.cs
  30. 2
      src/Main/Base/Project/Src/TextEditor/Gui/Editor/CompletionWindow/AbstractCompletionDataProvider.cs

4
AddIns/ICSharpCode.SharpDevelop.addin

@ -111,7 +111,7 @@ @@ -111,7 +111,7 @@
<Path name = "/SharpDevelop/Workbench/Combine/FileFilter">
<FileFilter id = "Solution"
name = "Solutions"
name = "Solutions (*.sln)"
extensions = "*.sln"/>
<FileFilter id = "Combine"
@ -120,7 +120,7 @@ @@ -120,7 +120,7 @@
<FileFilter id = "Project"
name = "${res:SharpDevelop.FileFilter.ProjectFiles}"
extensions = "*.prjx"/>
extensions = "*.prjx;*.vbproj;*.csproj"/>
<FileFilter id = "AllFiles"
name = "${res:SharpDevelop.FileFilter.AllFiles}"

17
data/ConversionStyleSheets/CSharp_prjx2csproj.xsl

@ -14,15 +14,15 @@ @@ -14,15 +14,15 @@
<xsl:value-of select = "/Project/Configurations/@active" />
</xsl:element>
<xsl:element name = "Platform" ><xsl:attribute name = "Condition"> '$(Platform)' == '' </xsl:attribute>AnyCPU</xsl:element>
<xsl:element name = "ProductVersion">8.0.40607</xsl:element>
<!--<xsl:element name = "ProductVersion">8.0.40607</xsl:element>-->
<xsl:element name = "SchemaVersion">2.0</xsl:element>
<xsl:element name = "ProjectGuid"><xsl:value-of select = "Conversion:GetGuid(/Project/@name)" /></xsl:element>
<xsl:element name = "RootNamespace"><xsl:value-of select = "/Project/@standardNamespace" /></xsl:element>
<xsl:element name = "RootNamespace"><xsl:value-of select = "Conversion:SetRootNamespace(/Project/@standardNamespace)" /></xsl:element>
<!-- Copy global object from 'Debug' node -->
<xsl:for-each select="/Project/Configurations/Configuration[@name='Debug']">
<xsl:element name = "AssemblyName"><xsl:value-of select = "Output/@assembly" /></xsl:element>
<xsl:element name = "OutputTarget"><xsl:value-of select = "CodeGeneration/@target" /></xsl:element>
<xsl:element name = "OutputType"><xsl:value-of select = "CodeGeneration/@target" /></xsl:element>
<xsl:element name = "ApplicationIcon"><xsl:value-of select = "CodeGeneration/@win32Icon" /></xsl:element>
@ -48,7 +48,7 @@ @@ -48,7 +48,7 @@
<xsl:element name = "CheckForOverflowUnderflow"><xsl:value-of select = "CodeGeneration/@generateoverflowchecks" /></xsl:element>
<xsl:element name = "DefineConstants"><xsl:value-of select = "CodeGeneration/@definesymbols" /></xsl:element>
<xsl:element name = "OutputPath"><xsl:value-of select = "Conversion:CanocializePath(Output/@directory)" /></xsl:element>
<xsl:element name = "TreatWarningsAsErrors"><xsl:value-of select = "@runwithwarnings" /></xsl:element>
<xsl:element name = "TreatWarningsAsErrors"><xsl:value-of select = "Conversion:Negate(@runwithwarnings)" /></xsl:element>
</xsl:element>
</xsl:for-each>
@ -67,8 +67,8 @@ @@ -67,8 +67,8 @@
<xsl:for-each select="/Project/References/Reference[@type='Assembly']">
<xsl:element name = "Reference" >
<xsl:attribute name = "Include"><xsl:value-of select = "Conversion:GetFileName(@refto)" /></xsl:attribute>
<xsl:element name = "HintPath" ><xsl:value-of select = "@refto" /></xsl:element>
<xsl:attribute name = "Include"><xsl:value-of select = "Conversion:GetFileNameWithoutExtension(@refto)" /></xsl:attribute>
<xsl:element name = "HintPath" ><xsl:value-of select = "Conversion:CanocializeFileName(@refto)" /></xsl:element>
<xsl:element name = "Private" ><xsl:value-of select = "@localcopy" /></xsl:element>
</xsl:element>
</xsl:for-each>
@ -82,7 +82,7 @@ @@ -82,7 +82,7 @@
</xsl:for-each>
<xsl:for-each select="/Project/Contents/File[@buildaction='EmbedAsResource']">
<xsl:element name = "EmbeddedResource" >
<xsl:attribute name = "Include"><xsl:value-of select = "Conversion:CanocializeFileName(@name)" /></xsl:attribute>
<xsl:attribute name = "Include"><xsl:value-of select = "Conversion:ConvertResource(@name)" /></xsl:attribute>
</xsl:element>
</xsl:for-each>
@ -107,14 +107,13 @@ @@ -107,14 +107,13 @@
<xsl:attribute name = "Include"><xsl:value-of select = "Conversion:GetRelativeProjectPath(@refto)" /></xsl:attribute>
<xsl:element name = "Project"><xsl:value-of select = "Conversion:GetGuid(@refto)" /></xsl:element>
<xsl:element name = "Package">{00000000-0000-0000-0000-000000000000}</xsl:element>
<xsl:element name = "Name"><xsl:value-of select = "@refto" /></xsl:element>
</xsl:element>
</xsl:for-each>
</xsl:element>
<xsl:element name = "Import" >
<xsl:attribute name = "Project">$(MSBuildBinPath)\Microsoft.CSHARP.Targets</xsl:attribute>
<xsl:attribute name = "Project">$(MSBuildBinPath)\Microsoft.<xsl:value-of select = "Conversion:GetLanguageName()" />.Targets</xsl:attribute>
</xsl:element>

104
data/ConversionStyleSheets/vsnet2msbuild.xsl

@ -0,0 +1,104 @@ @@ -0,0 +1,104 @@
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:Conversion="urn:Conversion">
<xsl:output method = "xml" indent = "yes" />
<xsl:template match = "/VisualStudioProject/*" >
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!-- <xsl:element name = "Project" namespace="http://schemas.microsoft.com/developer/msbuild/2003" >-->
<!-- <xsl:attribute name = "DefaultTargets">Build</xsl:attribute> -->
<!-- Global project options -->
<xsl:element name = "PropertyGroup" >
<xsl:element name = "Configuration" >
<xsl:attribute name = "Condition"> '$(Configuration)' == '' </xsl:attribute>
<xsl:value-of select = "Build/Settings/Config[1]/@Name" />
</xsl:element>
<xsl:element name = "Platform" ><xsl:attribute name = "Condition"> '$(Platform)' == '' </xsl:attribute>AnyCPU</xsl:element>
<!--<xsl:element name = "ProductVersion">8.0.40607</xsl:element>-->
<xsl:element name = "SchemaVersion">2.0</xsl:element>
<xsl:element name = "ProjectGuid"><xsl:value-of select = "@ProjectGuid" /></xsl:element>
<xsl:element name = "RootNamespace"><xsl:value-of select = "Build/Settings/@RootNamespace" /></xsl:element>
<xsl:element name = "AssemblyName"><xsl:value-of select = "Build/Settings/@AssemblyName" /></xsl:element>
<xsl:element name = "OutputType"><xsl:value-of select = "Build/Settings/@OutputType" /></xsl:element>
<xsl:element name = "ApplicationIcon"><xsl:value-of select = "Build/Settings/@ApplicationIcon" /></xsl:element>
<xsl:element name = "RunPostBuildEvent">OnSuccessfulBuild</xsl:element>
<xsl:element name = "PreBuildEvent"><xsl:value-of select = "Build/Settings/@PreBuildEvent" /></xsl:element>
<xsl:element name = "PostBuildEvent"><xsl:value-of select = "Build/Settings/@PostBuildEvent" /></xsl:element>
<xsl:element name = "StartupObject"><xsl:value-of select = "Build/Settings/@StartupObject" /></xsl:element>
<xsl:element name = "NoConfig">false</xsl:element>
</xsl:element>
<!-- Configurations -->
<xsl:for-each select="Build/Settings/Config">
<xsl:element name = "PropertyGroup" >
<xsl:attribute name = "Condition"> '$(Configuration)|$(Platform)' == '<xsl:value-of select = "@Name" />|AnyCPU' </xsl:attribute>
<xsl:element name = "NoStdLib"><xsl:value-of select = "@NoStdLib" /></xsl:element>
<xsl:element name = "WarningLevel"><xsl:value-of select = "@WarningLevel" /></xsl:element>
<xsl:element name = "NoWarn"><xsl:value-of select = "@NoWarn" /></xsl:element>
<xsl:element name = "DebugSymbols"><xsl:value-of select = "@DebugSymbols" /></xsl:element>
<xsl:element name = "Optimize"><xsl:value-of select = "@Optimize" /></xsl:element>
<xsl:element name = "AllowUnsafeBlocks"><xsl:value-of select = "@AllowUnsafeBlocks" /></xsl:element>
<xsl:element name = "CheckForOverflowUnderflow"><xsl:value-of select = "@CheckForOverflowUnderflow" /></xsl:element>
<xsl:element name = "DefineConstants"><xsl:value-of select = "@DefineConstants" /></xsl:element>
<xsl:element name = "OutputPath"><xsl:value-of select = "@OutputPath" /></xsl:element>
<xsl:element name = "TreatWarningsAsErrors"><xsl:value-of select = "@TreatWarningsAsErrors" /></xsl:element>
</xsl:element>
</xsl:for-each>
<xsl:element name = "ItemGroup">
<xsl:for-each select="Build/References/Reference[@HintPath]">
<xsl:element name = "Reference" >
<xsl:attribute name = "Include"><xsl:value-of select = "@Name" /></xsl:attribute>
<xsl:if test="Conversion:IsNotGacReference(@HintPath)">
<xsl:element name = "HintPath" ><xsl:value-of select = "@HintPath" /></xsl:element>
<xsl:element name = "Private" ><xsl:value-of select = "@Private" /></xsl:element>
</xsl:if>
</xsl:element>
</xsl:for-each>
</xsl:element>
<xsl:element name = "ItemGroup">
<xsl:for-each select="Files/Include/File[@BuildAction='Compile']">
<xsl:element name = "Compile" >
<xsl:attribute name = "Include"><xsl:value-of select = "@RelPath" /></xsl:attribute>
</xsl:element>
</xsl:for-each>
<xsl:for-each select="Files/Include/File[@BuildAction='EmbeddedResource']">
<xsl:element name = "EmbeddedResource" >
<xsl:attribute name = "Include"><xsl:value-of select = "@RelPath" /></xsl:attribute>
</xsl:element>
</xsl:for-each>
<xsl:for-each select="/Project/Contents/File[@BuildAction!='Compile' and @BuildAction!='EmbeddedResource']">
<xsl:element name = "None" >
<xsl:attribute name = "Include"><xsl:value-of select = "@RelPath" /></xsl:attribute>
</xsl:element>
</xsl:for-each>
</xsl:element>
<xsl:element name = "ItemGroup">
<!-- Directories -->
</xsl:element>
<xsl:element name = "ItemGroup">
<xsl:for-each select="Build/References/Reference[@Project]">
<xsl:element name = "ProjectReference" >
<xsl:attribute name = "Include"><xsl:value-of select = "Conversion:GetRelativeProjectPath(@Name)" /></xsl:attribute>
<xsl:element name = "Project"><xsl:value-of select = "@Project" /></xsl:element>
<xsl:element name = "Name"><xsl:value-of select = "@Name" /></xsl:element>
<xsl:element name = "Private" ><xsl:value-of select = "@Private" /></xsl:element>
</xsl:element>
</xsl:for-each>
</xsl:element>
<xsl:element name = "Import" >
<xsl:attribute name = "Project">$(MSBuildBinPath)\Microsoft.<xsl:value-of select = "Conversion:GetLanguageName()" />.Targets</xsl:attribute>
</xsl:element>
</Project>
<!-- </xsl:element>-->
</xsl:template>
</xsl:stylesheet>

19
data/ConversionStyleSheets/vsnet2msbuild_user.xsl

@ -0,0 +1,19 @@ @@ -0,0 +1,19 @@
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:Conversion="urn:Conversion">
<xsl:output method = "xml" indent = "yes" />
<xsl:template match = "/VisualStudioProject/*" >
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!-- Configurations -->
<xsl:for-each select="Build/Settings/Config">
<xsl:element name = "PropertyGroup" >
<xsl:attribute name = "Condition"> '$(Configuration)|$(Platform)' == '<xsl:value-of select = "@Name" />|AnyCPU' </xsl:attribute>
<xsl:element name = "StartProgram"><xsl:value-of select = "@StartProgram" /></xsl:element>
<xsl:element name = "StartArguments"><xsl:value-of select = "@StartArguments" /></xsl:element>
</xsl:element>
</xsl:for-each>
</Project>
</xsl:template>
</xsl:stylesheet>

5
src/AddIns/BackendBindings/CSharpBinding/Project/Src/Parser/ExpressionFinder.cs

@ -143,6 +143,7 @@ namespace CSharpBinding.Parser @@ -143,6 +143,7 @@ namespace CSharpBinding.Parser
public string FindExpressionInternal(string inText, int offset)
{
// warning: Do not confuse this.offset and offset
this.text = inText;
this.offset = this.lastAccept = offset;
this.state = START;
@ -159,7 +160,7 @@ namespace CSharpBinding.Parser @@ -159,7 +160,7 @@ namespace CSharpBinding.Parser
lastAccept = this.offset;
}
if (state == ACCEPTNOMORE) {
lastExpressionStartPosition = offset + 1;
lastExpressionStartPosition = this.offset + 1;
return this.text.Substring(this.offset + 1, offset - this.offset);
}
}
@ -167,7 +168,7 @@ namespace CSharpBinding.Parser @@ -167,7 +168,7 @@ namespace CSharpBinding.Parser
if (lastAccept < 0)
return null;
lastExpressionStartPosition = lastAccept + 1;
lastExpressionStartPosition = this.lastAccept + 1;
return this.text.Substring(this.lastAccept + 1, offset - this.lastAccept);
}

2
src/AddIns/BackendBindings/CSharpBinding/Project/Src/Project/CSharpProject.cs

@ -242,7 +242,7 @@ namespace CSharpBinding @@ -242,7 +242,7 @@ namespace CSharpBinding
{
Language = "C#";
Create(info);
imports.Add(@"$(MSBuildBinPath)\Microsoft.CSHARP.Targets");
imports.Add(@"$(MSBuildBinPath)\Microsoft.CSharp.Targets");
}
}
}

40
src/AddIns/Misc/SubversionAddIn/Project/Resources/SubversionOptionsPanel.xfrm

@ -1,46 +1,54 @@ @@ -1,46 +1,54 @@
<Components version="1.0">
<System.Windows.Forms.UserControl>
<Name value="XmlUserControl1" />
<DockPadding value="" />
<ClientSize value="{Width=296, Height=240}" />
<Controls>
<System.Windows.Forms.CheckBox>
<Name value="autoReloadProjectCheckBox" />
<Location value="{X=8,Y=176}" />
<Name value="autoDeleteFilesCheckBox" />
<Location value="{X=8,Y=172}" />
<FlatAppearance value="System.Windows.Forms.FlatButtonAppearance" />
<Text value="Automatically &amp;delete removed files" />
<TabIndex value="3" />
<Size value="{Width=280, Height=24}" />
</System.Windows.Forms.CheckBox>
<System.Windows.Forms.CheckBox>
<Name value="autoReloadProjectCheckBox" />
<Location value="{X=8,Y=192}" />
<FlatAppearance value="System.Windows.Forms.FlatButtonAppearance" />
<Text value="&amp;Re-load project after projectfile change" />
<TabIndex value="4" />
<Size value="{Width=280, Height=24}" />
<Anchor value="Top, Left, Right" />
<TabIndex value="5" />
</System.Windows.Forms.CheckBox>
<System.Windows.Forms.CheckBox>
<Name value="autoAddFilesCheckBox" />
<Location value="{X=8,Y=152}" />
<FlatAppearance value="System.Windows.Forms.FlatButtonAppearance" />
<Text value="Automatically &amp;add new files" />
<TabIndex value="2" />
<Size value="{Width=280, Height=24}" />
<Text value="&amp;Automatically add new files" />
<Anchor value="Top, Left, Right" />
<TabIndex value="4" />
</System.Windows.Forms.CheckBox>
<System.Windows.Forms.TextBox>
<Name value="logMessageTextBox" />
<Anchor value="Top, Left, Right" />
<TabIndex value="3" />
<Location value="{X=8,Y=32}" />
<AcceptsReturn value="True" />
<Size value="{Width=280, Height=112}" />
<TabIndex value="1" />
<Multiline value="True" />
<AcceptsReturn value="True" />
<WordWrap value="False" />
<Anchor value="Top, Left, Right" />
<Size value="{Width=280, Height=112}" />
<AcceptsTab value="True" />
<Text value="" />
<Location value="{X=8,Y=32}" />
</System.Windows.Forms.TextBox>
<System.Windows.Forms.Label>
<Name value="label1" />
<Location value="{X=8,Y=8}" />
<Text value="&amp;Standard commit message:" />
<TextAlign value="BottomLeft" />
<Anchor value="Top, Left, Right" />
<TabIndex value="2" />
<Size value="{Width=280, Height=23}" />
<Location value="{X=8,Y=8}" />
<TabIndex value="0" />
<Anchor value="Top, Left, Right" />
</System.Windows.Forms.Label>
</Controls>
</System.Windows.Forms.UserControl>
</Components>
</Components>

2
src/AddIns/Misc/SubversionAddIn/Project/Src/AddInOptions.cs

@ -53,7 +53,7 @@ namespace ICSharpCode.Svn @@ -53,7 +53,7 @@ namespace ICSharpCode.Svn
public static bool AutomaticallyDeleteFiles {
get {
return Properties.Get("AutomaticallyDeleteFiles", false);
return Properties.Get("AutomaticallyDeleteFiles", true);
}
set {
Properties.Set("AutomaticallyDeleteFiles", value);

97
src/AddIns/Misc/SubversionAddIn/Project/Src/Commands/AutostartCommands.cs

@ -33,10 +33,8 @@ namespace ICSharpCode.Svn.Commands @@ -33,10 +33,8 @@ namespace ICSharpCode.Svn.Commands
{
public override void Run()
{
FileService.FileRemoved += FileRemoved;
FileService.FileRenaming += FileRenamed;
FileService.FileRemoving += FileRemoving;
FileService.FileRenaming += FileRenaming;
//projectService.FileRemovedFromProject += FileRemoved;
//projectService.FileAddedToProject += FileAdded);
@ -64,7 +62,6 @@ namespace ICSharpCode.Svn.Commands @@ -64,7 +62,6 @@ namespace ICSharpCode.Svn.Commands
void FileAdded(object sender, FileEventArgs e)
{
// Console.WriteLine("ADD : " + e.FileName);
try {
if (AddInOptions.AutomaticallyAddFiles) {
SvnClient.Instance.Client.Add(Path.GetFullPath(e.FileName), false);
@ -74,32 +71,104 @@ namespace ICSharpCode.Svn.Commands @@ -74,32 +71,104 @@ namespace ICSharpCode.Svn.Commands
}
}
void FileRemoved(object sender, FileEventArgs e)
void FileRemoving(object sender, FileCancelEventArgs e)
{
// Console.WriteLine("REMOVE : " + e.FileName);
if (e.Cancel) return;
if (e.IsDirectory) return;
if (!AddInOptions.AutomaticallyDeleteFiles) return;
string fullName = Path.GetFullPath(e.FileName);
try {
if (AddInOptions.AutomaticallyDeleteFiles) {
SvnClient.Instance.Client.Delete( new string [] {
Path.GetFullPath(e.FileName)
}, true);
Status status = SvnClient.Instance.Client.SingleStatus(fullName);
switch (status.TextStatus) {
case StatusKind.Unversioned:
return; // nothing to do
case StatusKind.None:
case StatusKind.Normal:
// remove without problem
break;
case StatusKind.Modified:
case StatusKind.Replaced:
MessageService.ShowError("The file has local modifications. Do you really want to remove it?");
e.Cancel = true;
break;
case StatusKind.Added:
if (status.Copied) {
MessageService.ShowError("The file has just been moved to this location, do you really want to remove it?");
e.Cancel = true;
return;
}
SvnClient.Instance.Client.Revert(new string[] { fullName }, e.IsDirectory);
return;
default:
MessageService.ShowError("The file/directory cannot be removed because it is in subversion status '" + status.TextStatus + "'.");
e.Cancel = true;
return;
}
SvnClient.Instance.Client.Delete(new string [] { fullName }, true);
e.OperationAlreadyDone = true;
} catch (Exception ex) {
MessageService.ShowError("File removed exception: " + ex);
}
}
void FileRenamed(object sender, FileRenameEventArgs e)
void FileRenaming(object sender, FileRenamingEventArgs e)
{
// Console.WriteLine("RENAME : " + e.FileName);
string fullSource = Path.GetFullPath(e.SourceFile);
try {
SvnClient.Instance.Client.Move(Path.GetFullPath(e.SourceFile),
Status status = SvnClient.Instance.Client.SingleStatus(fullSource);
switch (status.TextStatus) {
case StatusKind.Unversioned:
return; // nothing to do
case StatusKind.Normal:
case StatusKind.None:
case StatusKind.Modified:
// rename without problem
break;
case StatusKind.Added:
case StatusKind.Replaced:
if (status.Copied) {
MessageService.ShowError("The file was moved/copied and cannot be renamed without losing it's history.");
e.Cancel = true;
} else if (e.IsDirectory) {
goto default;
} else {
SvnClient.Instance.Client.Revert(new string[] { fullSource }, false);
FileService.FileRenamed += new AutoAddAfterRenameHelper(e).Renamed;
}
return;
default:
MessageService.ShowError("The file/directory cannot be renamed because it is in subversion status '" + status.TextStatus + "'.");
e.Cancel = true;
return;
}
SvnClient.Instance.Client.Move(fullSource,
Revision.Unspecified, // TODO: Remove this line when upgrading to new NSvn version
Path.GetFullPath(e.TargetFile),
true
);
e.OperationAlreadyDone = true;
} catch (Exception ex) {
MessageService.ShowError("File renamed exception: " + ex);
}
}
class AutoAddAfterRenameHelper
{
FileRenamingEventArgs args;
public AutoAddAfterRenameHelper(FileRenamingEventArgs args) {
this.args = args;
}
public void Renamed(object sender, FileRenameEventArgs e)
{
FileService.FileRenamed -= Renamed;
if (args.Cancel || args.OperationAlreadyDone)
return;
if (args.SourceFile != e.SourceFile || args.TargetFile != e.TargetFile)
return;
SvnClient.Instance.Client.Add(e.TargetFile, false);
}
}
}
}

6
src/AddIns/Misc/SubversionAddIn/Project/Src/Commands/Checkout/CheckoutCommand.cs

@ -16,9 +16,6 @@ using NSvn.Core; @@ -16,9 +16,6 @@ using NSvn.Core;
namespace ICSharpCode.Svn.Commands
{
/// <summary>
/// Description of CheckoutCommand
/// </summary>
public class CheckoutCommand : AbstractMenuCommand
{
string from = String.Empty;
@ -31,8 +28,7 @@ namespace ICSharpCode.Svn.Commands @@ -31,8 +28,7 @@ namespace ICSharpCode.Svn.Commands
/// </summary>
public CheckoutCommand()
{
// You can enable/disable the menu command using the
// IsEnabled property of the AbstractMenuCommand class
}
void DoCheckoutCommand()

7
src/AddIns/Misc/SubversionAddIn/Project/Src/Commands/Export/ExportDialog.cs

@ -42,10 +42,15 @@ namespace ICSharpCode.Svn.Commands @@ -42,10 +42,15 @@ namespace ICSharpCode.Svn.Commands
public string Source {
get {
return SourceIsLocalDirectory ? ControlDictionary["sourceDirectoryTextBox"].Text : ControlDictionary["urlTextBox"].Text;
return SourceIsLocalDirectory ? ConvertPathToURL(ControlDictionary["sourceDirectoryTextBox"].Text) : ControlDictionary["urlTextBox"].Text;
}
}
string ConvertPathToURL(string path)
{
return "file:///" + path.Replace('\\', '/');
}
public string Destination {
get {
return ControlDictionary["localDirectoryTextBox"].Text;

33
src/AddIns/Misc/SubversionAddIn/Project/Src/Commands/ProjectBrowserCommands.cs

@ -44,15 +44,20 @@ namespace ICSharpCode.Svn.Commands @@ -44,15 +44,20 @@ namespace ICSharpCode.Svn.Commands
}
if (StartOperation()) {
SvnClient.Instance.WaitForOperationEnd();
if (AddInOptions.AutomaticallyReloadProject) {
//projectService.ReloadCombine();
}
OperationFinished();
OverlayIconManager.EnqueueRecursive(node);
}
}
}
protected abstract bool StartOperation();
protected virtual void OperationFinished()
{
//if (AddInOptions.AutomaticallyReloadProject) {
// projectService.ReloadCombine();
//}
}
}
public class UpdateCommand : SubversionCommand
@ -78,9 +83,11 @@ namespace ICSharpCode.Svn.Commands @@ -78,9 +83,11 @@ namespace ICSharpCode.Svn.Commands
protected override bool StartOperation()
{
// TODO: Display warning message (Revert might cause loss of data)
SvnClient.Instance.OperationStart("Revert", new ThreadStart(DoRevertCommand));
return true;
if (MessageService.AskQuestion("Revert removes all your local modifications to this file. Are you sure?", "Subversion revert")) {
SvnClient.Instance.OperationStart("Revert", new ThreadStart(DoRevertCommand));
return true;
}
return false;
}
}
@ -108,17 +115,17 @@ namespace ICSharpCode.Svn.Commands @@ -108,17 +115,17 @@ namespace ICSharpCode.Svn.Commands
outStream,
errStream);
output = Encoding.Default.GetString(outStream.ToArray());
// TODO: Invoke the following method:
// FileService.NewFile("a.patch", "txt", output);
ICSharpCode.SharpDevelop.Gui.WorkbenchSingleton.SafeThreadAsyncCall(this, "DisplayPatch");
} catch (Exception e) {
MessageService.ShowError(e);
} finally {
if (output == null) {
output = "";
}
}
}
void DisplayPatch()
{
FileService.NewFile(Path.GetFileName(fileName) + ".patch", "patch", output);
}
protected override bool StartOperation()
{
SvnClient.Instance.OperationStart("CreatePatch", new ThreadStart(DoCreatePatchCommand));

30
src/AddIns/Misc/SubversionAddIn/Project/Src/Gui/ProjectBrowserVisitor/OverlayIconManager.cs

@ -9,6 +9,7 @@ using System; @@ -9,6 +9,7 @@ using System;
using System.Collections.Generic;
using System.Drawing;
using System.Threading;
using System.Windows.Forms;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop;
using ICSharpCode.SharpDevelop.Project;
@ -74,6 +75,7 @@ namespace ICSharpCode.Svn @@ -74,6 +75,7 @@ namespace ICSharpCode.Svn
case StatusKind.Deleted:
return GetImage(StatusIcon.Deleted);
case StatusKind.Modified:
case StatusKind.Replaced:
return GetImage(StatusIcon.Modified);
case StatusKind.Normal:
return GetImage(StatusIcon.OK);
@ -94,6 +96,32 @@ namespace ICSharpCode.Svn @@ -94,6 +96,32 @@ namespace ICSharpCode.Svn
}
}
public static void EnqueueRecursive(AbstractProjectBrowserTreeNode node)
{
lock (queue) {
bool wasEmpty = queue.Count == 0;
queue.Enqueue(node);
// use breadth-first search
Queue<AbstractProjectBrowserTreeNode> q = new Queue<AbstractProjectBrowserTreeNode>();
q.Enqueue(node);
while (q.Count > 0) {
node = q.Dequeue();
foreach (TreeNode n in node.Nodes) {
node = n as AbstractProjectBrowserTreeNode;
if (node != null) {
q.Enqueue(node);
queue.Enqueue(node);
}
}
}
if (wasEmpty) {
new ThreadStart(Run).BeginInvoke(null, null);
}
}
}
static Client client;
static void Run()
@ -131,7 +159,7 @@ namespace ICSharpCode.Svn @@ -131,7 +159,7 @@ namespace ICSharpCode.Svn
}
}
if (node.TreeView != null) {
node.TreeView.BeginInvoke(new ThreadStart(delegate() {
node.TreeView.BeginInvoke(new ThreadStart(delegate {
node.Overlay = GetImage(status);
}));
}

2
src/AddIns/Misc/SubversionAddIn/Project/Src/Gui/SubversionOptionsPanel.cs

@ -32,6 +32,7 @@ namespace ICSharpCode.Svn.Gui @@ -32,6 +32,7 @@ namespace ICSharpCode.Svn.Gui
SetupFromXmlStream(this.GetType().Assembly.GetManifestResourceStream("ICSharpCode.Svn.Resources.SubversionOptionsPanel.xfrm"));
ControlDictionary["logMessageTextBox"].Text = AddInOptions.DefaultLogMessage;
((CheckBox)ControlDictionary["autoAddFilesCheckBox"]).Checked = AddInOptions.AutomaticallyAddFiles;
((CheckBox)ControlDictionary["autoDeleteFilesCheckBox"]).Checked = AddInOptions.AutomaticallyDeleteFiles;
((CheckBox)ControlDictionary["autoReloadProjectCheckBox"]).Checked = AddInOptions.AutomaticallyReloadProject;
}
@ -39,6 +40,7 @@ namespace ICSharpCode.Svn.Gui @@ -39,6 +40,7 @@ namespace ICSharpCode.Svn.Gui
{
AddInOptions.DefaultLogMessage = ControlDictionary["logMessageTextBox"].Text;
AddInOptions.AutomaticallyAddFiles = ((CheckBox)ControlDictionary["autoAddFilesCheckBox"]).Checked;
AddInOptions.AutomaticallyDeleteFiles = ((CheckBox)ControlDictionary["autoDeleteFilesCheckBox"]).Checked;
AddInOptions.AutomaticallyReloadProject = ((CheckBox)ControlDictionary["autoReloadProjectCheckBox"]).Checked;
return true;

4
src/Libraries/ICSharpCode.TextEditor/Project/Resources/VBNET-Mode.xshd

@ -133,6 +133,7 @@ @@ -133,6 +133,7 @@
<KeyWords name = "OtherModifiers" bold="false" italic="false" color="Blue">
<Key word = "Const" />
<Key word = "Custom" />
<Key word = "Default" />
<Key word = "Global" />
<Key word = "MustInherit" />
@ -161,9 +162,6 @@ @@ -161,9 +162,6 @@
<Key word = "AddHandler" />
<Key word = "RemoveHandler" />
<Key word = "RaiseEvent" />
<Key word = "Custom" />
<Key word = "RemoveHandler" />
<Key word = "AddHandler" />
<Key word = "Option" />
<Key word = "Let" />
<Key word = "GoTo" />

6
src/Main/Base/Project/ICSharpCode.SharpDevelop.csproj

@ -199,7 +199,7 @@ @@ -199,7 +199,7 @@
<SubType>Form</SubType>
</Compile>
<Compile Include="Src\Gui\Dialogs\TipOfTheDay.cs">
<SubType>Form</SubType>
<SubType>UserControl</SubType>
</Compile>
<Compile Include="Src\Gui\Dialogs\TreeViewOptions.cs">
<SubType>Form</SubType>
@ -679,7 +679,9 @@ @@ -679,7 +679,9 @@
<Compile Include="Src\Dom\Implementations\CombinedReturnType.cs" />
<Compile Include="Src\TextEditor\Gui\Editor\CompletionWindow\CodeCompletionDataUsageCache.cs" />
<EmbeddedResource Include="Resources\CodeCompletionOptionPanel.xfrm" />
<Compile Include="Src\TextEditor\Gui\OptionPanels\CodeCompletionPanel.cs" />
<Compile Include="Src\TextEditor\Gui\OptionPanels\CodeCompletionPanel.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="Src\Dom\CodeCompletionOptions.cs" />
<Compile Include="Src\Services\Debugger\CurrentLineBookmark.cs" />
<Compile Include="Src\Dom\ClassFinder.cs" />

21
src/Main/Base/Project/Src/Commands/FileMenuCommands.cs

@ -7,6 +7,7 @@ @@ -7,6 +7,7 @@
using System;
using System.IO;
using System.Text;
using System.Windows.Forms;
using ICSharpCode.Core;
@ -34,8 +35,26 @@ namespace ICSharpCode.SharpDevelop.Project.Commands @@ -34,8 +35,26 @@ namespace ICSharpCode.SharpDevelop.Project.Commands
public override void Run()
{
using (OpenFileDialog fdiag = new OpenFileDialog()) {
AddInTreeNode addinTreeNode = AddInTree.GetTreeNode("/SharpDevelop/Workbench/Combine/FileFilter");
StringBuilder b = new StringBuilder("All known project formats|");
bool first = true;
foreach (Codon c in addinTreeNode.Codons) {
if (!first) {
b.Append(';');
} else {
first = false;
}
string ext = c.Properties.Get("extensions", "");
if (ext != "*.*" && ext.Length > 0) {
b.Append(ext);
}
}
foreach (string entry in addinTreeNode.BuildChildItems(this)) {
b.Append('|');
b.Append(entry);
}
fdiag.AddExtension = true;
fdiag.Filter = String.Join("|", (string[])(AddInTree.GetTreeNode("/SharpDevelop/Workbench/Combine/FileFilter").BuildChildItems(this)).ToArray(typeof(string)));
fdiag.Filter = b.ToString();
fdiag.Multiselect = false;
fdiag.CheckFileExists = true;
if (fdiag.ShowDialog(ICSharpCode.SharpDevelop.Gui.WorkbenchSingleton.MainForm) == DialogResult.OK) {

6
src/Main/Base/Project/Src/Gui/Pads/ProjectBrowser/ProjectBrowserControl.cs

@ -60,9 +60,9 @@ namespace ICSharpCode.SharpDevelop.Project @@ -60,9 +60,9 @@ namespace ICSharpCode.SharpDevelop.Project
public ProjectBrowserControl()
{
InitializeComponent();
treeView.AfterSelect += new TreeViewEventHandler(TreeViewAfterSelect);
FileService.FileRenaming += new FileRenameEventHandler(FileServiceFileRenaming);
FileService.FileRemoving += new FileEventHandler(FileServiceFileRemoving);
treeView.AfterSelect += TreeViewAfterSelect;
FileService.FileRenaming += FileServiceFileRenaming;
FileService.FileRemoving += FileServiceFileRemoving;
ProjectService.ProjectItemAdded += ProjectServiceProjectItemAdded;
ProjectService.SolutionFolderRemoved += ProjectServiceSolutionFolderRemoved;

26
src/Main/Base/Project/Src/Gui/Workbench/DefaultWorkbench.cs

@ -144,11 +144,11 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -144,11 +144,11 @@ namespace ICSharpCode.SharpDevelop.Gui
ProjectService.CurrentProjectChanged += new ProjectEventHandler(SetProjectTitle);
FileService.FileRemoved += new FileEventHandler(CheckRemovedFile);
FileService.FileRenamed += new FileRenameEventHandler(CheckRenamedFile);
FileService.FileRemoved += CheckRemovedFile;
FileService.FileRenamed += CheckRenamedFile;
FileService.FileRemoved += new FileEventHandler(FileService.RecentOpen.FileRemoved);
FileService.FileRenamed += new FileRenameEventHandler(FileService.RecentOpen.FileRenamed);
FileService.FileRemoved += FileService.RecentOpen.FileRemoved;
FileService.FileRenamed += FileService.RecentOpen.FileRenamed;
CreateMainMenu();
CreateToolBars();
@ -286,11 +286,13 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -286,11 +286,13 @@ namespace ICSharpCode.SharpDevelop.Gui
public Properties CreateMemento()
{
Properties properties = new Properties();
properties["bounds"] = normalBounds.X + "," + normalBounds.Y + "," + normalBounds.Width + "," + normalBounds.Height;
properties["bounds"] = normalBounds.X + "," + normalBounds.Y + "," + normalBounds.Width + "," + normalBounds.Height;
properties["windowstate"] = WindowState.ToString();
properties["defaultstate"]= defaultWindowState.ToString();
properties["fullscreen"] = fullscreen.ToString();
if (FullScreen || WindowState == FormWindowState.Minimized)
properties["windowstate"] = defaultWindowState.ToString();
else
properties["windowstate"] = WindowState.ToString();
properties["defaultstate"] = defaultWindowState.ToString();
return properties;
}
@ -312,10 +314,12 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -312,10 +314,12 @@ namespace ICSharpCode.SharpDevelop.Gui
protected override void OnResize(EventArgs e)
{
base.OnResize(e);
if (WindowState == FormWindowState.Normal) {
normalBounds = Bounds;
if (!FullScreen && WindowState != FormWindowState.Minimized) {
defaultWindowState = WindowState;
if (WindowState == FormWindowState.Normal) {
normalBounds = Bounds;
}
}
}
protected override void OnLocationChanged(EventArgs e)

37
src/Main/Base/Project/Src/Project/Converter/CombineToSolution.cs

@ -10,12 +10,11 @@ using System.Text; @@ -10,12 +10,11 @@ using System.Text;
using System.Text.RegularExpressions;
using System.IO;
using System.Collections.Generic;
using System.Xml;
using ICSharpCode.Core;
namespace ICSharpCode.SharpDevelop.Project.Converter
{
/// <summary>
/// Description of Class1.
/// </summary>
public static class CombineToSolution
{
static string ReadContent(string fileName)
@ -43,6 +42,14 @@ namespace ICSharpCode.SharpDevelop.Project.Converter @@ -43,6 +42,14 @@ namespace ICSharpCode.SharpDevelop.Project.Converter
}
}
static bool IsVisualBasic(string prjx)
{
using (XmlTextReader reader = new XmlTextReader(prjx)) {
reader.Read();
return reader.GetAttribute("projecttype") == "VBNET";
}
}
public static void ConvertSolution(Solution newSolution, string fileName)
{
List<string> projectFiles = new List<string>();
@ -53,12 +60,34 @@ namespace ICSharpCode.SharpDevelop.Project.Converter @@ -53,12 +60,34 @@ namespace ICSharpCode.SharpDevelop.Project.Converter
foreach (string path in projectFiles) {
string name = PrjxToSolutionProject.Conversion.GetProjectName(path);
conversion.NameToGuid[name] = Guid.NewGuid();
conversion.NameToPath[name] = Path.ChangeExtension(path, ".csproj");
if (IsVisualBasic(path))
conversion.NameToPath[name] = Path.ChangeExtension(path, ".vbproj");
else
conversion.NameToPath[name] = Path.ChangeExtension(path, ".csproj");
}
foreach (string path in projectFiles) {
conversion.IsVisualBasic = IsVisualBasic(path);
IProject newProject = PrjxToSolutionProject.ConvertOldProject(path, conversion);
newSolution.AddFolder(newProject);
}
if (conversion.Resources != null) {
const string resourceWarning = "There were resource files in the project.\n" +
"SharpDevelop 2 compiles resources different: the resource name " +
"is not just the file name; but it is prefixed with the root namespace " +
"and the directory name.\n\n" +
"The resources files have been renamed/moved accordingly.";
if (conversion.Resources.Count == 0) {
MessageService.ShowMessage(resourceWarning);
} else {
StringBuilder txt = new StringBuilder(resourceWarning);
txt.AppendLine();
txt.AppendLine();
txt.AppendLine("The following files could not be renamed/moved automatically:");
foreach (string r in conversion.Resources)
txt.AppendLine(r);
MessageService.ShowMessage(txt.ToString());
}
}
newSolution.Save();
}
}

192
src/Main/Base/Project/Src/Project/Converter/PrjxToSolutionProject.cs

@ -6,10 +6,10 @@ @@ -6,10 +6,10 @@
// </file>
using System;
using System.Collections.Generic;
using System.Text;
using System.Text.RegularExpressions;
using System.IO;
using System.Collections.Generic;
using System.Xml;
using System.Xml.XPath;
using System.Xml.Xsl;
@ -28,11 +28,19 @@ namespace ICSharpCode.SharpDevelop.Project.Converter @@ -28,11 +28,19 @@ namespace ICSharpCode.SharpDevelop.Project.Converter
public Dictionary<string, Guid> NameToGuid = new Dictionary<string, Guid>();
public Dictionary<string, string> NameToPath = new Dictionary<string, string>();
public bool IsVisualBasic;
public List<string> Resources;
public string basePath;
public string GetLanguageName()
{
return IsVisualBasic ? "VisualBasic" : "CSharp";
}
public string GetGuid(string name)
{
return "{" + NameToGuid[name] + "}";
return "{" + NameToGuid[name].ToString().ToUpper() + "}";
}
public string GetRelativeProjectPath(string name)
@ -40,24 +48,104 @@ namespace ICSharpCode.SharpDevelop.Project.Converter @@ -40,24 +48,104 @@ namespace ICSharpCode.SharpDevelop.Project.Converter
return FileUtility.GetRelativePath(basePath, NameToPath[name]);
}
public bool IsNotGacReference(string hintPath)
{
return FileUtility.IsBaseDirectory(FileUtility.NETFrameworkInstallRoot, hintPath);
}
string rootNamespace;
public string SetRootNamespace(string ns)
{
return rootNamespace = ns;
}
/// <summary>
/// Convert SharpDevelop 1.x resource to SharpDevelop 2.x resource.
/// SharpDevelop 1.x includes resources by their filename as resource,
/// SD 2.x/MsBuild also uses the project's root namespace and the directory name(s).
/// </summary>
public string ConvertResource(string fileName)
{
if (Resources == null)
Resources = new List<string>();
fileName = CanocializeFileName(fileName);
string name = Path.GetFileName(fileName);
if (rootNamespace.Length > 0) {
if (name.StartsWith(rootNamespace + ".")) {
name = name.Substring(rootNamespace.Length + 1);
name = ConvertResourceInternal(fileName, name);
if (name != null)
return name;
}
} else {
name = ConvertResourceInternal(fileName, name);
if (name != null)
return name;
}
Resources.Add(Path.Combine(basePath, fileName));
return fileName;
}
string ConvertResourceInternal(string fileName, string name)
{
string[] parts = name.Split('.');
string directory = basePath;
for (int i = 0; i < parts.Length; i++) {
if (Directory.Exists(Path.Combine(directory, parts[i]))) {
directory = Path.Combine(directory, parts[i]);
} else {
directory = Path.Combine(directory, parts[i]);
for (int j = i + 1; j < parts.Length; j++) {
directory += '.' + parts[j];
}
try {
File.Move(Path.Combine(basePath, fileName), directory);
return FileUtility.GetRelativePath(basePath, directory);
} catch {}
break;
}
}
return null;
}
public string CanocializeFileName(string fileName)
{
if (fileName.StartsWith("..\\") || fileName.StartsWith("../")) {
// work around a bug in older Fidalgo versions
if (!File.Exists(Path.Combine(basePath, fileName))) {
string fixedFileName = fileName.Substring(3);
if (File.Exists(Path.Combine(basePath, fixedFileName))) {
fileName = fixedFileName;
}
}
}
if (fileName.StartsWith("./") || fileName.StartsWith(".\\")) {
return fileName.Substring(2);
}
return fileName;
}
public string CanocializePath(string fileName)
public string CanocializePath(string fileName)
{
return CanocializeFileName(fileName) + Path.DirectorySeparatorChar;
}
public string Negate(string boolString)
{
return CanocializeFileName(fileName)+ Path.DirectorySeparatorChar;
return (!bool.Parse(boolString)).ToString();
}
public string GetFileName(string fileName)
public string GetFileName(string fileName)
{
return Path.GetFileName(fileName);
}
public string GetFileNameWithoutExtension(string fileName)
{
return Path.GetFileNameWithoutExtension(fileName);
}
public string ConvertBuildEvent(string executeScript, string arguments)
{
if (executeScript == null || executeScript.Length == 0) {
@ -85,61 +173,69 @@ namespace ICSharpCode.SharpDevelop.Project.Converter @@ -85,61 +173,69 @@ namespace ICSharpCode.SharpDevelop.Project.Converter
}
}
static void RunConverter(string inFile, string outFile, string script, Conversion conversion)
static Dictionary<string, XslCompiledTransform> xsltDict = new Dictionary<string, XslCompiledTransform>();
public static void RunConverter(string inFile, string outFile, string script, Conversion conversion)
{
conversion.basePath = Path.GetDirectoryName(inFile);
//Create a new XslTransform object.
XslTransform xslt = new XslTransform();
//Load the stylesheet.
xslt.Load(FileUtility.Combine(PropertyService.DataDirectory, "ConversionStyleSheets", script));
//Create a new XPathDocument and load the XML data to be transformed.
XPathDocument mydata = new XPathDocument(inFile);
//Create an XmlTextWriter which outputs to the console.
using (XmlTextWriter writer = new XmlTextWriter(outFile, Encoding.UTF8)) {
writer.Formatting = Formatting.Indented;
XsltArgumentList argList = new XsltArgumentList();
argList.AddExtensionObject("urn:Conversion", conversion);
XslCompiledTransform xslt;
if (xsltDict.ContainsKey(script)) {
xslt = xsltDict[script];
} else {
//Create a new XslTransform object.
xslt = new XslCompiledTransform();
//Load the stylesheet.
xslt.Load(FileUtility.Combine(PropertyService.DataDirectory, "ConversionStyleSheets", script));
//Transform the data and send the output to the console.
xslt.Transform(mydata,argList,writer, null);
}
// System.Xml.Xsl.XslCompiledTransform xslt = new System.Xml.Xsl.XslCompiledTransform();
//
// xslt.Compile(FileUtility.Combine(PropertyService.DataDirectory, "ConversionStyleSheets", script));
//
// XmlArgumentList argList = new XmlArgumentList();
//
// argList.AddExtensionObject("urn:Conversion", conversion);
//
// if (File.Exists(outFile)) {
// File.Delete(outFile);
// }
// using (Stream outStream = File.OpenWrite(outFile)) {
// xslt.Execute(inFile, new XmlUrlResolver(), argList, outStream);
// }
xsltDict[script] = xslt;
}
using (XmlTextReader reader = new XmlTextReader(inFile)) {
//Create an XmlTextWriter which outputs to the console.
using (XmlTextWriter writer = new XmlTextWriter(outFile, Encoding.UTF8)) {
writer.Formatting = Formatting.Indented;
XsltArgumentList argList = new XsltArgumentList();
argList.AddExtensionObject("urn:Conversion", conversion);
//Transform the data and send the output to the console.
xslt.Transform(reader, argList, writer, null);
}
}
}
public static IProject ConvertOldProject(string fileName, Conversion conversion)
{
string convertedFileName = Path.ChangeExtension(fileName, ".csproj");
RunConverter(fileName,
convertedFileName,
"CSharp_prjx2csproj.xsl",
conversion);
string convertedFileName;
if (conversion.IsVisualBasic)
convertedFileName = Path.ChangeExtension(fileName, ".vbproj");
else
convertedFileName = Path.ChangeExtension(fileName, ".csproj");
RunConverter(fileName, convertedFileName, "CSharp_prjx2csproj.xsl", conversion);
RunConverter(fileName,
convertedFileName + ".user",
"CSharp_prjx2csproj_user.xsl",
conversion);
RunConverter(fileName, convertedFileName + ".user", "CSharp_prjx2csproj_user.xsl", conversion);
ILanguageBinding binding = LanguageBindingService.GetBindingPerProjectFile(convertedFileName);
return binding.LoadProject(convertedFileName, Conversion.GetProjectName(fileName));
}
public static void ConvertVSNetProject(string fileName)
{
string old = fileName + ".old";
string userFile = fileName + ".user";
string oldUserFile = fileName + ".user.old";
File.Copy(fileName, old, true);
File.Delete(fileName);
File.Copy(userFile, oldUserFile, true);
File.Delete(userFile);
Conversion conversion = new Conversion();
if (Path.GetExtension(fileName).ToLower() == ".vbproj")
conversion.IsVisualBasic = true;
Solution.ReadSolutionInformation(Solution.SolutionBeingLoaded.FileName, conversion);
RunConverter(old, fileName, "vsnet2msbuild.xsl", conversion);
RunConverter(oldUserFile, userFile, "vsnet2msbuild_user.xsl", conversion);
}
}
}

15
src/Main/Base/Project/Src/Project/MSBuildProject.cs

@ -74,17 +74,24 @@ namespace ICSharpCode.SharpDevelop.Project @@ -74,17 +74,24 @@ namespace ICSharpCode.SharpDevelop.Project
{
this.fileName = projectFileName;
using (XmlTextReader reader = new XmlTextReader(projectFileName)) {
while (reader.Read()) {
reader.Read();
if (reader.Name == "VisualStudioProject") {
reader.Close();
Converter.PrjxToSolutionProject.ConvertVSNetProject(projectFileName);
SetupProject(projectFileName);
return;
}
do {
if (reader.IsStartElement()) {
switch (reader.LocalName) {
case "PropertyGroup":
string condition = reader.GetAttribute("Condition");
PropertyGroup propertyGroup = ReadPropertyGroup(reader);
if (condition == null) {
condition = String.Empty;
}
string configuration;
Match match = configurationRegEx.Match(condition);
if (match.Success) {
@ -107,7 +114,7 @@ namespace ICSharpCode.SharpDevelop.Project @@ -107,7 +114,7 @@ namespace ICSharpCode.SharpDevelop.Project
break;
}
}
}
} while (reader.Read());
}
string userSettingsFileName = projectFileName + ".user";

57
src/Main/Base/Project/Src/Project/Solution/Solution.cs

@ -354,11 +354,42 @@ namespace ICSharpCode.SharpDevelop.Project @@ -354,11 +354,42 @@ namespace ICSharpCode.SharpDevelop.Project
static Regex projectLinePattern = new Regex("Project\\(\"(?<ProjectGuid>.*)\"\\)\\s+=\\s+\"(?<Title>.*)\",\\s*\"(?<Location>.*)\",\\s*\"(?<Guid>.*)\"", RegexOptions.Compiled);
static Regex globalSectionPattern = new Regex("\\s*GlobalSection\\((?<Name>.*)\\)\\s*=\\s*(?<Type>.*)", RegexOptions.Compiled);
/// <summary>
/// Reads the specified solution file. The project-location-guid information is written into the conversion class.
/// </summary>
/// <returns>The version number of the solution.</returns>
public static string ReadSolutionInformation(string solutionFileName, Converter.PrjxToSolutionProject.Conversion conversion)
{
string solutionDirectory = Path.GetDirectoryName(solutionFileName);
using (StreamReader sr = File.OpenText(solutionFileName)) {
string line = sr.ReadLine();
Match match = versionPattern.Match(line);
if (!match.Success) {
return null;
}
string version = match.Result("${Version}");
while ((line = sr.ReadLine()) != null) {
match = projectLinePattern.Match(line);
if (match.Success) {
string projectGuid = match.Result("${ProjectGuid}");
string title = match.Result("${Title}");
string location = Path.Combine(solutionDirectory, match.Result("${Location}"));
string guid = match.Result("${Guid}");
conversion.NameToGuid.Add(title, new Guid(guid));
conversion.NameToPath.Add(title, location);
}
}
return version;
}
}
static bool SetupSolution(Solution newSolution, string fileName)
{
string solutionDirectory = Path.GetDirectoryName(fileName);
ProjectSection nestedProjectsSection = null;
bool needsConversion = false;
using (StreamReader sr = File.OpenText(fileName)) {
string line = sr.ReadLine();
Match match = versionPattern.Match(line);
@ -369,19 +400,21 @@ namespace ICSharpCode.SharpDevelop.Project @@ -369,19 +400,21 @@ namespace ICSharpCode.SharpDevelop.Project
switch (match.Result("${Version}")) {
case "7.00":
if (!MessageService.AskQuestion("Found VS.NET 2000 Project. Should I convert it to Solution Format 9.00 (VS.NET 2005) ?")) {
needsConversion = true;
if (!MessageService.AskQuestion("Found Visual Studio.NET Project. Should I convert it to Solution Format 9.00 (Visual Studio 2005) ?")) {
return false;
}
break;
case "8.00":
if (!MessageService.AskQuestion("Found VS.NET 2003 Project. Should I convert it to Solution Format 9.00 (VS.NET 2005) ?")) {
needsConversion = true;
if (!MessageService.AskQuestion("Found Visual Studio.NET 2003 Project. Should I convert it to Solution Format 9.00 (Visual Studio 2005) ?")) {
return false;
}
break;
case "9.00":
break;
default:
MessageService.ShowError("Can't read Microsoft Solution file format " + match.Result("${Version}") + ". Use Visual Studio.NET to convert it to a newer version.");
MessageService.ShowError("Can't read Microsoft Solution file format " + match.Result("${Version}") + ".");
return false;
}
@ -444,16 +477,32 @@ namespace ICSharpCode.SharpDevelop.Project @@ -444,16 +477,32 @@ namespace ICSharpCode.SharpDevelop.Project
folder.AddFolder(newSolution.guidDictionary[from]);
}
}
if (needsConversion) {
// save in new format
newSolution.Save();
}
return true;
}
static Solution solutionBeingLoaded;
public static Solution SolutionBeingLoaded {
get {
return solutionBeingLoaded;
}
}
public static Solution Load(string fileName)
{
Solution newSolution = new Solution();
solutionBeingLoaded = newSolution;
newSolution.Name = Path.GetFileNameWithoutExtension(fileName);
bool loadCombine = Path.GetExtension(fileName).ToUpper() == ".CMBX";
if (loadCombine) {
if (!MessageService.AskQuestion("Should the SharpDevelop 1.x combine be converted into a SharpDevelop 2.x solution?")) {
return null;
}
newSolution.fileName = Path.ChangeExtension(fileName, ".sln");
ICSharpCode.SharpDevelop.Project.Converter.CombineToSolution.ConvertSolution(newSolution, fileName);
} else {
@ -462,6 +511,8 @@ namespace ICSharpCode.SharpDevelop.Project @@ -462,6 +511,8 @@ namespace ICSharpCode.SharpDevelop.Project
return null;
}
}
solutionBeingLoaded = null;
return newSolution;
}

33
src/Main/Base/Project/Src/Services/File/FileEventArgs.cs

@ -10,12 +10,10 @@ using ICSharpCode.SharpDevelop.Project; @@ -10,12 +10,10 @@ using ICSharpCode.SharpDevelop.Project;
namespace ICSharpCode.Core
{
public delegate void FileEventHandler(object sender, FileEventArgs e);
public class FileEventArgs : EventArgs
{
string fileName = null;
bool isDirectory;
public string FileName {
@ -36,4 +34,33 @@ namespace ICSharpCode.Core @@ -36,4 +34,33 @@ namespace ICSharpCode.Core
this.isDirectory = isDirectory;
}
}
public class FileCancelEventArgs : FileEventArgs
{
bool cancel;
public bool Cancel {
get {
return cancel;
}
set {
cancel = value;
}
}
bool operationAlreadyDone;
public bool OperationAlreadyDone {
get {
return operationAlreadyDone;
}
set {
operationAlreadyDone = value;
}
}
public FileCancelEventArgs(string fileName, bool isDirectory) : base(fileName, isDirectory)
{
}
}
}

30
src/Main/Base/Project/Src/Services/File/FileRenameEventArgs.cs

@ -10,7 +10,35 @@ using ICSharpCode.SharpDevelop.Project; @@ -10,7 +10,35 @@ using ICSharpCode.SharpDevelop.Project;
namespace ICSharpCode.Core
{
public delegate void FileRenameEventHandler(object sender, FileRenameEventArgs e);
public class FileRenamingEventArgs : FileRenameEventArgs
{
bool cancel;
public bool Cancel {
get {
return cancel;
}
set {
cancel = value;
}
}
bool operationAlreadyDone;
public bool OperationAlreadyDone {
get {
return operationAlreadyDone;
}
set {
operationAlreadyDone = value;
}
}
public FileRenamingEventArgs(string sourceFile, string targetFile, bool isDirectory)
: base(sourceFile, targetFile, isDirectory)
{
}
}
public class FileRenameEventArgs : EventArgs
{

82
src/Main/Base/Project/Src/Services/File/FileService.cs

@ -185,24 +185,29 @@ namespace ICSharpCode.Core @@ -185,24 +185,29 @@ namespace ICSharpCode.Core
public static void RemoveFile(string fileName, bool isDirectory)
{
OnFileRemoving(new FileEventArgs(fileName, isDirectory));
if (isDirectory) {
try {
if (Directory.Exists(fileName)) {
Directory.Delete(fileName, true);
}
} catch (Exception e) {
MessageService.ShowError(e, "Can't remove directory " + fileName);
FileCancelEventArgs eargs = new FileCancelEventArgs(fileName, isDirectory);
OnFileRemoving(eargs);
if (eargs.Cancel)
return;
if (!eargs.OperationAlreadyDone) {
if (isDirectory) {
try {
if (Directory.Exists(fileName)) {
Directory.Delete(fileName, true);
}
} catch (Exception e) {
MessageService.ShowError(e, "Can't remove directory " + fileName);
// return;
}
} else {
try {
if (File.Exists(fileName)) {
File.Delete(fileName);
}
} catch (Exception e) {
MessageService.ShowError(e, "Can't remove file " + fileName);
} else {
try {
if (File.Exists(fileName)) {
File.Delete(fileName);
}
} catch (Exception e) {
MessageService.ShowError(e, "Can't remove file " + fileName);
// return;
}
}
}
OnFileRemoved(new FileEventArgs(fileName, isDirectory));
@ -210,24 +215,29 @@ namespace ICSharpCode.Core @@ -210,24 +215,29 @@ namespace ICSharpCode.Core
public static void RenameFile(string oldName, string newName, bool isDirectory)
{
OnFileRenaming(new FileRenameEventArgs(oldName, newName, isDirectory));
try {
if (isDirectory) {
if (Directory.Exists(oldName)) {
Directory.Move(oldName, newName);
FileRenamingEventArgs eargs = new FileRenamingEventArgs(oldName, newName, isDirectory);
OnFileRenaming(eargs);
if (eargs.Cancel)
return;
if (!eargs.OperationAlreadyDone) {
try {
if (isDirectory) {
if (Directory.Exists(oldName)) {
Directory.Move(oldName, newName);
}
} else {
if (File.Exists(oldName)) {
File.Move(oldName, newName);
}
}
} else {
if (File.Exists(oldName)) {
File.Move(oldName, newName);
} catch (Exception e) {
if (isDirectory) {
MessageService.ShowError(e, "Can't rename directory " + oldName);
} else {
MessageService.ShowError(e, "Can't rename file " + oldName);
}
return;
}
} catch (Exception e) {
if (isDirectory) {
MessageService.ShowError(e, "Can't rename directory " + oldName);
} else {
MessageService.ShowError(e, "Can't rename file " + oldName);
}
// return;
}
OnFileRenamed(new FileRenameEventArgs(oldName, newName, isDirectory));
}
@ -280,7 +290,7 @@ namespace ICSharpCode.Core @@ -280,7 +290,7 @@ namespace ICSharpCode.Core
}
}
static void OnFileRemoving(FileEventArgs e)
static void OnFileRemoving(FileCancelEventArgs e)
{
if (FileRemoving != null) {
FileRemoving(null, e);
@ -294,16 +304,16 @@ namespace ICSharpCode.Core @@ -294,16 +304,16 @@ namespace ICSharpCode.Core
}
}
static void OnFileRenaming(FileRenameEventArgs e) {
static void OnFileRenaming(FileRenamingEventArgs e) {
if (FileRenaming != null) {
FileRenaming(null, e);
}
}
public static event FileRenameEventHandler FileRenaming;
public static event FileRenameEventHandler FileRenamed;
public static event EventHandler<FileRenamingEventArgs> FileRenaming;
public static event EventHandler<FileRenameEventArgs> FileRenamed;
public static event FileEventHandler FileRemoving;
public static event FileEventHandler FileRemoved;
public static event EventHandler<FileCancelEventArgs> FileRemoving;
public static event EventHandler<FileEventArgs> FileRemoved;
}
}

8
src/Main/Base/Project/Src/Services/ParserService/ReflectionProjectContent.cs

@ -28,8 +28,12 @@ namespace ICSharpCode.Core @@ -28,8 +28,12 @@ namespace ICSharpCode.Core
ICompilationUnit assemblyCompilationUnit = new DefaultCompilationUnit(this);
foreach (Type type in assembly.GetExportedTypes()) {
AddClassToNamespaceListInternal(new ReflectionClass(assemblyCompilationUnit, type, null));
try {
foreach (Type type in assembly.GetExportedTypes()) {
AddClassToNamespaceListInternal(new ReflectionClass(assemblyCompilationUnit, type, null));
}
} catch (Exception ex) {
MessageService.ShowError(ex);
}
if (assembly == typeof(void).Assembly) {

6
src/Main/Base/Project/Src/Services/ProjectService/ProjectService.cs

@ -50,8 +50,8 @@ namespace ICSharpCode.SharpDevelop.Project @@ -50,8 +50,8 @@ namespace ICSharpCode.SharpDevelop.Project
static ProjectService()
{
WorkbenchSingleton.Workbench.ActiveWorkbenchWindowChanged += new EventHandler(ActiveWindowChanged);
FileService.FileRenamed += new FileRenameEventHandler(FileServiceFileRenamed);
FileService.FileRemoved += new FileEventHandler(FileServiceFileRemoved);
FileService.FileRenamed += FileServiceFileRenamed;
FileService.FileRemoved += FileServiceFileRemoved;
}
static void FileServiceFileRenamed(object sender, FileRenameEventArgs e)
@ -162,6 +162,8 @@ namespace ICSharpCode.SharpDevelop.Project @@ -162,6 +162,8 @@ namespace ICSharpCode.SharpDevelop.Project
public static void LoadSolution(string fileName)
{
openSolution = Solution.Load(fileName);
if (openSolution == null)
return;
OnSolutionLoaded(new SolutionEventArgs(openSolution));
try {
foreach (IProject project in openSolution.Projects) {

4
src/Main/Base/Project/Src/Services/Tasks/TaskService.cs

@ -91,8 +91,8 @@ namespace ICSharpCode.Core @@ -91,8 +91,8 @@ namespace ICSharpCode.Core
static TaskService()
{
FileService.FileRenamed += new FileRenameEventHandler(CheckFileRename);
FileService.FileRemoved += new FileEventHandler(CheckFileRemove);
FileService.FileRenamed += CheckFileRename;
FileService.FileRemoved += CheckFileRemove;
ProjectService.SolutionClosed += new EventHandler(ProjectServiceSolutionClosed);
}

2
src/Main/Base/Project/Src/TextEditor/Gui/Editor/CompletionWindow/AbstractCompletionDataProvider.cs

@ -30,7 +30,7 @@ namespace ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor @@ -30,7 +30,7 @@ namespace ICSharpCode.SharpDevelop.DefaultEditor.Gui.Editor
}
}
int defaultIndex;
int defaultIndex = -1;
public int DefaultIndex {
get {

Loading…
Cancel
Save