Everything was done before
This commit is contained in:
commit
d6720cf687
5 changed files with 171 additions and 0 deletions
37
.gitignore
vendored
Normal file
37
.gitignore
vendored
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
*.swp
|
||||
*.*~
|
||||
project.lock.json
|
||||
.DS_Store
|
||||
*.pyc
|
||||
nupkg/
|
||||
|
||||
# Visual Studio Code
|
||||
.vscode
|
||||
|
||||
# Rider
|
||||
.idea
|
||||
|
||||
# User-specific files
|
||||
*.suo
|
||||
*.user
|
||||
*.userosscache
|
||||
*.sln.docstates
|
||||
|
||||
# Build results
|
||||
[Dd]ebug/
|
||||
[Dd]ebugPublic/
|
||||
[Rr]elease/
|
||||
[Rr]eleases/
|
||||
x64/
|
||||
x86/
|
||||
build/
|
||||
bld/
|
||||
[Bb]in/
|
||||
[Oo]bj/
|
||||
[Oo]ut/
|
||||
msbuild.log
|
||||
msbuild.err
|
||||
msbuild.wrn
|
||||
|
||||
# Visual Studio 2015
|
||||
.vs/
|
||||
16
AnimeTiddiesHotkey.sln
Normal file
16
AnimeTiddiesHotkey.sln
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AnimeTiddiesHotkey", "AnimeTiddiesHotkey\AnimeTiddiesHotkey.csproj", "{EFC09282-90DF-40A1-92C5-0C495D023017}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{EFC09282-90DF-40A1-92C5-0C495D023017}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{EFC09282-90DF-40A1-92C5-0C495D023017}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{EFC09282-90DF-40A1-92C5-0C495D023017}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{EFC09282-90DF-40A1-92C5-0C495D023017}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
27
AnimeTiddiesHotkey/AnimeTiddiesHotkey.csproj
Normal file
27
AnimeTiddiesHotkey/AnimeTiddiesHotkey.csproj
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net5.0-windows</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Reference Include="System.Drawing.Common, Version=5.0.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51">
|
||||
<HintPath>..\..\..\..\scoop\apps\dotnet-sdk\5.0.103\shared\Microsoft.WindowsDesktop.App\5.0.3\System.Drawing.Common.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Security.Permissions, Version=5.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51">
|
||||
<HintPath>..\..\..\..\scoop\apps\dotnet-sdk\5.0.103\shared\Microsoft.WindowsDesktop.App\5.0.3\System.Security.Permissions.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Windows.Forms, Version=5.0.3.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<HintPath>..\..\..\..\scoop\apps\dotnet-sdk\5.0.103\shared\Microsoft.WindowsDesktop.App\5.0.3\System.Windows.Forms.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="WindowsBase, Version=5.0.3.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
|
||||
<HintPath>..\..\..\..\scoop\apps\dotnet-sdk\5.0.103\shared\Microsoft.WindowsDesktop.App\5.0.3\WindowsBase.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="MouseKeyHook" Version="5.6.0" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
13
AnimeTiddiesHotkey/ImagesStrings.cs
Normal file
13
AnimeTiddiesHotkey/ImagesStrings.cs
Normal file
File diff suppressed because one or more lines are too long
78
AnimeTiddiesHotkey/Program.cs
Normal file
78
AnimeTiddiesHotkey/Program.cs
Normal file
|
|
@ -0,0 +1,78 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Windows.Forms;
|
||||
using Gma.System.MouseKeyHook;
|
||||
|
||||
namespace AnimeTiddiesHotkey {
|
||||
internal static class Program {
|
||||
private static IKeyboardMouseEvents _globalHook;
|
||||
private static NotifyIcon _trayIcon;
|
||||
private static bool _quiet = false;
|
||||
|
||||
[STAThreadAttribute]
|
||||
private static void Main(string[] args) {
|
||||
_globalHook = Hook.GlobalEvents();
|
||||
_globalHook.OnCombination(new List<KeyValuePair<Combination, Action>>(new [] {
|
||||
new KeyValuePair<Combination, Action>(Combination.FromString("ControlKey+ShiftKey+R"), Application.Exit),
|
||||
new KeyValuePair<Combination, Action>(Combination.FromString("ControlKey+ShiftKey+E"), SetClipboard),
|
||||
new KeyValuePair<Combination, Action>(Combination.FromString("ControlKey+ShiftKey+M"), () => ToggleQuite(null, null))
|
||||
}));
|
||||
|
||||
_trayIcon = new NotifyIcon {
|
||||
Visible = true,
|
||||
Icon = SystemIcons.Application
|
||||
};
|
||||
_trayIcon.Click += ShowHelp;
|
||||
_trayIcon.DoubleClick += ToggleQuite;
|
||||
|
||||
var handle = GetConsoleWindow();
|
||||
ShowWindow(handle, 0);
|
||||
|
||||
ShowHelp(null, null);
|
||||
Application.Run();
|
||||
ShowPopup("Goodbye");
|
||||
}
|
||||
|
||||
[DllImport("kernel32.dll")]
|
||||
static extern IntPtr GetConsoleWindow();
|
||||
|
||||
[DllImport("user32.dll")]
|
||||
static extern bool ShowWindow(IntPtr hWnd, int nCmdShow);
|
||||
|
||||
private static void ShowHelp(object _, EventArgs __) {
|
||||
ShowPopup("Ctrl+Shift+R - Exit\nCtrl+Shift+E - Roll\nCtrl+Shift+M - Toggle quiet");
|
||||
}
|
||||
|
||||
private static void ToggleQuite(object _, EventArgs __) {
|
||||
var oq = _quiet;
|
||||
_quiet = false;
|
||||
ShowPopup(_quiet? "Now I am loud!" : "Now I am silent!");
|
||||
_quiet = oq;
|
||||
|
||||
_quiet = !_quiet;
|
||||
}
|
||||
|
||||
private static void ShowPopup(string message, int timeout=1000, ToolTipIcon icon=ToolTipIcon.Info) {
|
||||
if (_quiet) return;
|
||||
_trayIcon.ShowBalloonTip(timeout, "Anime Tiddies trigger", message, icon);
|
||||
}
|
||||
|
||||
private static void SetClipboard() {
|
||||
var roll = new Random().Next(0, ImagesStrings.bigTiddiesDragons.Length);
|
||||
ShowPopup($"Roll: {roll}");
|
||||
var image = Base64ToImage(ImagesStrings.bigTiddiesDragons[roll]);
|
||||
Clipboard.SetImage(image);
|
||||
}
|
||||
|
||||
private static Image Base64ToImage(string base64String)
|
||||
{
|
||||
var imageBytes = Convert.FromBase64String(base64String);
|
||||
using var ms = new MemoryStream(imageBytes, 0, imageBytes.Length);
|
||||
var image = Image.FromStream(ms, true);
|
||||
return image;
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue