• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

luttje / Key2Joy / 6517266969

14 Oct 2023 11:05AM UTC coverage: 12.469% (+0.2%) from 12.308%
6517266969

push

github

web-flow
Implementing plugins for better separation (#39)

* Start implementing plugins for better separation
* massive refactor in attempt to split appdomains for plugins
* (breaks old mapping profiles)
* Fix error when switching from mouse button trigger to keyboard trigger and clicking in the combobox where the mouse button capture textbox is.
* Simplify code by removing legacy
* SImplify grouping actions
* Fix profile and add helpful opposite mapping generator tool
* Change solution hierarchy
* Restrict AppDomain plugins went from Zone.MyComputer -> .Internet
* create keypair in ci
* Install the .NET framework tools
* Run command in workflow
* Plugin permissions. Plugins disabled by default
* update readme (icon is no longer used)
* Plugin action runs in seperated process
* Remove unused dependencies.
* Fix action name display for mapping
* Fix Lua plugin script calls (NOTE: laggy when using MessageBox)
* convert project to sdk style
* Add editorconfig and start cleaning up
* Fix documentation. Update namespaces to match files (breaks profiles)
* Include all projects in tests, disable building docs on debug
* Add messagebox script action
* Add tests for pluginhost
* Remove administrator from window title test
* add some icons to ui
* Add enabling/disabling plugins
* Close plugins when Key2Joy shuts down
* Fix appcommand failing
* Fix plugin permission form crashing. Fix plugin load exception not showing warning
* Handle plugin host closing better when app has crashed
* Seperate host and client logic in remote event subscriber
* Ensure the PluginHost shuts down if the app crashes
* Better error output for plugins
* Fix cmd interop not working, add some tests
* also generate docs on plugins
* Fix build order with docs
* Fix enum script parameters and ensure actions share environment scopes
* Fix _wpftmp folders being created dotnet/wpf#2930
* Fix sequence action. Add disabled trigger/action for unloaded plugins on start... (continued)

180 of 1703 branches covered (0.0%)

Branch coverage included in aggregate %.

6419 of 6419 new or added lines in 207 files covered. (100.0%)

1035 of 8041 relevant lines covered (12.87%)

8445.05 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

13.64
/Core/Key2Joy.Core/Mapping/Actions/Graphics/GetPixelColorAction.cs
1
using System;
2
using System.Drawing;
3
using System.Threading.Tasks;
4
using Key2Joy.Contracts.Mapping;
5
using Key2Joy.Contracts.Mapping.Actions;
6
using Key2Joy.Contracts.Mapping.Triggers;
7
using Key2Joy.Mapping.Actions.Scripting;
8

9
namespace Key2Joy.Mapping.Actions.Graphics;
10

11
[Action(
12
    Description = "Get Pixel Color",
13
    Visibility = MappingMenuVisibility.Never,
14
    NameFormat = "Get a Pixel Color"
15
)]
16
public class GetPixelColorAction : CoreAction
17
{
18
    private readonly Bitmap pixelCache = new(1, 1);
1✔
19

20
    public GetPixelColorAction(string name)
21
        : base(name)
1✔
22
    { }
2✔
23

24
    /// <markdown-doc>
25
    /// <parent-name>Graphics</parent-name>
26
    /// <path>Api/Graphics</path>
27
    /// </markdown-doc>
28
    /// <summary>
29
    /// Gets the color of a pixel at the given x and y position
30
    /// </summary>
31
    /// <markdown-example>
32
    /// Shows the color of the pixel at the mouse position
33
    /// <code language="lua">
34
    /// <![CDATA[
35
    /// local cursor = Cursor.GetPosition()
36
    /// local pixelColor = Graphics.GetPixelColor(cursor.X, cursor.Y)
37
    /// print(pixelColor.R) -- Red
38
    /// print(pixelColor.G) -- Green
39
    /// print(pixelColor.B) -- Blue
40
    /// print(pixelColor.A) -- Alpha (opacity, always 255)
41
    /// ]]>
42
    /// </code>
43
    /// </markdown-example>
44
    /// <returns>A color object containing Red, Green and Blue color information</returns>
45
    /// <param name="x">X position on screen</param>
46
    /// <param name="y">Y position on screen</param>
47
    /// <name>Graphics.GetPixelColor</name>
48
    [ExposesScriptingMethod("Graphics.GetPixelColor")]
49
    public Color ExecuteForScript(int x, int y)
50
    {
×
51
        Rectangle bounds = new(x, y, 1, 1);
×
52

53
        lock (BaseScriptAction.LockObject)
×
54
        {
×
55
            using var g = System.Drawing.Graphics.FromImage(this.pixelCache);
×
56
            g.CopyFromScreen(bounds.Location, Point.Empty, bounds.Size);
×
57
        }
×
58

59
        return this.pixelCache.GetPixel(0, 0);
×
60
    }
×
61

62
    public override async Task Execute(AbstractInputBag inputBag = null)
63
    {
×
64
        // TODO: Currently this is only a script action...
65
    }
×
66

67
    public override bool Equals(object obj)
68
    {
×
69
        if (obj is not GetPixelColorAction)
×
70
        {
×
71
            return false;
×
72
        }
73

74
        return true;
×
75
    }
×
76
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc