22 Commits

Author SHA1 Message Date
e389842a71 Merge branch 'master' into dotnet5 2020-12-04 09:10:40 +01:00
aad69c0cd6 d 2020-12-04 09:09:19 +01:00
af10069fc0 update MaterialCompareTo to compare the reference hash code instead of equaling the reference 2020-12-03 08:09:32 +01:00
0ce9f04fc5 d 2020-12-03 07:17:21 +01:00
48a20cf18c d 2020-12-03 07:13:47 +01:00
badf771c47 d 2020-12-02 16:10:17 +01:00
c32ffbbc08 get glwpfcontrol to work 2020-12-02 15:52:19 +01:00
45d45395c4 fix GLWpfControlSettings 2020-12-02 14:17:00 +01:00
0491d9250c add OpenTK3 to keep OpenTK.Input alive & change checking for pressed keys back 2020-12-02 14:02:59 +01:00
7718b03576 remove Pilz.Input 2020-12-02 13:49:00 +01:00
c902822558 use wpf 2020-12-02 09:32:51 +01:00
b1e08f328a add Pilz.Input with KeyboardListener 2020-12-02 09:30:50 +01:00
4fe144c8b1 raise events on error 2020-11-26 12:35:36 +01:00
e833e48421 try decrypt 2020-11-26 12:01:28 +01:00
22ab6275a0 add static decrypt and encrypt methods 2020-11-26 11:53:10 +01:00
faaab33afc add constructors 2020-11-26 11:47:45 +01:00
2631a6afba change default string crypter to AESStringCrypter 2020-11-26 11:43:42 +01:00
1f87f374ac fix null exception 2020-11-26 11:31:56 +01:00
e0ee7c4e77 add AESStringCrypter 2020-11-26 11:31:50 +01:00
4051a92b4e replace OpenTK.GLControl with OpenTK.GLWpfControl and update code to use OpenTK 4.0 (not tested yet) 2020-11-25 09:08:43 +01:00
5303adf095 add missing reference for Bitmap 2020-11-23 15:34:21 +01:00
417632b460 update projects to .NET 5 (Win7) & update OpenTK to latest Version to support .NET 5 (missing OpenTK.GLControl) 2020-11-19 14:49:04 +01:00
14 changed files with 376 additions and 96 deletions

View File

