aboutsummaryrefslogtreecommitdiffstatsci
path: root/Samples
diff options
context:
space:
mode:
authorJean-Philippe Bruyère <jp_bruyere@hotmail.com>2020-05-22 03:33:37 +0200
committerJean-Philippe Bruyère <jp_bruyere@hotmail.com>2020-05-22 03:33:37 +0200
commitd46cbe601a9d5d4437f256a496f29a3fe6881da8 (patch)
tree062530b2d95b4504ee5b74e6ad7d88a318dc89a5 /Samples
parentf1cda0b040c750e0fdfb5df35349aff6af163446 (diff)
use DllMapCore for native dll path resolutions
Diffstat (limited to 'Samples')
-rw-r--r--Samples/BasicTests/BasicTests.cs6
-rw-r--r--Samples/ControlLib/ControlLib.csproj1
-rw-r--r--Samples/Directory.Build.props4
-rw-r--r--Samples/HelloWorld/main.cs3
-rw-r--r--Samples/PerfTests/PerfTests.csproj26
-rw-r--r--Samples/PerfTests/Program.cs81
-rw-r--r--Samples/ShowCase/ShowCase.cs (renamed from Samples/ShowCase/main.cs)20
-rw-r--r--Samples/ShowCase/ShowCase.csproj3
-rw-r--r--Samples/common/SampleBase.cs2
9 files changed, 126 insertions, 20 deletions
diff --git a/Samples/BasicTests/BasicTests.cs b/Samples/BasicTests/BasicTests.cs
index b0d99ccc..fba4b70a 100644
--- a/Samples/BasicTests/BasicTests.cs
+++ b/Samples/BasicTests/BasicTests.cs
@@ -10,9 +10,11 @@ namespace tests
{
public class BasicTests : SampleBase
{
- [STAThread]
static void Main ()
{
+#if NETCOREAPP3_1
+ DllMapCore.Resolve.Enable (true);
+#endif
using (BasicTests app = new BasicTests ()) {
app.Run ();
}
@@ -96,7 +98,7 @@ namespace tests
else if (idx < 0)
idx = testFiles.Length - 1;
- Console.WriteLine ($"Loading {testFiles [idx]}.");
+ Console.WriteLine ($"Loading {testFiles [idx]}. {AppDomain.CurrentDomain.MonitoringSurvivedMemorySize}");
Load (testFiles [idx]).DataSource = this;
} catch (Exception ex) {
diff --git a/Samples/ControlLib/ControlLib.csproj b/Samples/ControlLib/ControlLib.csproj
index c82431e8..e9d01df9 100644
--- a/Samples/ControlLib/ControlLib.csproj
+++ b/Samples/ControlLib/ControlLib.csproj
@@ -2,7 +2,6 @@
<PropertyGroup>
<TargetFrameworks>net472;netstandard2.0</TargetFrameworks>
<EnableDefaultNoneItems>false</EnableDefaultNoneItems>
- <ReleaseVersion>0.8.0</ReleaseVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
diff --git a/Samples/Directory.Build.props b/Samples/Directory.Build.props
index d3e9d668..d2f140e7 100644
--- a/Samples/Directory.Build.props
+++ b/Samples/Directory.Build.props
@@ -15,10 +15,10 @@
<EnableDefaultNoneItems>false</EnableDefaultNoneItems>
<SamplesDir>$(SolutionDir)Samples\</SamplesDir>
</PropertyGroup>
- <PropertyGroup>
- </PropertyGroup>
+
<ItemGroup>
+ <PackageReference Include="DllMapCore" Version="0.1.0" Condition="'$(TargetFramework)'=='netcoreapp3.1'" />
<ProjectReference Include="$(SolutionDir)Crow\Crow.csproj" />
</ItemGroup>
<ItemGroup>
diff --git a/Samples/HelloWorld/main.cs b/Samples/HelloWorld/main.cs
index 44ec3fb8..743419ee 100644
--- a/Samples/HelloWorld/main.cs
+++ b/Samples/HelloWorld/main.cs
@@ -5,6 +5,9 @@ namespace HelloWorld
{
class Program {
static void Main (string[] args) {
+#if NETCOREAPP3_1
+ DllMapCore.Resolve.Enable (true);
+#endif
using (Interface app = new Interface ()) {
app.Initialized += (sender, e) => (sender as Interface).Load ("#HelloWorld.helloworld.crow");
app.Run ();
diff --git a/Samples/PerfTests/PerfTests.csproj b/Samples/PerfTests/PerfTests.csproj
new file mode 100644
index 00000000..982bd359
--- /dev/null
+++ b/Samples/PerfTests/PerfTests.csproj
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project Sdk="Microsoft.NET.Sdk">
+
+ <!--<ItemGroup>
+ <None Include="$(SolutionDir)Samples\common\ui\Interfaces\**\*.*">
+ <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
+ <Link>Interfaces\%(RecursiveDir)%(Filename)%(Extension)</Link>
+ </None>
+ <EmbeddedResource Include="$(SolutionDir)Samples\common\ui\templates\**\*.*">
+ <LogicalName>ui.%(Filename)%(Extension)</LogicalName>
+ <Link>Templates\%(Filename)%(Extension)</Link>
+ </EmbeddedResource>
+ <EmbeddedResource Include="$(SolutionDir)Samples\common\samples.style" />
+ <EmbeddedResource Include="$(SolutionDir)Samples\common\ui\images\**\*.*">
+ <LogicalName>images.%(Filename)%(Extension)</LogicalName>
+ <Link>Images\%(Filename)%(Extension)</Link>
+ </EmbeddedResource>
+ <EmbeddedResource Include="$(SolutionDir)Samples\common\ui\Icons\*.*">
+ <LogicalName>Icons.%(Filename)%(Extension)</LogicalName>
+ <Link>Icons\%(Filename)%(Extension)</Link>
+ </EmbeddedResource>
+ </ItemGroup>-->
+ <ItemGroup>
+ <PackageReference Include="GitInfo" Version="2.0.26" />
+ </ItemGroup>
+</Project> \ No newline at end of file
diff --git a/Samples/PerfTests/Program.cs b/Samples/PerfTests/Program.cs
new file mode 100644
index 00000000..68d8c73e
--- /dev/null
+++ b/Samples/PerfTests/Program.cs
@@ -0,0 +1,81 @@
+// Copyright (c) 2013-2020 Jean-Philippe Bruyère <jp_bruyere@hotmail.com>
+//
+// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
+using System;
+using System.CodeDom.Compiler;
+using System.Diagnostics;
+using System.IO;
+using Crow;
+
+namespace PerfTests
+{
+ class TestInterface : Interface
+ {
+ public TestInterface (int width = 800, int height = 600)
+ : base (width, height, false, false)
+ {
+ surf = new Crow.Cairo.ImageSurface (Crow.Cairo.Format.Argb32, ClientRectangle.Width, ClientRectangle.Height);
+ Init ();
+ }
+
+ long Test (string path, out long min, out long max, int count = 10)
+ {
+ min = long.MaxValue;
+ max = long.MinValue;
+
+ long total = 0;
+
+ Stopwatch sw = new Stopwatch ();
+
+ for (int i = 0; i < count; i++) {
+ sw.Restart ();
+
+
+ Load (path);
+ while (LayoutingQueue.Count > 0)
+ Update ();
+
+ sw.Stop ();
+
+ if (sw.ElapsedTicks < min)
+ min = sw.ElapsedMilliseconds;
+ if (sw.ElapsedTicks > max)
+ max = sw.ElapsedMilliseconds;
+ total += sw.ElapsedMilliseconds;
+
+ }
+
+ return total / count;
+ }
+
+ void testDir (string dirPath, int level = 0)
+ {
+ Console.WriteLine ($"{new string (' ', level * 4)}- {dirPath}");
+ level++;
+
+ foreach (string d in Directory.GetDirectories (dirPath))
+ testDir (d, level);
+
+ foreach (string f in Directory.GetFiles (dirPath)) {
+ try {
+ long mean = Test (f, out long min, out long max);
+ Console.WriteLine ($"{new string (' ', level * 4)}{ Path.GetFileName (f),-30}|{min,5}|{mean,5}|{max,5}");
+ } catch (Exception ex) {
+ Console.ForegroundColor = ConsoleColor.Red;
+ Console.WriteLine ($"- {ex.Message}");
+ Console.ResetColor ();
+ }
+ }
+ }
+
+
+ public static void Main (string [] args)
+ {
+ Console.WriteLine ($"git:{ThisAssembly.Git.Commit} {ThisAssembly.Git.Branch} {ThisAssembly.Git.SemVer.Major}.{ThisAssembly.Git.SemVer.Minor}.{ThisAssembly.Git.SemVer.Patch} {ThisAssembly.Git.SemVer.Label}");
+ //IndentedTextWriter w = new IndentedTextWriter()
+ using (TestInterface iface = new TestInterface ()) {
+ iface.testDir ("Interfaces");
+ }
+ }
+ }
+}
diff --git a/Samples/ShowCase/main.cs b/Samples/ShowCase/ShowCase.cs
index b65f3dfe..10da3683 100644
--- a/Samples/ShowCase/main.cs
+++ b/Samples/ShowCase/ShowCase.cs
@@ -1,33 +1,29 @@
-// Copyright (c) 2013-2019 Bruyère Jean-Philippe <jp_bruyere@hotmail.com>
+// Copyright (c) 2013-2019 Bruyère Jean-Philippe <jp_bruyere@hotmail.com>
//
// This code is licensed under the MIT license (MIT) (http://opensource.org/licenses/MIT)
using System;
using Crow;
using System.IO;
-using System.Collections.Generic;
-using System.Reflection;
-using System.Linq;
using System.Text;
using Crow.IML;
-namespace tests
+namespace ShowCase
{
class Showcase : Interface
{
- public Container crowContainer;
- [STAThread]
static void Main ()
{
- using (Showcase app = new Showcase ()) {
- //app.Keyboard.KeyDown += App_KeyboardKeyDown;
-
+#if NETCOREAPP3_1
+ DllMapCore.Resolve.Enable (true);
+#endif
+ using (Showcase app = new Showcase ())
app.Run ();
-
- }
}
+ public Container crowContainer;
+
protected override void OnInitialized ()
{
Widget g = Load ("#ShowCase.showcase.crow");
diff --git a/Samples/ShowCase/ShowCase.csproj b/Samples/ShowCase/ShowCase.csproj
index fe311b56..ad2019cb 100644
--- a/Samples/ShowCase/ShowCase.csproj
+++ b/Samples/ShowCase/ShowCase.csproj
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">
-
<ItemGroup>
<EmbeddedResource Include="ui\*.*">
<LogicalName>ShowCase.%(Filename)%(Extension)</LogicalName>
@@ -8,5 +7,5 @@
</ItemGroup>
<ItemGroup>
<None Remove="..\common\ui\Interfaces\basicTests\7.crow" />
- </ItemGroup>
+ </ItemGroup>
</Project> \ No newline at end of file
diff --git a/Samples/common/SampleBase.cs b/Samples/common/SampleBase.cs
index 8ee0c151..6800e9ef 100644
--- a/Samples/common/SampleBase.cs
+++ b/Samples/common/SampleBase.cs
@@ -8,7 +8,7 @@ using Crow;
namespace Crow
{
- public class SampleBase : Interface {
+ public class SampleBase : Interface {
public Version CrowVersion => Assembly.GetAssembly (typeof (Widget)).GetName ().Version;
#region Test values for Binding