mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-05 02:36:19 +02:00
Self-contained .NET (#22217)
* dotnet sc
* MD preview - C# app
- working self-contained
* Gcode preview - C# app
* DevFiles preview - C# app
* Fix passing path with spaces as cmd arg and monacocpp proj file
* Pdf preview - C# app
* Svg preview - C# app
* Fix comment
* Gcode thumbnail - C# app
TODO:
- installer
- why IThumbnailProvider and IIntializeWithFile doesn't work?
* Pdf thumbnail - C# app
TODO:
- installer
- why IThumbnailProvider and IIntializeWithFile doesn't work?
* Pdf thumbnail - C# app
TODO:
- installer
- why IThumbnailProvider and IIntializeWithFile doesn't work?
* Fix GcodeThumbnailProviderCpp.vcxproj
* Svg thumbnail - C# app
TODO:
- installer
- why IThumbnailProvider and IIntializeWithFile doesn't work?
* Fix Svg tests
* Thumbnail providers - installer
* Self-contained Hosts and FileLocksmith
* Fix hardcoded <RuntimeIdentifier>
* Remove unneeded files
* Try to fix Nuget in PR CI
* Prefix new dlls with PowerToys.
Sign new dlls and exes
* Add new .exe files to ProcessList
* ci: debug by listing all env vars
* ci: try setting variable in the right ci file
* Bring back hardcoded RuntimeIdentifier
* ci: Add comment and remove debug action
* Remove unneeded lib
* [WIP] Platform conditional dotnet files & hardlinks
* Cleanup
* Update expect.txt
* Test fix - ARM installer
* Fix uninstall bug
* Update docs
* Fix failing test
* Add dll details
* Minor cleanup
* Improve resizing
* Add some logs
* Test fix - release build
* Remove InvokeOnControlThread
* Test fix: logger initialization
* Fix arm64 installer
Co-authored-by: Jaime Bernardo <jaime@janeasystems.com>
Co-authored-by: Dustin L. Howett <dustin@howett.net>
This commit is contained in:
@@ -0,0 +1,4 @@
|
||||
<svg viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg">
|
||||
<circle cx="50" cy="50" r="50">
|
||||
</circle>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 119 B |
@@ -0,0 +1,5 @@
|
||||
<svg viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg">
|
||||
<script>alert("hello")</script>
|
||||
<circle cx="50" cy="50" r="50">
|
||||
</circle>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 156 B |
@@ -32,7 +32,7 @@ namespace SvgPreviewHandlerUnitTests
|
||||
using (var svgPreviewControl = new SvgPreviewControl())
|
||||
{
|
||||
// Act
|
||||
svgPreviewControl.DoPreview(GetMockStream("<svg></svg>"));
|
||||
svgPreviewControl.DoPreview("HelperFiles/file1.svg");
|
||||
|
||||
int beforeTick = Environment.TickCount;
|
||||
|
||||
@@ -55,7 +55,7 @@ namespace SvgPreviewHandlerUnitTests
|
||||
using (var svgPreviewControl = new SvgPreviewControl())
|
||||
{
|
||||
// Act
|
||||
svgPreviewControl.DoPreview(GetMockStream("<svg></svg>"));
|
||||
svgPreviewControl.DoPreview("HelperFiles/file1.svg");
|
||||
|
||||
int beforeTick = Environment.TickCount;
|
||||
|
||||
@@ -147,13 +147,8 @@ namespace SvgPreviewHandlerUnitTests
|
||||
// Arrange
|
||||
using (var svgPreviewControl = new SvgPreviewControl())
|
||||
{
|
||||
var svgBuilder = new StringBuilder();
|
||||
svgBuilder.AppendLine("<svg width =\"200\" height=\"200\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">");
|
||||
svgBuilder.AppendLine("\t<script>alert(\"hello\")</script>");
|
||||
svgBuilder.AppendLine("</svg>");
|
||||
|
||||
// Act
|
||||
svgPreviewControl.DoPreview(GetMockStream(svgBuilder.ToString()));
|
||||
svgPreviewControl.DoPreview("HelperFiles/file2.svg");
|
||||
|
||||
int beforeTick = Environment.TickCount;
|
||||
|
||||
@@ -176,14 +171,7 @@ namespace SvgPreviewHandlerUnitTests
|
||||
// Arrange
|
||||
using (var svgPreviewControl = new SvgPreviewControl())
|
||||
{
|
||||
var svgBuilder = new StringBuilder();
|
||||
svgBuilder.AppendLine("<svg viewBox=\"0 0 100 100\" xmlns=\"http://www.w3.org/2000/svg\">");
|
||||
svgBuilder.AppendLine("\t<circle cx=\"50\" cy=\"50\" r=\"50\">");
|
||||
svgBuilder.AppendLine("\t</circle>");
|
||||
svgBuilder.AppendLine("</svg>");
|
||||
|
||||
// Act
|
||||
svgPreviewControl.DoPreview(GetMockStream(svgBuilder.ToString()));
|
||||
svgPreviewControl.DoPreview("HelperFiles/file1.svg");
|
||||
|
||||
int beforeTick = Environment.TickCount;
|
||||
|
||||
@@ -205,11 +193,7 @@ namespace SvgPreviewHandlerUnitTests
|
||||
// Arrange
|
||||
using (var svgPreviewControl = new SvgPreviewControl())
|
||||
{
|
||||
var svgBuilder = new StringBuilder();
|
||||
svgBuilder.AppendLine("<svg width =\"200\" height=\"200\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">");
|
||||
svgBuilder.AppendLine("\t<script>alert(\"hello\")</script>");
|
||||
svgBuilder.AppendLine("</svg>");
|
||||
svgPreviewControl.DoPreview(GetMockStream(svgBuilder.ToString()));
|
||||
svgPreviewControl.DoPreview("HelperFiles/file2.svg");
|
||||
|
||||
int beforeTick = Environment.TickCount;
|
||||
|
||||
@@ -233,31 +217,5 @@ namespace SvgPreviewHandlerUnitTests
|
||||
Assert.AreEqual(textBox.Width, finalParentWidth);
|
||||
}
|
||||
}
|
||||
|
||||
private static IStream GetMockStream(string streamData)
|
||||
{
|
||||
var mockStream = new Mock<IStream>();
|
||||
var streamBytes = Encoding.UTF8.GetBytes(streamData);
|
||||
|
||||
var streamMock = new Mock<IStream>();
|
||||
var firstCall = true;
|
||||
streamMock
|
||||
.Setup(x => x.Read(It.IsAny<byte[]>(), It.IsAny<int>(), It.IsAny<IntPtr>()))
|
||||
.Callback<byte[], int, IntPtr>((buffer, countToRead, bytesReadPtr) =>
|
||||
{
|
||||
if (firstCall)
|
||||
{
|
||||
Array.Copy(streamBytes, 0, buffer, 0, streamBytes.Length);
|
||||
Marshal.WriteInt32(bytesReadPtr, streamBytes.Length);
|
||||
firstCall = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
Marshal.WriteInt32(bytesReadPtr, 0);
|
||||
}
|
||||
});
|
||||
|
||||
return streamMock.Object;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,6 +19,11 @@
|
||||
|
||||
<Import Project="..\..\..\Version.props" />
|
||||
|
||||
<ItemGroup>
|
||||
<None Remove="HelperFiles\file1.svg" />
|
||||
<None Remove="HelperFiles\file2.svg" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Moq" Version="4.16.1" />
|
||||
<PackageReference Include="MSTest.TestAdapter" Version="2.2.3" />
|
||||
@@ -35,4 +40,12 @@
|
||||
<Compile Include="..\STATestClassAttribute.cs" Link="STATestClassAttribute.cs" />
|
||||
<Compile Include="..\STATestMethodAttribute.cs" Link="STATestMethodAttribute.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="HelperFiles\file1.svg">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="HelperFiles\file2.svg">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
Reference in New Issue
Block a user