Skip to content

Commit

Permalink
CrossCompile
Browse files Browse the repository at this point in the history
  • Loading branch information
meee1 committed Aug 25, 2020
1 parent 3a62cc3 commit 90f0553
Show file tree
Hide file tree
Showing 15 changed files with 349 additions and 91 deletions.
21 changes: 11 additions & 10 deletions ExtLibs/AltitudeAngelWings/AltitudeAngelWings.csproj
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
<PropertyGroup>
<OutputType>Library</OutputType>
<TargetFrameworks>net461</TargetFrameworks>

<TargetFrameworks>net461;netcoreapp3.1;netstandard2.0</TargetFrameworks>
<UseWindowsForms>true</UseWindowsForms>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<ApplicationIcon />
<StartupObject />
Expand All @@ -18,6 +18,8 @@
<Compile Remove="PluginMain.cs" />
<Compile Remove="UserInterfaceMain.cs" />
<Compile Remove="WpfExtensions.cs" />
</ItemGroup> <ItemGroup>
<Compile Remove="netstandard2.0\Shim.cs" Condition="'$(TargetFramework)' != 'netstandard2.0'" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Autofac" Version="4.9.4" />
Expand All @@ -26,7 +28,11 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.Windows.Compatibility" Version="3.1.0" />
</ItemGroup> <ItemGroup>
<ProjectReference Include="..\MissionPlanner.Drawing.Common\MissionPlanner.Drawing.Common.csproj" Condition="'$(TargetFramework)' == 'netstandard2.0'" />
<ProjectReference Include="..\mono\mcs\class\System.Windows.Forms\System.Windows.Forms-net_4_x.csproj" Condition="'$(TargetFramework)' == 'netstandard2.0'" />
</ItemGroup> <ItemGroup>
<Reference Include="System.Windows.Forms" Condition="'$(TargetFramework)' == 'net461'" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Flurl">
Expand All @@ -41,9 +47,6 @@
<PackageReference Include="Newtonsoft.Json">
<Version>12.0.3</Version>
</PackageReference>
<PackageReference Include="System.Drawing.Common">
<Version>4.7.0</Version>
</PackageReference>
<PackageReference Include="System.Net.Http">
<Version>4.3.4</Version>
</PackageReference>
Expand All @@ -66,9 +69,7 @@
<ItemGroup>
<ProjectReference Include="..\GMap.NET.Core\GMap.NET.Core.csproj" />
</ItemGroup>
<ItemGroup>
<Reference Include="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
</ItemGroup>

<ItemGroup>
<Compile Update="Properties\Settings.Designer.cs">
<DesignTimeSharedInput>True</DesignTimeSharedInput>
Expand Down
5 changes: 1 addition & 4 deletions ExtLibs/AltitudeAngelWings/ViewModels/MainViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,7 @@ public MainViewModel(AltitudeAngelService altitudeAngelService)
.Subscribe(UpdateSignInState);

_altitudeAngelService.WeatherReport
#if !LIB
.ObserveOnDispatcher()
#endif
.Subscribe(WeatherChanged);
.Subscribe(WeatherChanged);

_altitudeAngelService.SentTelemetry
.Subscribe(i => NewTelemetry());
Expand Down
5 changes: 1 addition & 4 deletions ExtLibs/AltitudeAngelWings/ViewModels/MessagesViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,7 @@ public MessagesViewModel(IMessagesService messagesService)
Messages = new ObservableCollection<string>();

messagesService.Messages
#if !LIB
.ObserveOnDispatcher()
#endif
.Subscribe(message => Messages.Add(message.Content));
.Subscribe(message => Messages.Add(message.Content));
}

private void CreateSampleData()
Expand Down
170 changes: 170 additions & 0 deletions ExtLibs/AltitudeAngelWings/netstandard2.0/Shim.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,170 @@
using SkiaSharp;
using System;
using System.Drawing;
using System.Drawing.Drawing2D;


namespace SvgNet.SvgGdi
{
}
namespace System.Windows.Forms
{




public class WebBrowser : Control
{
public bool CanGoBack { get; internal set; }

public object Url { get; set; }

public bool CanGoForward { get; set; }

public string DocumentText { get; set; }

public HtmlDocument Document { get; set; }

public event EventHandler<WebBrowserNavigatingEventArgs> Navigating;
public event EventHandler<WebBrowserNavigatedEventArgs> Navigated;

public void Navigate(Uri authorizeUri)
{

}

public void GoBack()
{

}

public void GoForward()
{

}

public void Navigate(string authorizeUri)
{

}
}

public class HtmlDocument
{
public void InvokeScript(string script)
{
}
}

public class WebBrowserNavigatedEventArgs : EventArgs
{
public Uri Url;
}

public class WebBrowserNavigatingEventArgs : EventArgs
{
public Uri Url;

public bool Cancel;
}
}

public class GdiGraphics : Graphics
{
public GdiGraphics(SKSurface surface) : base(surface)
{
}

public GdiGraphics(IntPtr handle, int width, int height) : base(handle, width, height)
{
}

public GdiGraphics(Graphics fromImage) : base(fromImage.Surface)
{
}
}

public class SkiaGraphics : Graphics
{
public SkiaGraphics(SKSurface surface) : base(surface)
{
}

public SkiaGraphics(IntPtr handle, int width, int height) : base(handle, width, height)
{
}
}

public static class Extension
{
public static SKColor SKColor(this Color color)
{
var skcol = SkiaSharp.SKColor.Empty.WithAlpha(color.A).WithRed(color.R).WithGreen(color.G)
.WithBlue(color.B);
return skcol;
}

public static SKPaint SKPaint(this Pen pen)
{
var paint = new SKPaint
{
Color = pen.Color.SKColor(),
StrokeWidth = pen.Width,
IsAntialias = true,
Style = SKPaintStyle.Stroke,
BlendMode = SKBlendMode.SrcOver,
FilterQuality = SKFilterQuality.High
};

if (pen.DashStyle != DashStyle.Solid)
paint.PathEffect = SKPathEffect.CreateDash(pen.DashPattern, 0);
return paint;
}

public static SKPaint SKPaint(this Font font)
{
return new SKPaint
{
Typeface = SKTypeface.FromFamilyName(font.SystemFontName),
TextSize = font.Size * 1.4f,
StrokeWidth = 2
};
}

public static SKPoint SKPoint(this PointF pnt)
{
return new SKPoint(pnt.X, pnt.Y);
}

public static SKPoint SKPoint(this Point pnt)
{
return new SKPoint(pnt.X, pnt.Y);
}

public static SKPaint SKPaint(this Brush brush)
{
if (brush is SolidBrush)
return new SKPaint
{Color = ((SolidBrush) brush).Color.SKColor(), IsAntialias = true, Style = SKPaintStyle.Fill};

if (brush is LinearGradientBrush)
{
var lgb = (LinearGradientBrush) brush;
return new SKPaint
{
IsAntialias = true,
Style = SKPaintStyle.Fill,
Shader = SKShader.CreateLinearGradient(new SKPoint(lgb.Rectangle.X, lgb.Rectangle.Y),
new SKPoint(lgb.Rectangle.X, lgb.Rectangle.Bottom),
new[]
{
((LinearGradientBrush) brush).LinearColors[0].SKColor(),
((LinearGradientBrush) brush).LinearColors[1].SKColor()
}
, null, SKShaderTileMode.Clamp, SKMatrix.MakeIdentity())
};
}

return new SKPaint();
}
}
15 changes: 8 additions & 7 deletions ExtLibs/BSE.Windows.Forms/BSE.Windows.Forms.csproj
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
<PropertyGroup>
<OutputType>Library</OutputType>
<TargetFramework>net461</TargetFramework>

