Skip to content

Commit 2c9cd5b

Browse files
committed
wip not working
1 parent bfc2201 commit 2c9cd5b

10 files changed

Lines changed: 184 additions & 289 deletions

File tree

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
using System;
2+
using Riok.Mapperly.Abstractions;
3+
using YMouseButtonControl.Core.ViewModels.Models;
4+
using YMouseButtonControl.DataAccess.Models;
5+
6+
namespace YMouseButtonControl.Core.Mappings;
7+
8+
[Mapper]
9+
public static partial class ButtonMappingMapper
10+
{
11+
[MapDerivedType<DisabledMapping, DisabledMappingVm>]
12+
[MapDerivedType<NothingMapping, NothingMappingVm>]
13+
[MapDerivedType<SimulatedKeystroke, SimulatedKeystrokeVm>]
14+
[MapDerivedType<RightClick, RightClickVm>]
15+
private static partial BaseButtonMappingVm Map(ButtonMapping buttonMapping);
16+
17+
[MapDerivedType<DisabledMappingVm, DisabledMapping>]
18+
[MapDerivedType<NothingMappingVm, NothingMapping>]
19+
[MapDerivedType<SimulatedKeystrokeVm, SimulatedKeystroke>]
20+
[MapDerivedType<RightClickVm, RightClick>]
21+
private static partial ButtonMapping Map(BaseButtonMappingVm buttonMapping);
22+
23+
private static BaseSimulatedKeystrokeTypeVm MapSimulatedKeystrokeType(
24+
SimulatedKeystrokeType simulatedKeystrokeType
25+
) =>
26+
simulatedKeystrokeType switch
27+
{
28+
SimulatedKeystrokeType.AsMousePressedAndReleasedActionType =>
29+
new AsMousePressedAndReleasedActionTypeVm(),
30+
SimulatedKeystrokeType.DuringMouseActionType => new DuringMouseActionTypeVm(),
31+
SimulatedKeystrokeType.InAnotherThreadPressedActionType =>
32+
new InAnotherThreadPressedActionTypeVm(),
33+
SimulatedKeystrokeType.InAnotherThreadReleasedActionType =>
34+
new InAnotherThreadReleasedActionTypeVm(),
35+
SimulatedKeystrokeType.MouseButtonPressedActionType =>
36+
new MouseButtonPressedActionTypeVm(),
37+
SimulatedKeystrokeType.MouseButtonReleasedActionType =>
38+
new MouseButtonReleasedActionTypeVm(),
39+
SimulatedKeystrokeType.RepeatedlyWhileButtonDownActionType =>
40+
new RepeatedlyWhileButtonDownActionTypeVm(),
41+
SimulatedKeystrokeType.StickyHoldActionType => new StickyHoldActionTypeVm(),
42+
SimulatedKeystrokeType.StickyRepeatActionType => new StickyRepeatActionTypeVm(),
43+
_ => throw new ArgumentOutOfRangeException(
44+
nameof(simulatedKeystrokeType),
45+
simulatedKeystrokeType,
46+
null
47+
),
48+
};
49+
50+
private static SimulatedKeystrokeType? MapSimulatedKeystrokeTypeVm(
51+
BaseSimulatedKeystrokeTypeVm? baseSimulatedKeystrokeVm
52+
) =>
53+
baseSimulatedKeystrokeVm switch
54+
{
55+
null => null,
56+
AsMousePressedAndReleasedActionTypeVm =>
57+
SimulatedKeystrokeType.AsMousePressedAndReleasedActionType,
58+
DuringMouseActionTypeVm => SimulatedKeystrokeType.DuringMouseActionType,
59+
InAnotherThreadPressedActionTypeVm =>
60+
SimulatedKeystrokeType.InAnotherThreadPressedActionType,
61+
InAnotherThreadReleasedActionTypeVm =>
62+
SimulatedKeystrokeType.InAnotherThreadReleasedActionType,
63+
MouseButtonPressedActionTypeVm => SimulatedKeystrokeType.MouseButtonPressedActionType,
64+
MouseButtonReleasedActionTypeVm => SimulatedKeystrokeType.MouseButtonReleasedActionType,
65+
RepeatedlyWhileButtonDownActionTypeVm =>
66+
SimulatedKeystrokeType.RepeatedlyWhileButtonDownActionType,
67+
StickyHoldActionTypeVm => SimulatedKeystrokeType.StickyHoldActionType,
68+
StickyRepeatActionTypeVm => SimulatedKeystrokeType.StickyRepeatActionType,
69+
_ => throw new ArgumentOutOfRangeException(),
70+
};
71+
}

YMouseButtonControl.Core/Mappings/MappingProfile.cs

Lines changed: 0 additions & 151 deletions
This file was deleted.
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
using System.Linq;
2+
using Riok.Mapperly.Abstractions;
3+
using YMouseButtonControl.Core.ViewModels.Models;
4+
using YMouseButtonControl.DataAccess.Models;
5+
6+
namespace YMouseButtonControl.Core.Mappings;
7+
8+
[Mapper]
9+
public static partial class ProfileMapper
10+
{
11+
public static partial ProfileVm Map(Profile? profile);
12+
13+
public static partial Profile Map(ProfileVm vm);
14+
15+
public static partial IQueryable<ProfileVm> Map(IQueryable<Profile> queryable);
16+
17+
public static partial void Map(ProfileVm src, Profile dst);
18+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
using Riok.Mapperly.Abstractions;
2+
using YMouseButtonControl.Core.ViewModels.Models;
3+
using YMouseButtonControl.DataAccess.Models;
4+
5+
namespace YMouseButtonControl.Core.Mappings;
6+
7+
[Mapper]
8+
public static partial class SettingMapper
9+
{
10+
[MapDerivedType<SettingString, SettingStringVm>]
11+
[MapDerivedType<SettingBool, SettingBoolVm>]
12+
[MapDerivedType<SettingInt, SettingIntVm>]
13+
private static partial BaseSettingVm Map(Setting setting);
14+
15+
[MapDerivedType<SettingStringVm, SettingString>]
16+
[MapDerivedType<SettingBoolVm, SettingBool>]
17+
[MapDerivedType<SettingIntVm, SettingInt>]
18+
private static partial Setting Map(BaseSettingVm baseSettingVm);
19+
}

0 commit comments

Comments
 (0)