EmpressiaLibrary.NET 1.0.18

dotnet add package EmpressiaLibrary.NET --version 1.0.18
NuGet\Install-Package EmpressiaLibrary.NET -Version 1.0.18
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="EmpressiaLibrary.NET" Version="1.0.18" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add EmpressiaLibrary.NET --version 1.0.18
#r "nuget: EmpressiaLibrary.NET, 1.0.18"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install EmpressiaLibrary.NET as a Cake Addin
#addin nuget:?package=EmpressiaLibrary.NET&version=1.0.18

// Install EmpressiaLibrary.NET as a Cake Tool
#tool nuget:?package=EmpressiaLibrary.NET&version=1.0.18

Empressia Library .NET

このライブラリは、.NET用のライブラリです。
主に自分用です。

中身の一覧とかメモ

以下を使用できます。
WPF用のは、Empressia Library .NET.WPFに移動しました。

  1. ex だいたい名前の通りの追加クラスたち。
    1. ByteQueue
    2. BytesKeyDirectory
    3. EDictionary XMLで保存するための拡張されたDictionary。
    4. EndlessStream
    5. ExceptionEventArgs
    6. EXMLSerializeer XMLを簡単にSerialize、Deserializeするためのクラス。
    7. ExtensionMethods いろんな基本的なクラスの拡張メソッドが入っている静的クラス。
    8. MessageEventArgs
    9. NetworkBitConverter
    10. StreamUtilities 二つのStreamが一致している前提で確認をするメソッドがあります。
  2. setting アプリケーションの設定用……だけど、使いにくいかも?
    1. SettingNode
    2. SettingSerializer
    3. SettingTree
    4. SettingMergable
  3. win32 Win32 APIの適当なWrapperです。
    1. AVIManager よくわからない。
    2. DisplayManager 画面管理(これを使う場合は、別途、System.Drawing.Commonが必要です)。
    3. DisplayPowerManager 電源管理。
    4. HookManager Windowメッセージのフック管理。
    5. KeyboardManager キーボード管理。
    6. WindowManager ウィンドウ管理。

StreamUtilities

何をするの?

今は、メソッド1個だけ。
ふたつのStreamの中身の値が一致していることを確認します。

どういうとき使うの?

二つのファイルが同じはずだけど本当に同じか確認するときとか。
異なる想定じゃなくて、同じはずっていう想定で組まれています。

使い方

次みたいな感じで使います。

using(FileStream s1 = new FileStream("s1.png", FileMode.Open, FileAccess.Read))
using(FileStream s2 = new FileStream("s2.png", FileMode.Open, FileAccess.Read)) {
	if(StreamUtilities.containsSameBytes(s1, s2)) {
		Console.WriteLine("一致しました。");
	}
}

HookManager

何をするの?

Windowsメッセージを簡単にフックするためのクラス。

どういうとき使うの?

システム上で起こるキーボードとマウスの入力を読み取りたい時に使います。 クリック、とかじゃなくて、ボタンを押した離したっていう感じです。

使い方

今のところの想定は、次みたいな感じ。

using(KeyboardGlobalSession session = HookManager.createKeyboardGloalSession()) {
	session.Hook += (code, wParam, lParam) => {
		// 変換もフィルターも関係なく処理したいとき用。たぶん、使わない。
	};
	session.HandleFilter += (code, wParam, lParam) => {
		// Handleを呼ばないようにフィルターしたいとき用の処理。wParamで間引きたいとき用。trueを返すとHandleが呼ばれなくなる。
	};
	session.Handle += (message, info) => {
		// イベント処理。
	};
	// ここで止めるとか。
	// 別に、ちゃんと解放処理入れてあるから、usingじゃなくてもDisposeされる限り平気だけど。
	// アプリケーション終わって自動で解放されるときでも良いんだけど。
	// いらなくなったら、すぐに解放しないとね。重要なリソースだし。
}

WindowManager

何をするの?

Windowの情報を得ます。

どういうとき使うの?

ウィンドウのプロセスID、タイトルとかがほしいとき……かな。

使い方

今のところの想定は、次みたいな感じ。

WindowInformation info = WindowManager.getForegroundWindow();
if(info == null) { return; }
Console.WriteLine(info.TitleText);
Console.WriteLine(info.ProcessID);
Console.WriteLine(info.ModuleFilePath);

トラブルシュート

WindowManagerでModuleFilePathがとれないんだけど。

アプリのビルドがx86になっているか、AnyCPUで32ビット優先の設定になっていないか確認しましょう。


最近の更新履歴

  • 2023/10/22 1.0.18
    • .NET用に書き換えました。
    • 汎用とWPF用で分けました。
    • 見つけた不具合とかを修正しました。
Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net6.0

    • No dependencies.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on EmpressiaLibrary.NET:

Package Downloads
EmpressiaLibrary.NET.WPF

Empressia Library for .NET WPF.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.18 248 10/21/2023

.NET用に書き換えました。
汎用とWPF用で分けました。
つけた不具合とかを修正しました。