Synchronize the Net40
This commit is contained in:
1 parent
b3c3173c46
commit
ab6e2efe21
87 files changed
+2743
-349
No files matched your search
@@ -0,0 +1,22 @@
|
||||
using System;
|
||||
|
||||
namespace HandyControlDemo.Tools
|
||||
{
|
||||
public class AssemblyHelper
|
||||
{
|
||||
private static readonly string NameSpaceStr = typeof(AssemblyHelper).Assembly.GetName().Name;
|
||||
|
||||
public static object CreateInternalInstance(string className)
|
||||
{
|
||||
try
|
||||
{
|
||||
var type = Type.GetType($"{NameSpaceStr}.{className}");
|
||||
return type == null ? null : Activator.CreateInstance(type);
|
||||
}
|
||||
catch
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
using System.Linq;
|
||||
using System.Management;
|
||||
using HandyControl.Data;
|
||||
|
||||
namespace HandyControlDemo.Tools
|
||||
{
|
||||
public class CommonHelper
|
||||
{
|
||||
public static SystemVersionInfo GetSystemVersionInfo()
|
||||
{
|
||||
var managementClass = new ManagementClass("Win32_OperatingSystem");
|
||||
var instances = managementClass.GetInstances();
|
||||
foreach (var instance in instances)
|
||||
{
|
||||
if (instance["Version"] is string version)
|
||||
{
|
||||
var nums = version.Split('.').Select(int.Parse).ToList();
|
||||
var info = new SystemVersionInfo(nums[0], nums[1], nums[2]);
|
||||
return info;
|
||||
}
|
||||
}
|
||||
return default(SystemVersionInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace HandyControlDemo.Tools
|
||||
{
|
||||
internal class ExternDllHelper
|
||||
{
|
||||
private const string Winmm = "winmm.dll";
|
||||
|
||||
[DllImport(Winmm, EntryPoint = "mciSendString", CharSet = CharSet.Auto)]
|
||||
public static extern int MciSendString(string lpstrCommand, string lpstrReturnString, int uReturnLength, int hwndCallback);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user