@@ -0,0 +1,253 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Security.Cryptography;
using System.Text;
namespace Pilz.Cryptography
{
public class AESStringCrypter : ICrypter
{
public delegate void AESStringCrypterEventHandler(AESStringCrypter sender);
public delegate void AESStringCrypterErrorEventHandler(AESStringCrypter sender, Exception exception);
/// <summary>
/// This event throws if no key and no default key was found. You can now provide a key or default key (maybe depending on the given instance). If no value is provided, a default key will be created.
/// </summary>
public static event AESStringCrypterEventHandler NeedKey;
/// <summary>
/// This event throws if no IV and no default IV was found. You can now provide a IV or default IV (maybe depending on the given instance). If no value is provided, a default IV will be created.
/// </summary>
public static event AESStringCrypterEventHandler NeedIV;
public static event AESStringCrypterErrorEventHandler ErrorAtDecrypting;
public static event AESStringCrypterErrorEventHandler ErrorAtEncrypting;
private byte[] key = new byte[] { };
private byte[] iv = new byte[] { };
private static byte[] defaultKey = new byte[] { };
private static byte[] defaultIV = new byte[] { };
public Encoding Encoding { get; set; } = Encoding.Default;
public string Name { get; set; }
public object Tag { get; set; }
public string Key
{
get => Convert.ToBase64String(key);
set => key = Convert.FromBase64String(value);
}
public string IV
{
get => Convert.ToBase64String(iv);
set => iv = Convert.FromBase64String(value);
}
public static string DefaultKey
{
get => Convert.ToBase64String(defaultKey);
set => defaultKey = Convert.FromBase64String(value);
}
public static string DefaultIV
{
get => Convert.ToBase64String(defaultIV);
set => defaultIV = Convert.FromBase64String(value);
}
public AESStringCrypter()
{
}
public AESStringCrypter(string key, string iv) : this()
{
Key = key;
IV = iv;
}
public string Decrypt(string encryptedValue)
{
try
{
return DecryptStringFromBytes_Aes(Convert.FromBase64String(encryptedValue), GetKey(), GetIV());
}
catch (Exception ex)
{
ErrorAtDecrypting?.Invoke(this, ex);
return string.Empty;
}
}
public static string Decrypt(string encryptedValue, string key, string iv)
{
var crypter = new AESStringCrypter(key, iv);
return crypter.Decrypt(encryptedValue);
}
public string Encrypt(string plainValue)
{
try
{
return Convert.ToBase64String(EncryptStringToBytes_Aes(plainValue, GetKey(), GetIV()));
}
catch (Exception ex)
{
ErrorAtEncrypting?.Invoke(this, ex);
return string.Empty;
}
}
public static string Encrypt(string plainValue, string key, string iv)
{
var crypter = new AESStringCrypter(key, iv);
return crypter.Encrypt(plainValue);
}
private byte[] GetKey(bool createIfFail = false)
{
byte[] keyToUse;
if (key.Length != 0)
keyToUse = key;
else if (defaultKey.Length != 0)
keyToUse = defaultKey;
else if (createIfFail)
keyToUse = defaultKey = GenerateKeyInternal();
else
{
NeedKey?.Invoke(this);
keyToUse = GetKey(true);
}
return keyToUse;
}
private byte[] GetIV(bool createIfFail = false)
{
byte[] ivToUse;
if (iv.Length != 0)
ivToUse = iv;
else if (defaultIV.Length != 0)
ivToUse = defaultIV;
else if (createIfFail)
ivToUse = defaultIV = GenerateIVInternal();
else
{
NeedIV?.Invoke(this);
ivToUse = GetIV(true);
}
return ivToUse;
}
private static byte[] GenerateKeyInternal()
{
var aes = Aes.Create();
var key = aes.Key;
aes.Dispose();
return key;
}
public static string GenerateKey()
{
return Convert.ToBase64String(GenerateKeyInternal());
}
private static byte[] GenerateIVInternal()
{
var aes = Aes.Create();
var iv = aes.IV;
aes.Dispose();
return iv;
}
public static string GenerateIV()
{
return Convert.ToBase64String(GenerateIVInternal());
}
private static byte[] EncryptStringToBytes_Aes(string plainText, byte[] Key, byte[] IV)
{
// Check arguments.
if (plainText == null || plainText.Length <= 0)
throw new ArgumentNullException("plainText");
if (Key == null || Key.Length <= 0)
throw new ArgumentNullException("Key");
if (IV == null || IV.Length <= 0)
throw new ArgumentNullException("IV");
byte[] encrypted;
// Create an Aes object
// with the specified key and IV.
using (Aes aesAlg = Aes.Create())
{
aesAlg.Key = Key;
aesAlg.IV = IV;
// Create an encryptor to perform the stream transform.
ICryptoTransform encryptor = aesAlg.CreateEncryptor(aesAlg.Key, aesAlg.IV);
// Create the streams used for encryption.
using (MemoryStream msEncrypt = new MemoryStream())
{
using (CryptoStream csEncrypt = new CryptoStream(msEncrypt, encryptor, CryptoStreamMode.Write))
{
using (StreamWriter swEncrypt = new StreamWriter(csEncrypt))
{
//Write all data to the stream.
swEncrypt.Write(plainText);
}
encrypted = msEncrypt.ToArray();
}
}
}
// Return the encrypted bytes from the memory stream.
return encrypted;
}
private static string DecryptStringFromBytes_Aes(byte[] cipherText, byte[] Key, byte[] IV)
{
// Check arguments.
if (cipherText == null || cipherText.Length <= 0)
throw new ArgumentNullException("cipherText");
if (Key == null || Key.Length <= 0)
throw new ArgumentNullException("Key");
if (IV == null || IV.Length <= 0)
throw new ArgumentNullException("IV");
// Declare the string used to hold
// the decrypted text.
string plaintext = null;
// Create an Aes object
// with the specified key and IV.
using (Aes aesAlg = Aes.Create())
{
aesAlg.Key = Key;
aesAlg.IV = IV;
// Create a decryptor to perform the stream transform.
ICryptoTransform decryptor = aesAlg.CreateDecryptor(aesAlg.Key, aesAlg.IV);
// Create the streams used for decryption.
using (MemoryStream msDecrypt = new MemoryStream(cipherText))
{
using (CryptoStream csDecrypt = new CryptoStream(msDecrypt, decryptor, CryptoStreamMode.Read))
{
using (StreamReader srDecrypt = new StreamReader(csDecrypt))
{
// Read the decrypted bytes from the decrypting stream
// and place them in a string.
plaintext = srDecrypt.ReadToEnd();
}
}
}
}
return plaintext;
}
}
}

