- 博客(18)
- 资源 (1)
- 收藏
- 关注
原创 dataGrid获取指定行指定属性名称的value
/ 假设你想获取第rowIndex行MyData类的MyProperty属性的值。// 假设你的实体类名为MyData。// 确保行索引在有效范围内。
2024-11-18 19:56:57
127
原创 RDP密码 加密方法
@[TOC ///RDP密码 加密方法/// /// /// ///static byte[] s_aditionalEntropy = null;private static byte[] Protect(byte[] data){}](这里写自定义目录标题)你好! 这是你第一次使用 Markdown编辑器 所展示的欢迎页。如果你想学习如何使用Markdown编辑器, 可以仔细阅读这篇文章,了解一下Markdown的基本语法知识。我们对Markdown编辑器进行了一些功能拓展与语法支持,
2024-09-26 15:50:33
406
原创 获取 24小时制时间
public string GetCurrentTime(){DateTime now = DateTime.Now;string time = now.ToString(“HH:mm:ss”);return time;}
2024-05-03 09:42:18
369
1
原创 C#唤醒远程机器方法
//C#唤醒远程机器方法private void WakeUp(string mac, int port, string ip){IPEndPoint point;UdpClient client = new UdpClient();byte[] magicBytes = GetMagicPacket(mac);point = new IPEndPoint(IPAddress.Parse(ip), port);//广播模式:255.255.255.255try{client.Send(ma
2021-07-02 17:30:49
416
1
原创 Android Handler消息
Handler handler = new Handler(new Handler.Callback() {@Overridepublic boolean handleMessage(Message msg){//处理消息switch (msg.what){case 1:Toast.makeText(getApplicationContext(), “建立连接失败”, Toast.LENGTH_SHORT).show();break;case 2:Toast.makeText(getA
2021-06-01 15:18:46
83
原创 模拟键盘、鼠标
[DllImport(“User32.dll”)]public static extern void keybd_event(byte bVk, byte bScan, int dwFlags, int dwExtraInfo);/// /// 按下/// const int KEYEVENTF_KEYDOWN = 0;/// /// 抬起/// const int KEYEVENTF_KEYUP = 0x2;private void Send_keybd(byte key){key
2021-05-22 17:45:35
180
原创 C# 运行命令
private void Testrun(string name1,string canshu){try{ System.Diagnostics.Process.Start(name1, canshu); } catch (Exception) { ; } }
2021-05-15 16:46:32
260
原创 进程获取、结束
private void KillProcess(string Pname){try{ Process[] processes = Process.GetProcesses(); if (processes != null) { foreach (Process p in processes) { if (p.ProcessNa
2021-05-14 22:02:55
110
原创 C# udp发送
public void send(string ip, int port, string data){try{UdpClient udpcSend = new UdpClient();byte[] byteArray = System.Text.Encoding.Default.GetBytes(data);IPEndPoint remoteIpep = new IPEndPoint(IPAddress.Parse(ip), port);//发送到的端口号以及IP地址
2021-05-14 16:01:31
952
原创 C#读写txt文件 查看文件是否存在
public static void myFileWrite(string msg, string path) { byte[] myByte = System.Text.Encoding.UTF8.GetBytes(msg); using (FileStream fsWrite = new FileStream(path, FileMode.Create, FileAccess.Write, FileShare.ReadWrite)) {
2021-04-12 18:53:40
234
1
原创 System.Timers.Timer定时器
private static void SetTimer(){System.Timers.Timer aTimer = new System.Timers.Timer(); //初始化定时器aTimer.Interval = 60000;//配置时间1分钟aTimer.Elapsed += new System.Timers.ElapsedEventHandler(OnTimedEvent);aTimer.AutoReset = true;//每到指定时间Elapsed事件是到时间就触发aTim
2021-04-06 20:09:02
285
原创 C#快捷键
[DllImport(“user32.dll”)]public static extern bool RegisterHotKey(IntPtr hWnd, int id, uint fsModifiers, uint vk);[DllImport(“user32.dll”)]public static extern bool UnregisterHotKey(IntPtr hWnd, int id); [DllImport("user32.dll")] private static
2021-04-05 16:54:12
190
3
原创 udp通信
public void receive(){ udpListenThread = new Thread(new ThreadStart(udpListen));//创建监听线程udpListenThread.IsBackground = true;//设为后台线程 udpListenThread.Start();//启动监听线程 } private void udpListen()/
2021-03-28 21:29:02
100
原创 c# 只能运行一个客户端程序
bool flag = false; System.Threading.Mutex mutex = new System.Threading.Mutex(true, "Test", out flag); //第一个参数:true--给调用线程赋予互斥体的初始所属权 //第一个参数:互斥体的名称 //第三个参数:返回值,如果调用线程已被授予互斥体的初始所属权,则返回true if (!flag) {...
2021-03-15 10:19:08
359
1
原创 C# udp 通信
public static Thread thread = null; public void receive() { thread = new Thread(ReceiveMessage); thread.Start(); thread.IsBackground = true; } public void ReceiveMessage(object obj) {//udpcSend = new UdpCl
2021-03-13 16:00:19
209
原创 C#获取 mac
C#获取 macpublic static String getLocalMacAddress(){//没有缓存的地址,则查询String mac_s = “”; IPGlobalProperties computerProperties = IPGlobalProperties.GetIPGlobalProperties(); NetworkInterface[] nics = NetworkInterface.GetAllNetworkInterfaces();
2021-03-13 15:53:13
231
用netsh实现端口转发
2019-01-21
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人