Skip to content

Commit

Permalink
Merge branch 'dev' of https://github.com/lindexi/lindexi_gd into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
lindexi committed Oct 30, 2023
2 parents dd5ca32 + 12e8c29 commit 8da9c69
Show file tree
Hide file tree
Showing 11 changed files with 191 additions and 32 deletions.
31 changes: 31 additions & 0 deletions CucherelahiBewilargalkalbea/CucherelahiBewilargalkalbea.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.6.33829.357
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CucherelahiBewilargalkalbea", "CucherelahiBewilargalkalbea\CucherelahiBewilargalkalbea.csproj", "{47BA7634-768D-4156-97C6-DE7E7B05265C}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{47BA7634-768D-4156-97C6-DE7E7B05265C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{47BA7634-768D-4156-97C6-DE7E7B05265C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{47BA7634-768D-4156-97C6-DE7E7B05265C}.Debug|x86.ActiveCfg = Debug|x86
{47BA7634-768D-4156-97C6-DE7E7B05265C}.Debug|x86.Build.0 = Debug|x86
{47BA7634-768D-4156-97C6-DE7E7B05265C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{47BA7634-768D-4156-97C6-DE7E7B05265C}.Release|Any CPU.Build.0 = Release|Any CPU
{47BA7634-768D-4156-97C6-DE7E7B05265C}.Release|x86.ActiveCfg = Release|x86
{47BA7634-768D-4156-97C6-DE7E7B05265C}.Release|x86.Build.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {EF4B5758-122F-458F-9AAF-DC9969C7F73D}
EndGlobalSection
EndGlobal
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<Application x:Class="CucherelahiBewilargalkalbea.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:CucherelahiBewilargalkalbea"
StartupUri="MainWindow.xaml">
<Application.Resources>

</Application.Resources>
</Application>
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;

namespace CucherelahiBewilargalkalbea;
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
{
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
using System.Windows;

[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<Nullable>enable</Nullable>
<UseWPF>true</UseWPF>
<LangVersion>latest</LangVersion>
<Platforms>AnyCPU;x86</Platforms>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Windows.CsWin32" PrivateAssets="all" Version="0.2.63-beta" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<Window x:Class="CucherelahiBewilargalkalbea.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:CucherelahiBewilargalkalbea"
mc:Ignorable="d"
Title="MainWindow" Height="450" Width="800">
<Grid>
<Button Click="Button_OnClick"></Button>
</Grid>
</Window>
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Interop;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

using Windows.Win32.Foundation;
using Windows.Win32.UI.WindowsAndMessaging;

namespace CucherelahiBewilargalkalbea;
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();

SourceInitialized += MainWindow_SourceInitialized;
}

private void MainWindow_SourceInitialized(object? sender, EventArgs e)
{
var windowInteropHelper = new WindowInteropHelper(this);
var hwnd = windowInteropHelper.Handle;
HookUIAutomationMessage(hwnd);
}

private void HookUIAutomationMessage(IntPtr windowPtr)
{
// 获取原本的消息处理
var hWnd = new HWND(windowPtr);
_oldWndProc = (IntPtr) Windows.Win32.PInvoke.GetWindowLong(hWnd, WINDOW_LONG_PTR_INDEX.GWL_WNDPROC);

// 加入新的过滤处理
WindowProc? hookUIAutomationMessageWndProc = HookUIAutomationMessageWndProc;
_hookUIAutomationMessageWndProcPointer = Marshal.GetFunctionPointerForDelegate(hookUIAutomationMessageWndProc);
Windows.Win32.PInvoke.SetWindowLong(hWnd, WINDOW_LONG_PTR_INDEX.GWL_WNDPROC,
// 这里强转 int 只有 x86 下才可用
(int) _hookUIAutomationMessageWndProcPointer);
}

private IntPtr HookUIAutomationMessageWndProc(IntPtr hwnd, uint msg, IntPtr wparam, IntPtr lparam)
{
const uint WM_GETOBJECT = 0x003D;
if (msg == WM_GETOBJECT)
{
return IntPtr.Zero;
}

// 以下是调试代码
if (msg is 0x0201 or 0x0202)
{
return IntPtr.Zero;
}

// 过滤通过之后,再调用原先的消息循环
return CallWindowProc(_oldWndProc, hwnd, msg, wparam, lparam);
}

public delegate IntPtr WindowProc(IntPtr hwnd, uint msg, IntPtr wParam, IntPtr lParam);

private IntPtr _oldWndProc;
private IntPtr _hookUIAutomationMessageWndProcPointer;

[DllImport("user32", CharSet = CharSet.Unicode)]
public static extern IntPtr CallWindowProc(IntPtr lpPrevWndFunc, IntPtr hWnd, uint uMsg, IntPtr wParam,
IntPtr lParam);

private void Button_OnClick(object sender, RoutedEventArgs e)
{
throw new NotSupportedException($"不应该进来,因为鼠标被 Hook 了");
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
GetWindowLong
SetWindowLong
CallWindowProc
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="SkiaSharp" Version="2.88.0" />
<PackageReference Include="SkiaSharp.NativeAssets.Linux.NoDependencies" Version="2.88.0" />
<PackageReference Include="SkiaSharp" Version="2.88.6" />
<PackageReference Include="SkiaSharp.NativeAssets.Linux.NoDependencies" Version="2.88.6" />
</ItemGroup>

</Project>
37 changes: 7 additions & 30 deletions SkiaSharp/KebeninegeeWaljelluhi/KebeninegeeWaljelluhi/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,37 +2,14 @@

using KebeninegeeWaljelluhi;

var file = @"f:\temp\HalwemcilereKodabeebe.txt";
var outputFile = @"f:\temp\HalwemcilereKodabeebe2.txt";
var file2 = @"f:\temp\WemnoninairLeakejearwair.txt";

foreach (var line in File.ReadAllLines(file))
{
if (!string.IsNullOrEmpty(line))
{
if
(
line.Contains("docker", StringComparison.OrdinalIgnoreCase)
//|| line.Contains("TotalCommander", StringComparison.OrdinalIgnoreCase)
)
{
File.AppendAllText(file2, $"{line}\r\n\r\n");
}
else
{
File.AppendAllText(outputFile, $"{line}\r\n\r\n");
}
}
}

Run<SkiaDrawLine>();
Run<SkiaDrawCircle>();
Run<SkiaDrawRectangle>();
Run<SkiaDrawImageFile>();
Run<SkiaScaleImageFile>();
Run<SkiaDrawRoundRectangle>();
Run<SkiaDrawDissolve>();
Run<SkiaDrawStrokeCaps>();
//Run<SkiaDrawCircle>();
//Run<SkiaDrawRectangle>();
//Run<SkiaDrawImageFile>();
//Run<SkiaScaleImageFile>();
//Run<SkiaDrawRoundRectangle>();
//Run<SkiaDrawDissolve>();
//Run<SkiaDrawStrokeCaps>();

void Run<T>() where T : SkiaDrawBase, new()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ protected override void OnDraw(SKCanvas canvas)
StrokeWidth = 10,
};

canvas.Translate(300,100);

canvas.DrawLine(10, 10, 100, 10, fillPaint);

var strokePaint = new SKPaint
Expand Down

0 comments on commit 8da9c69

Please sign in to comment.