View File

@@ -5,6 +5,9 @@
<Product>Pilz.Cryptography</Product>
<Copyright>Copyright © 2020</Copyright>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<DocumentationFile>D:\repos\Pilz\Pilz.Cryptography\Pilz.Cryptography.xml</DocumentationFile>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="System.Management" Version="4.7.0" />
<PackageReference Include="System.Data.DataSetExtensions" Version="4.5.0" />

View File

@@ -50,7 +50,7 @@ namespace Pilz.Cryptography
if (Crypter == null)
{
if (DefaultCrypter == null)
DefaultCrypter = new SimpleStringCrypter(string.Empty);
DefaultCrypter = new AESStringCrypter();
Crypter = DefaultCrypter;
}
return Crypter;

View File

@@ -1,5 +1,7 @@
Imports System.Windows.Forms
Imports OpenTK
Imports OpenTK.Mathematics
Namespace CameraN

View File

@@ -1,7 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<MyType>Windows</MyType>
<TargetFramework>net48</TargetFramework>
<TargetFramework>net5.0-windows7.0</TargetFramework>
<UseWindowsForms>true</UseWindowsForms>
<UseWpf>true</UseWpf>
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
<DocumentationFile>Pilz.Drawing.Drawing3D.OpenGLFactory.xml</DocumentationFile>
<DefineTrace>true</DefineTrace>
@@ -25,18 +27,14 @@
<OptionInfer>On</OptionInfer>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="OpenTK.GLWpfControl" Version="4.0.0-pre.9" />
<PackageReference Include="System.Data.DataSetExtensions" Version="4.5.0" />
<PackageReference Include="System.Net.Http" Version="4.3.4" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="OpenTK" Version="3.2" />
<PackageReference Include="OpenTK.GLControl" Version="3.1.0" />
<PackageReference Include="OpenTK" Version="4.3.0" />
<PackageReference Include="System.Numerics.Vectors" Version="4.5.0" />
</ItemGroup>
<ItemGroup>
<Reference Include="Microsoft.VisualBasic" />
<Reference Include="System.Windows.Forms" />
</ItemGroup>
<ItemGroup>
<Import Include="Microsoft.VisualBasic" />
<Import Include="System" />
@@ -52,9 +50,7 @@
<Compile Update="Preview\ModelPreview.Designer.vb">
<DependentUpon>ModelPreview.vb</DependentUpon>
</Compile>
<Compile Update="Preview\ModelPreview.vb">
<SubType>Form</SubType>
</Compile>
<Compile Update="Preview\ModelPreview.vb" />
<Compile Update="My Project\Application.Designer.vb">
<AutoGen>True</AutoGen>
<DependentUpon>Application.myapp</DependentUpon>
@@ -98,4 +94,9 @@
<ItemGroup>
<Compile Remove="ModelPreview.Designer.vb" />
</ItemGroup>
<ItemGroup>
<Reference Include="OpenTK3">
<HintPath>..\Shared Libs\OpenTK3.dll</HintPath>
</Reference>
</ItemGroup>
</Project>

View File

