Browse Source
Conflicts: src/AddIns/Misc/PackageManagement/Project/PackageManagement.addin src/AddIns/Misc/PackageManagement/Test/Src/PackageManagementOptionsTests.cs src/Main/Base/Project/ICSharpCode.SharpDevelop.csproj src/Main/Base/Project/Src/Project/Behaviors/DotNetStartBehavior.cs src/Main/Base/Project/Src/Services/IconService.cs src/Main/Base/Test/ICSharpCode.SharpDevelop.Tests.csproj src/Main/Base/Test/MimeDetectionTests.cspull/59/merge
62 changed files with 685 additions and 251 deletions
@ -0,0 +1,62 @@ |
|||||||
|
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||||
|
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||||
|
|
||||||
|
using System; |
||||||
|
using System.Resources; |
||||||
|
using ICSharpCode.Core; |
||||||
|
using NUnit.Framework; |
||||||
|
|
||||||
|
namespace PythonBinding.Tests.Designer |
||||||
|
{ |
||||||
|
/// <summary>
|
||||||
|
/// Tests that only the InitializeComponents method is processed
|
||||||
|
/// when walking the AST.
|
||||||
|
/// </summary>
|
||||||
|
[TestFixture] |
||||||
|
public class AssignmentAfterFormClassTests : LoadFormTestFixtureBase |
||||||
|
{ |
||||||
|
public override void BeforeSetUpFixture() |
||||||
|
{ |
||||||
|
var rm = new ResourceManager("PythonBinding.Tests.Strings", GetType().Assembly); |
||||||
|
ResourceService.RegisterNeutralStrings(rm); |
||||||
|
} |
||||||
|
|
||||||
|
public override string PythonCode { |
||||||
|
get { |
||||||
|
return |
||||||
|
"import clr\r\n" + |
||||||
|
"clr.AddReference('System.Windows.Forms')\r\n" + |
||||||
|
"clr.AddReference('System.Drawing')\r\n" + |
||||||
|
"\r\n" + |
||||||
|
"import System.Drawing\r\n" + |
||||||
|
"import System.Windows.Forms\r\n" + |
||||||
|
"\r\n" + |
||||||
|
"from System.Drawing import *\r\n" + |
||||||
|
"from System.Windows.Forms import *\r\n" + |
||||||
|
"\r\n" + |
||||||
|
"class MainForm(System.Windows.Forms.Form):\r\n" + |
||||||
|
" def __init__(self):\r\n" + |
||||||
|
" self.InitializeComponent()\r\n" + |
||||||
|
" \r\n" + |
||||||
|
" def InitializeComponent(self):\r\n" + |
||||||
|
" self.SuspendLayout()\r\n" + |
||||||
|
" # \r\n" + |
||||||
|
" # MainForm\r\n" + |
||||||
|
" # \r\n" + |
||||||
|
" self.ClientSize = System.Drawing.Size(300, 400)\r\n" + |
||||||
|
" self.Name = \"MainForm\"\r\n" + |
||||||
|
" self.ResumeLayout(False)\r\n" + |
||||||
|
"\r\n" + |
||||||
|
"test = MainForm()\r\n" + |
||||||
|
"Application.Run(test)\r\n" + |
||||||
|
"\r\n"; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
[Test] |
||||||
|
public void MainFormName() |
||||||
|
{ |
||||||
|
Assert.AreEqual("MainForm", Form.Name); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,13 @@ |
|||||||
|
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
||||||
|
<PropertyGroup> |
||||||
|
<PrepareForRunDependsOn>$(PrepareForRunDependsOn);MyPostBuildTarget</PrepareForRunDependsOn> |
||||||
|
</PropertyGroup> |
||||||
|
<ItemGroup> |
||||||
|
<MyCopyItem Include="$(MSBuildProjectDirectory)\..\RequiredLibraries\NuGet.exe" /> |
||||||
|
</ItemGroup> |
||||||
|
<Target Name="MyPostBuildTarget"> |
||||||
|
<!-- work around an MSBuild bug in CopyToOutputDirectory that causes this file to be copied --> |
||||||
|
<!-- to projects referencing this project even if local copy on that reference is false --> |
||||||
|
<Copy SourceFiles="@(MyCopyItem)" DestinationFolder="$(OutputPath)" /> |
||||||
|
</Target> |
||||||
|
</Project> |
@ -0,0 +1,21 @@ |
|||||||
|
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||||
|
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||||
|
|
||||||
|
using System; |
||||||
|
using System.IO; |
||||||
|
|
||||||
|
namespace ICSharpCode.PackageManagement |
||||||
|
{ |
||||||
|
public static class NuGetExePath |
||||||
|
{ |
||||||
|
public static string GetPath() |
||||||
|
{ |
||||||
|
return Path.Combine(GetDirectory(), "NuGet.exe"); |
||||||
|
} |
||||||
|
|
||||||
|
static string GetDirectory() |
||||||
|
{ |
||||||
|
return Path.GetDirectoryName(typeof(NuGetExePath).Assembly.Location); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,31 @@ |
|||||||
|
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||||
|
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||||
|
|
||||||
|
using System; |
||||||
|
using System.Collections.Generic; |
||||||
|
using ICSharpCode.SharpDevelop.Project; |
||||||
|
|
||||||
|
namespace ICSharpCode.PackageManagement |
||||||
|
{ |
||||||
|
public class NuGetPackageRestoreCommandLine |
||||||
|
{ |
||||||
|
List<string> arguments = new List<string>(); |
||||||
|
|
||||||
|
public NuGetPackageRestoreCommandLine(IPackageManagementSolution solution) |
||||||
|
{ |
||||||
|
GenerateCommandLine(solution); |
||||||
|
} |
||||||
|
|
||||||
|
public string Command { get; set; } |
||||||
|
|
||||||
|
public string[] Arguments { |
||||||
|
get { return arguments.ToArray(); } |
||||||
|
} |
||||||
|
|
||||||
|
void GenerateCommandLine(IPackageManagementSolution solution) |
||||||
|
{ |
||||||
|
arguments.Add("restore"); |
||||||
|
arguments.Add(solution.FileName); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,62 @@ |
|||||||
|
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||||
|
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||||
|
|
||||||
|
using System; |
||||||
|
using System.IO; |
||||||
|
using ICSharpCode.Core; |
||||||
|
using ICSharpCode.SharpDevelop; |
||||||
|
using ICSharpCode.SharpDevelop.Gui; |
||||||
|
|
||||||
|
namespace ICSharpCode.PackageManagement |
||||||
|
{ |
||||||
|
public class RestorePackagesCommand : AbstractMenuCommand |
||||||
|
{ |
||||||
|
IPackageManagementOutputMessagesView outputMessagesView; |
||||||
|
IPackageManagementSolution solution; |
||||||
|
|
||||||
|
public RestorePackagesCommand() |
||||||
|
: this(PackageManagementServices.OutputMessagesView, PackageManagementServices.Solution) |
||||||
|
{ |
||||||
|
} |
||||||
|
|
||||||
|
public RestorePackagesCommand( |
||||||
|
IPackageManagementOutputMessagesView outputMessagesView, |
||||||
|
IPackageManagementSolution solution) |
||||||
|
{ |
||||||
|
this.outputMessagesView = outputMessagesView; |
||||||
|
this.solution = solution; |
||||||
|
} |
||||||
|
|
||||||
|
public override void Run() |
||||||
|
{ |
||||||
|
try { |
||||||
|
ClearOutputWindow(); |
||||||
|
BringOutputWindowToFront(); |
||||||
|
RunRestore(); |
||||||
|
} catch (Exception ex) { |
||||||
|
LoggingService.Debug(ex.ToString()); |
||||||
|
outputMessagesView.AppendLine(ex.Message); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
void ClearOutputWindow() |
||||||
|
{ |
||||||
|
outputMessagesView.Clear(); |
||||||
|
} |
||||||
|
|
||||||
|
void BringOutputWindowToFront() |
||||||
|
{ |
||||||
|
CompilerMessageView.Instance.BringToFront(); |
||||||
|
} |
||||||
|
|
||||||
|
void RunRestore() |
||||||
|
{ |
||||||
|
var commandLine = new NuGetPackageRestoreCommandLine(solution); |
||||||
|
commandLine.Command = NuGetExePath.GetPath(); |
||||||
|
|
||||||
|
var runner = new ProcessRunner(); |
||||||
|
runner.WorkingDirectory = Path.GetDirectoryName(solution.FileName); |
||||||
|
runner.RunInOutputPadAsync(outputMessagesView.OutputCategory, commandLine.Command, commandLine.Arguments); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,37 @@ |
|||||||
|
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||||
|
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||||
|
|
||||||
|
using System; |
||||||
|
using ICSharpCode.PackageManagement; |
||||||
|
using NUnit.Framework; |
||||||
|
using Rhino.Mocks; |
||||||
|
|
||||||
|
namespace PackageManagement.Tests |
||||||
|
{ |
||||||
|
[TestFixture] |
||||||
|
public class NuGetPackageRestoreCommandLineTests |
||||||
|
{ |
||||||
|
NuGetPackageRestoreCommandLine commandLine; |
||||||
|
|
||||||
|
void CreateCommandLineWithSolution(string fileName) |
||||||
|
{ |
||||||
|
IPackageManagementSolution solution = MockRepository.GenerateStub<IPackageManagementSolution>(); |
||||||
|
solution.Stub(s => s.FileName).Return(fileName); |
||||||
|
commandLine = new NuGetPackageRestoreCommandLine(solution); |
||||||
|
} |
||||||
|
|
||||||
|
[Test] |
||||||
|
public void Arguments_RestoreSolution_SolutionFullFileNameUsed() |
||||||
|
{ |
||||||
|
CreateCommandLineWithSolution(@"d:\projects\MySolution\MySolution.sln"); |
||||||
|
|
||||||
|
string[] arguments = commandLine.Arguments; |
||||||
|
|
||||||
|
string[] expectedArguments = new string[] { |
||||||
|
"restore", |
||||||
|
@"d:\projects\MySolution\MySolution.sln" |
||||||
|
}; |
||||||
|
CollectionAssert.AreEqual(expectedArguments, arguments); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,50 @@ |
|||||||
|
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||||
|
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||||
|
|
||||||
|
using ICSharpCode.Core; |
||||||
|
using System; |
||||||
|
using System.Collections.Generic; |
||||||
|
using System.Drawing; |
||||||
|
|
||||||
|
namespace ICSharpCode.SharpDevelop |
||||||
|
{ |
||||||
|
/// <summary>
|
||||||
|
/// This Class handles bitmap resources
|
||||||
|
/// for the application which were loaded from the filesystem.
|
||||||
|
/// </summary>
|
||||||
|
public static class FileIconService |
||||||
|
{ |
||||||
|
static Dictionary<string, Bitmap> bitmapCache = new Dictionary<string, Bitmap>(); |
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Returns a bitmap from the file system. Placeholders like ${SharpDevelopBinPath}
|
||||||
|
/// and AddinPath (e. g. ${AddInPath:ICSharpCode.FiletypeRegisterer}) are resolved
|
||||||
|
/// through the StringParser.
|
||||||
|
/// The bitmaps are reused, you must not dispose the Bitmap!
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>
|
||||||
|
/// The bitmap loaded from the file system.
|
||||||
|
/// </returns>
|
||||||
|
/// <param name="name">
|
||||||
|
/// The name of the requested bitmap (prefix, path and filename).
|
||||||
|
/// </param>
|
||||||
|
/// <exception cref="FileNotFoundException">
|
||||||
|
/// Is thrown when the bitmap was not found in the file system.
|
||||||
|
/// </exception>
|
||||||
|
public static Bitmap GetBitmap(string name) |
||||||
|
{ |
||||||
|
Bitmap bmp = null; |
||||||
|
if (name.ToUpper().StartsWith("FILE:")) { |
||||||
|
lock (bitmapCache) { |
||||||
|
if (bitmapCache.TryGetValue(name, out bmp)) |
||||||
|
return bmp; |
||||||
|
string fileName = StringParser.Parse(name.Substring(5, name.Length - 5)); |
||||||
|
bmp = (Bitmap)Image.FromFile(fileName); |
||||||
|
bitmapCache[name] = bmp; |
||||||
|
} |
||||||
|
} |
||||||
|
return bmp; |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
Loading…
Reference in new issue