<TargetFrameworks>net461;netcoreapp3.1;netstandard2.0</TargetFrameworks>
<UseWindowsForms>true</UseWindowsForms>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<ApplicationIcon />
<StartupObject /><GenerateResourceUsePreserializedResources>true</GenerateResourceUsePreserializedResources>
Expand All @@ -14,10 +14,11 @@
</PackageReference>
<PackageReference Include="System.Resources.Extensions" Version="4.6.0" />
<PackageReference Include="System.Resources.ResourceManager" Version="4.3.0" />
</ItemGroup>
<ItemGroup>
<Reference Include="System.Design" />
<Reference Include="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
</ItemGroup> <ItemGroup>
<ProjectReference Include="..\MissionPlanner.Drawing.Common\MissionPlanner.Drawing.Common.csproj" Condition="'$(TargetFramework)' == 'netstandard2.0'" />
<ProjectReference Include="..\mono\mcs\class\System.Windows.Forms\System.Windows.Forms-net_4_x.csproj" Condition="'$(TargetFramework)' == 'netstandard2.0'" />
</ItemGroup> <ItemGroup>
<Reference Include="System.Windows.Forms" Condition="'$(TargetFramework)' == 'net461'" />
</ItemGroup>
<ItemGroup>
<Compile Update="Properties\Resources.Designer.cs">
Expand Down
13 changes: 8 additions & 5 deletions ExtLibs/BaseClasses/BaseClasses.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
<PropertyGroup>
<OutputType>Library</OutputType>
<TargetFramework>net461</TargetFramework>
<TargetFrameworks>net461;netcoreapp3.1;netstandard2.0</TargetFrameworks>
<UseWindowsForms>true</UseWindowsForms>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
</PropertyGroup>
Expand All @@ -10,8 +10,11 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>
<ItemGroup>
<Reference Include="System.Windows.Forms" />
<PackageReference Include="Microsoft.Win32.Registry" Version="4.7.0" />
</ItemGroup> <ItemGroup>
<ProjectReference Include="..\MissionPlanner.Drawing.Common\MissionPlanner.Drawing.Common.csproj" Condition="'$(TargetFramework)' == 'netstandard2.0'" />
<ProjectReference Include="..\mono\mcs\class\System.Windows.Forms\System.Windows.Forms-net_4_x.csproj" Condition="'$(TargetFramework)' == 'netstandard2.0'" />
</ItemGroup><ItemGroup>
<Reference Include="System.Windows.Forms" Condition="'$(TargetFramework)' == 'net461'" />
</ItemGroup>
</Project>
13 changes: 0 additions & 13 deletions ExtLibs/BaseClasses/DSHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1120,19 +1120,6 @@ public HRESULT IsInterface(Type _type)

#region Helper Methods

protected T TryCast<T>() where T : class
{
try
{
T _interface = (T)Marshal.GetTypedObjectForIUnknown(m_pUnknown, typeof(T));
return _interface;
}
catch
{
}
return null;
}

protected T GetProcDelegate<T>(int nIndex) where T : class
{
IntPtr pVtable = Marshal.ReadIntPtr(m_pUnknown);
Expand Down
6 changes: 3 additions & 3 deletions ExtLibs/Controls/netstandard2.0/Shim.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,14 @@ public SkiaGraphics(IntPtr handle, int width, int height) : base(handle, width,

public static class Extension
{
public static SKColor SKColor(this Color color)
internal static SKColor SKColor(this Color color)
{
var skcol = SkiaSharp.SKColor.Empty.WithAlpha(color.A).WithRed(color.R).WithGreen(color.G)
.WithBlue(color.B);
return skcol;
}

public static SKPaint SKPaint(this Pen pen)
internal static SKPaint SKPaint(this Pen pen)
{
var paint = new SKPaint
{
Expand All @@ -60,7 +60,7 @@ public static SKPaint SKPaint(this Pen pen)
return paint;
}

public static SKPaint SKPaint(this Font font)
internal static SKPaint SKPaint(this Font font)
{
return new SKPaint
{
Expand Down
7 changes: 4 additions & 3 deletions ExtLibs/GMap.NET.Drawing/GMap.NET.Drawing.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netstandard2.0</TargetFrameworks>
<TargetFrameworks>net461;netcoreapp3.1;netstandard2.0</TargetFrameworks>
<ApplicationIcon />
<OutputTypeEx>library</OutputTypeEx>
<StartupObject />
Expand All @@ -16,14 +16,15 @@


<ItemGroup>
<PackageReference Include="System.Drawing.Common" Version="4.7.0" />
<ProjectReference Include="..\MissionPlanner.Drawing.Common\MissionPlanner.Drawing.Common.csproj" Condition="'$(TargetFramework)' == 'netstandard2.0'" />
<PackageReference Include="System.Drawing.Common" Version="4.7.0" Condition="'$(TargetFramework)' != 'netstandard2.0'" />
<PackageReference Include="System.Drawing.Primitives" Version="4.3.0" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\GMap.NET.Core\GMap.NET.Core.csproj" />
<ProjectReference Include="..\Interfaces\Interfaces.csproj" />
<ProjectReference Include="..\SvgNet\SvgNet.csproj" />
<ProjectReference Include="..\SvgNet\SvgNet.csproj" Condition="'$(TargetFramework)' != 'netstandard2.0'"/>
</ItemGroup>

<ItemGroup>
Expand Down
Loading

0 comments on commit 90f0553

Please sign in to comment.