@@ -6,16 +6,19 @@ Imports OpenTK
Imports OpenTK.Graphics.OpenGL
Imports Pilz.S3DFileParser
Imports Point = System.Drawing.Point
Imports KeyboardState = OpenTK.Input.KeyboardState
Imports Keyboard = OpenTK.Input.Keyboard
Imports Key = OpenTK.Input.Key
Imports Color = System.Drawing.Color
Imports System.Windows.Forms.Integration
Imports OpenTK.Mathematics
Imports System.Windows.Input
Imports Key = OpenTK3.Input.Key
Imports OpenTK.Wpf
Namespace PreviewN
Public Class ModelPreview
Private WithEvents glControl1 As GLControl
Private WithEvents glControl1 As Wpf.GLWpfControl
Private WithEvents glControlHost As ElementHost
Private WithEvents MyCamera As New Camera
Private ProjMatrix As Matrix4 = Nothing
Private FOV As Single = 1.048F
@@ -26,10 +29,17 @@ Namespace PreviewN
Private ReadOnly myModels As New Dictionary(Of Object3D, Renderer)
Private WithEvents RenderTimer As New Timers.Timer(25) With {.AutoReset = True}
Private _EnableCameraControlling As Boolean = False
Private finishedLoading As Boolean = False
Public Property Scaling As Single = 500.0F
Public Property ClearColor As Color = Color.CornflowerBlue
Public ReadOnly Property Keyboard As OpenTK3.Input.KeyboardState
Get
Return OpenTK3.Input.Keyboard.GetState
End Get
End Property
Public Property EnableCameraControlling As Boolean
Get
Return _EnableCameraControlling
@@ -74,6 +84,12 @@ Namespace PreviewN
End Property
Public ReadOnly Property GLControl As Control
Get
Return glControlHost
End Get
End Property
Public ReadOnly Property GLControlClient As GLWpfControl
Get
Return glControl1
End Get
@@ -81,15 +97,15 @@ Namespace PreviewN
Private ReadOnly Property IsStrgPressed As Boolean
Get
Dim state As KeyboardState = Keyboard.GetState()
Return state(Key.ControlLeft) OrElse state(Key.ControlRight)
Dim state = Keyboard
Return state.IsKeyDown(Key.ControlLeft) OrElse state.IsKeyDown(Key.ControlRight)
End Get
End Property
Private ReadOnly Property IsShiftPressed As Boolean
Get
Dim state As KeyboardState = Keyboard.GetState()
Return state(Key.ShiftLeft) OrElse state(Key.ShiftRight)
Dim state = Keyboard
Return state.IsKeyDown(Key.ShiftLeft) OrElse state.IsKeyDown(Key.ShiftRight)
End Get
End Property
@@ -99,7 +115,7 @@ Namespace PreviewN
End Get
Set(value As Boolean)
_isMouseDown = value
glControl1.Refresh()
glControlHost.Refresh()
End Set
End Property
@@ -116,44 +132,49 @@ Namespace PreviewN
End Sub
Public Sub New(objs As Object3D(), scale As Single)
Me.SuspendLayout()
SuspendLayout()
InitializeComponent()
DoubleBuffered = True
'glControl1
Me.glControl1 = New GLControl
Me.glControl1.BackColor = Color.Black
Me.glControl1.Location = New Point(0, 0)
Me.glControl1.MinimumSize = New Size(600, 120)
Me.glControl1.Name = "glControl1"
Me.glControl1.Anchor = AnchorStyles.Left Or AnchorStyles.Top Or AnchorStyles.Right Or AnchorStyles.Bottom
Me.glControl1.Location = New Point(0, 0)
Me.glControl1.Size = Me.ClientSize
Me.glControl1.TabIndex = 0
Me.glControl1.TabStop = False
Me.glControl1.VSync = False
Me.Controls.Add(Me.glControl1)
Me.ResumeLayout(False)
Dim glControl1 As New GLWpfControl
Dim glControlHost = New ElementHost
glControlHost.BackColor = Color.Black
glControlHost.Name = "glControl1"
glControlHost.Anchor = AnchorStyles.Left Or AnchorStyles.Top Or AnchorStyles.Right Or AnchorStyles.Bottom
glControlHost.Location = New Point(0, 0)
glControlHost.Size = Me.ClientSize
glControlHost.MinimumSize = New Size(600, 120)
glControlHost.TabIndex = 0
glControlHost.TabStop = False
Me.glControl1 = glControl1
Me.glControlHost = glControlHost
Dim controlSettings As New GLWpfControlSettings With
{
.RenderContinuously = False,
.GraphicsProfile = Windowing.Common.ContextProfile.Compatability
}
glControl1.Start(controlSettings)
glControlHost.Child = glControl1
Controls.Add(glControlHost)
'RenderTimer.SynchronizingObject = Nothing
Scaling = scale
'Toolkit.Init()
ProjMatrix = Matrix4.CreatePerspectiveFieldOfView(FOV, glControlHost.Width / glControlHost.Height, 100.0F, 100000.0F)
glControl1.CreateControl()
AddHandler glControl1.MouseWheel, AddressOf glControl1_Wheel
ProjMatrix = Matrix4.CreatePerspectiveFieldOfView(FOV, glControl1.Width / glControl1.Height, 100.0F, 100000.0F)
glControl1.Enabled = False
ResumeLayout()
MyCamera.SetCameraMode(CameraMode.FLY, camMtx)
MyCamera.UpdateMatrix(camMtx)
Me.ResumeLayout()
For Each obj As Object3D In objs
AddModel(obj)
Next
finishedLoading = True
End Sub
Public Sub UpdateOrbitCamera()
@@ -163,11 +184,16 @@ Namespace PreviewN
End Sub
Public Sub UpdateView()
If glControl1.Enabled Then
glControl1.Invoke(Sub() glControl1.Invalidate())
If glControlHost.Enabled AndAlso finishedLoading Then
Invoke(Sub() InvalidateGL())
End If
End Sub
Private Sub InvalidateGL()
glControl1.InvalidateVisual()
glControlHost.Invalidate()
End Sub
Public Function AddModel(obj As Object3D) As Renderer
Dim rndr As New Renderer(obj)
AddModel(rndr)
@@ -179,9 +205,8 @@ Namespace PreviewN
End Sub
Public Sub HandlesOnShown(sender As Object, e As EventArgs) Handles MyBase.Shown
glControl1.Enabled = True
RenderModels()
glControl1.Invalidate()
InvalidateGL()
End Sub
Public Sub RenderModels()
@@ -197,7 +222,7 @@ Namespace PreviewN
End If
End Sub
Private Sub glControl1_Load(sender As Object, e As EventArgs) Handles glControl1.Load
Private Sub glControl1_Load() Handles glControl1.Ready
GL.Enable(EnableCap.Blend)
GL.BlendFunc(BlendingFactor.SrcAlpha, BlendingFactor.OneMinusSrcAlpha)
@@ -227,11 +252,10 @@ Namespace PreviewN
End If
End Sub
Public Sub HandlesOnPaint(sender As Object, e As PaintEventArgs) Handles glControl1.Paint
Public Sub HandlesOnPaint(renderTime As TimeSpan) Handles glControl1.Render
GL.ClearColor(ClearColor)
GL.Clear(ClearBufferMask.ColorBufferBit Or ClearBufferMask.DepthBufferBit)
GL.LoadIdentity()
GL.MatrixMode(MatrixMode.Projection)
GL.LoadMatrix(ProjMatrix)
GL.MatrixMode(MatrixMode.Modelview)
@@ -243,24 +267,27 @@ Namespace PreviewN
End If
Next
glControl1.SwapBuffers()
GL.End()
GL.Finish()
'glControl1.SwapBuffers()
End Sub
Private Sub glControl1_Resize(sender As Object, e As EventArgs) Handles glControl1.Resize
glControl1.Context.Update(glControl1.WindowInfo)
GL.Viewport(0, 0, glControl1.Width, glControl1.Height)
ProjMatrix = Matrix4.CreatePerspectiveFieldOfView(FOV, glControl1.Width / glControl1.Height, 100.0F, 100000.0F)
glControl1.Invalidate()
Private Sub glControl1_Resize(sender As Object, e As EventArgs) Handles glControlHost.Resize
'glControl1.Context.Update(glControl1.WindowInfo)
GL.Viewport(0, 0, glControlHost.Width, glControlHost.Height)
ProjMatrix = Matrix4.CreatePerspectiveFieldOfView(FOV, glControlHost.Width / glControlHost.Height, 100.0F, 100000.0F)
InvalidateGL()
End Sub
Private Sub glControl1_Wheel(sender As Object, e As MouseEventArgs)
Private Sub glControl1_Wheel(sender As Object, e As Windows.Input.MouseWheelEventArgs) Handles glControl1.MouseWheel
MyCamera.ResetMouseStuff()
MyCamera.UpdateCameraMatrixWithScrollWheel(CInt(Math.Truncate(e.Delta * (If(IsShiftPressed, 3.5F, 1.5F)))), camMtx)
savedCamPos = MyCamera.Position
glControl1.Invalidate()
InvalidateGL()
End Sub
Private Sub glControl1_MouseDown(ByVal sender As Object, ByVal e As MouseEventArgs) Handles glControl1.MouseDown
Private Sub glControl1_MouseDown(ByVal sender As Object, ByVal e As Windows.Input.MouseButtonEventArgs) Handles glControl1.MouseDown
IsMouseDown = True
savedCamPos = MyCamera.Position
End Sub
@@ -270,47 +297,47 @@ Namespace PreviewN
IsMouseDown = False
End Sub
Private Sub glControl1_MouseMove(ByVal sender As Object, ByVal e As MouseEventArgs) Handles glControl1.MouseMove
If IsMouseDown AndAlso e.Button = MouseButtons.Left Then
Private Sub glControl1_MouseMove(ByVal sender As Object, ByVal e As Windows.Input.MouseEventArgs) Handles glControl1.MouseMove
If e.LeftButton = MouseButtonState.Pressed Then
Dim pos = e.GetPosition(glControl1)
If IsShiftPressed Then
MyCamera.UpdateCameraOffsetWithMouse(savedCamPos, e.X, e.Y, glControl1.Width, glControl1.Height, camMtx)
MyCamera.UpdateCameraOffsetWithMouse(savedCamPos, pos.X, pos.Y, glControl1.Width, glControl1.Height, camMtx)
Else
MyCamera.UpdateCameraMatrixWithMouse(e.X, e.Y, camMtx)
MyCamera.UpdateCameraMatrixWithMouse(pos.X, pos.Y, camMtx)
End If
glControl1.Invalidate()
InvalidateGL()
End If
End Sub
Public Sub MoveCameraViaWASDQE()
Dim moveSpeed As Integer = Convert.ToInt32(Math.Round((If(IsShiftPressed, 60, 30)) * (MyCamera.CamSpeedMultiplier), 0))
Dim allowCamMove As Boolean = Not (IsMouseDown AndAlso IsShiftPressed)
Dim state = Keyboard
If allowCamMove Then
Dim state As KeyboardState = Keyboard.GetState
If state(Key.W) Then
If state.IsKeyDown(Key.W) Then
'camera.Move(moveSpeed, moveSpeed, camMtx)
MyCamera.UpdateCameraMatrixWithScrollWheel(moveSpeed, camMtx)
savedCamPos = MyCamera.Position
End If
If state(Key.S) Then
If state.IsKeyDown(Key.S) Then
'camera.Move(-moveSpeed, -moveSpeed, camMtx)
MyCamera.UpdateCameraMatrixWithScrollWheel(-moveSpeed, camMtx)
savedCamPos = MyCamera.Position
End If
If state(Key.A) Then
If state.IsKeyDown(Key.A) Then
'camera.Move(-moveSpeed, 0, camMtx)
MyCamera.UpdateCameraOffsetDirectly(-moveSpeed, 0, camMtx)
End If
If state(Key.D) Then
If state.IsKeyDown(Key.D) Then
'camera.Move(moveSpeed, 0, camMtx)
MyCamera.UpdateCameraOffsetDirectly(moveSpeed, 0, camMtx)
End If
If state(Key.E) Then
If state.IsKeyDown(Key.E) Then
'camera.Move(0, -moveSpeed, camMtx)
MyCamera.UpdateCameraOffsetDirectly(0, -moveSpeed, camMtx)
End If
If state(Key.Q) Then
If state.IsKeyDown(Key.Q) Then
'camera.Move(0, moveSpeed, camMtx)
MyCamera.UpdateCameraOffsetDirectly(0, moveSpeed, camMtx)
End If

