Extension methods
This commit is contained in:
parent
5a4f4c083f
commit
d021fec063
@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
|
||||
namespace CC_Functions.Misc
|
||||
@ -63,5 +64,7 @@ namespace CC_Functions.Misc
|
||||
|
||||
public static void RemoveAt<T, G>(this Dictionary<T, G> dict, int index) =>
|
||||
dict.Remove(dict.Keys.OfType<T>().ToArray()[index]);
|
||||
|
||||
public static long GetSize(this DirectoryInfo directory) => IO.GetDirectorySize(directory.FullName);
|
||||
}
|
||||
}
|
14
W32/GenericExtensions.cs
Normal file
14
W32/GenericExtensions.cs
Normal file
@ -0,0 +1,14 @@
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace CC_Functions.W32
|
||||
{
|
||||
public static class GenericExtensions
|
||||
{
|
||||
public static Wnd32 GetWindow(this IntPtr handle) => Wnd32.fromHandle(handle);
|
||||
public static Wnd32 GetMainWindow(this Process handle) => Wnd32.getProcessMain(handle);
|
||||
public static Wnd32 GetWnd32(this Form frm) => Wnd32.fromForm(frm);
|
||||
public static bool IsDown(this Keys key) => KeyboardReader.IsKeyDown(key);
|
||||
}
|
||||
}
|
@ -50,6 +50,7 @@
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="GenericExtensions.cs" />
|
||||
<Compile Include="Hooks\MouseHook.cs" />
|
||||
<Compile Include="Hooks\KeyboardHook.cs" />
|
||||
<Compile Include="Hooks\KeyboardHookEventArgs.cs" />
|
||||
|
Reference in New Issue
Block a user