migrate Pilz.Win32 & optimize Pilz & Pilz.IO
This commit is contained in:
17
Pilz.Win32/Mapped/FileTypeIcons.cs
Normal file
17
Pilz.Win32/Mapped/FileTypeIcons.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
namespace Pilz.Win32.Mapped;
|
||||
|
||||
|
||||
public static class FileTypeIcons
|
||||
{
|
||||
|
||||
public static Icon ExtractIconFromFilePath(string filePath, SystemIconSize size)
|
||||
{
|
||||
return Internals.IconExtractor.ExtractIcon(filePath, size);
|
||||
}
|
||||
|
||||
public static Icon ExtractIconFromFileExtension(string fileExtension, SystemIconSize size)
|
||||
{
|
||||
return Internals.IconFactory.IconFromExtensionShell(fileExtension, size);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,17 +0,0 @@
|
||||
Imports System.Drawing
|
||||
|
||||
Namespace Mapped
|
||||
|
||||
Public Module FileTypeIcons
|
||||
|
||||
Public Function ExtractIconFromFilePath(filePath As String, size As SystemIconSize) As Icon
|
||||
Return Internals.IconExtractor.ExtractIcon(filePath, size)
|
||||
End Function
|
||||
|
||||
Public Function ExtractIconFromFileExtension(fileExtension As String, size As SystemIconSize) As Icon
|
||||
Return Internals.IconFactory.IconFromExtensionShell(fileExtension, size)
|
||||
End Function
|
||||
|
||||
End Module
|
||||
|
||||
End Namespace
|
||||
22
Pilz.Win32/Mapped/Keyboard.cs
Normal file
22
Pilz.Win32/Mapped/Keyboard.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
|
||||
using Microsoft.VisualBasic.CompilerServices;
|
||||
using Pilz.Win32.Native;
|
||||
using Keys = System.Windows.Forms.Keys;
|
||||
|
||||
namespace Pilz.Win32.Mapped;
|
||||
|
||||
|
||||
public class Keyboard
|
||||
{
|
||||
|
||||
public static bool IsKeyDown(int keyCode)
|
||||
{
|
||||
return Conversions.ToDouble(User32.GetKeyState(keyCode).ToString() + 0x8000) < 0d;
|
||||
}
|
||||
|
||||
public static bool IsKeyDown(Keys keyCode)
|
||||
{
|
||||
return IsKeyDown((int)keyCode);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
Imports Pilz.Win32.Native
|
||||
|
||||
Imports Keys = System.Windows.Forms.Keys
|
||||
|
||||
Namespace Mapped
|
||||
|
||||
Public Class Keyboard
|
||||
|
||||
Public Shared Function IsKeyDown(keyCode As Integer) As Boolean
|
||||
Return (User32.GetKeyState(keyCode) & &H8000) < 0
|
||||
End Function
|
||||
|
||||
Public Shared Function IsKeyDown(keyCode As Keys) As Boolean
|
||||
Return IsKeyDown(CInt(keyCode))
|
||||
End Function
|
||||
|
||||
End Class
|
||||
|
||||
End Namespace
|
||||
22
Pilz.Win32/Mapped/NativeFileInfo.cs
Normal file
22
Pilz.Win32/Mapped/NativeFileInfo.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
using Pilz.Win32.Native;
|
||||
|
||||
namespace Pilz.Win32.Mapped;
|
||||
|
||||
|
||||
public class NativeFileInfo
|
||||
{
|
||||
|
||||
public Icon Icon { get; private set; }
|
||||
public int SystemIconIndex { get; private set; }
|
||||
public string Displayname { get; private set; }
|
||||
public string Typename { get; private set; }
|
||||
|
||||
public NativeFileInfo(SHFILEINFO info)
|
||||
{
|
||||
Icon = Icon.FromHandle(info.hIcon);
|
||||
SystemIconIndex = (int)info.iIcon;
|
||||
Displayname = info.szDisplayName;
|
||||
Typename = info.szTypeName;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
Imports System.Drawing
|
||||
|
||||
Imports Pilz.Win32.Native
|
||||
|
||||
Namespace Mapped
|
||||
|
||||
Public Class NativeFileInfo
|
||||
|
||||
Public ReadOnly Property Icon As Icon
|
||||
Public ReadOnly Property SystemIconIndex As Integer
|
||||
Public ReadOnly Property Displayname As String
|
||||
Public ReadOnly Property Typename As String
|
||||
|
||||
Public Sub New(info As SHFILEINFO)
|
||||
Icon = Icon.FromHandle(info.hIcon)
|
||||
SystemIconIndex = info.iIcon
|
||||
Displayname = info.szDisplayName
|
||||
Typename = info.szTypeName
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
|
||||
End Namespace
|
||||
13
Pilz.Win32/Mapped/SystemIconSize.cs
Normal file
13
Pilz.Win32/Mapped/SystemIconSize.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
|
||||
namespace Pilz.Win32.Mapped;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Two constants extracted from the FileInfoFlags, the only that are
|
||||
/// meaningfull for the user of this class.
|
||||
/// </summary>
|
||||
public enum SystemIconSize : int
|
||||
{
|
||||
Large,
|
||||
Small
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
Namespace Mapped
|
||||
|
||||
''' <summary>
|
||||
''' Two constants extracted from the FileInfoFlags, the only that are
|
||||
''' meaningfull for the user of this class.
|
||||
''' </summary>
|
||||
Public Enum SystemIconSize As Integer
|
||||
Large
|
||||
Small
|
||||
End Enum
|
||||
|
||||
End Namespace
|
||||
Reference in New Issue
Block a user