View File

@@ -1,9 +1,13 @@
Imports System.Drawing
Imports System.Threading
Imports System.Windows.Forms
Imports OpenTK
Imports OpenTK.Graphics.OpenGL
Imports OpenTK.Mathematics
Imports Pilz.S3DFileParser
Imports Bitmap = System.Drawing.Bitmap
Imports Color = System.Drawing.Color
Imports Image = System.Drawing.Image

View File

@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<MyType>Windows</MyType>
<TargetFramework>net48</TargetFramework>
<TargetFramework>net5.0-windows7.0</TargetFramework>
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
<DocumentationFile>Pilz.Drawing.xml</DocumentationFile>
<DefineTrace>true</DefineTrace>
@@ -26,6 +26,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="System.Data.DataSetExtensions" Version="4.5.0" />
<PackageReference Include="System.Drawing.Common" Version="4.7.0" />
<PackageReference Include="System.Net.Http" Version="4.3.4" />
</ItemGroup>
<ItemGroup>

View File

@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<MyType>Windows</MyType>
<TargetFramework>net48</TargetFramework>
<TargetFramework>net5.0-windows7.0</TargetFramework>
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
<DocumentationFile>Pilz.Networking.xml</DocumentationFile>
<DefineTrace>true</DefineTrace>

View File

@@ -1,7 +1,7 @@
Imports System.Numerics
Public Class Material
Implements IComparable
Implements IComparable(Of Material)
Public Property Image As Image = Nothing
Public Property Color As Color? = Nothing
@@ -10,16 +10,11 @@ Public Class Material
Public Property Scale As New Vector2(1.0F, 1.0F)
Public Property Tag As Object = Nothing
Public Function CompareTo(obj As Object) As Integer Implements IComparable.CompareTo
If obj IsNot Nothing Then
If obj Is Me Then
Return 0
Else
Return -1
End If
Else
Return 1
End If
Public Function CompareTo(obj As Material) As Integer Implements IComparable(Of Material).CompareTo
'If obj Is Me Then Return 0
'If obj Is Nothing Then Return 1
'Return -1
Return GetHashCode() - If(obj?.GetHashCode, 0)
End Function
End Class

View File

@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<MyType>Windows</MyType>
<TargetFramework>net48</TargetFramework>
<TargetFramework>net5.0-windows7.0</TargetFramework>
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
<DocumentationFile>Pilz.Threading.xml</DocumentationFile>
<DefineTrace>true</DefineTrace>
@@ -38,9 +38,6 @@
<PackageReference Include="System.Data.DataSetExtensions" Version="4.5.0" />
<PackageReference Include="System.Net.Http" Version="4.3.4" />
</ItemGroup>
<ItemGroup>
<Reference Include="System.Windows.Forms" />
</ItemGroup>
<ItemGroup>
<Import Include="Microsoft.VisualBasic" />
<Import Include="System" />

View File

@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<MyType>Windows</MyType>
<TargetFramework>net48</TargetFramework>
<TargetFramework>net5.0-windows7.0</TargetFramework>
<NoWarn>42016,41999,42017,42018,42019,42032,42036,42020,42021,42022</NoWarn>
<DocumentationFile>Pilz.UI.xml</DocumentationFile>
<DefineTrace>true</DefineTrace>
@@ -43,9 +43,6 @@
<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
</ItemGroup>
<ItemGroup>
<Reference Include="System.Windows.Forms" />
</ItemGroup>
<ItemGroup>
<Import Include="Microsoft.VisualBasic" />
<Import Include="System" />

View File

@@ -1,7 +1,7 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.28307.329
# Visual Studio Version 16
VisualStudioVersion = 16.0.30717.126
MinimumVisualStudioVersion = 10.0.40219.1
Project("{778DAE3C-4631-46EA-AA77-85C1314464D9}") = "Pilz", "Pilz\Pilz.vbproj", "{277D2B83-7613-4C49-9CAB-E080195A6E0C}"
EndProject

BIN
Shared Libs/OpenTK3.dll Normal file

Binary file not shown.