REC
首页
网站建设
Typecho插件
Typecho教程
Wordpress插件
Wordpress教程
美食分享
素食主义
蛋白肉食
美味汤食
文章分类
游戏更新
文笔记录
学习一角
文章分享
新闻早报
动漫分享
程序软件
其他页面
网站统计
友情链接
关于博主
热门文章
一键将网页打包成很小的桌面 App,30.1K Star,更小,更轻量
基于国外服务器搭建自己的VPN详细教程
浪漫庄园公告自动发布
typecho joe主题优化日志
账号综合管理工具更新记录
标签搜索
教程
代码
桌面软件
linux
游戏工具
优化
工具破解
Typecho
博客博客
Typecho插件
美食
下厨房
牛奶咖啡
C#
NETcore8.0
游戏资料
二建
法规
笔记
2025
发布
登录
注册
找到
11
篇与
文笔记录
相关的结果
- 第 2 页
2024-09-19
C#免注册调用大漠插件
前言 免注册调用大漠插件,实际上是使用 dmreg.dll 来配合实现,这个文件有 2 个导出接口 SetDllPathW 和 SetDllPathA。 SetDllPathW 对应 unicode,SetDllPathA 对应 ascii 接口。 一、下载大漠插件 下载地址 大漠插件 解压完成后,如下图所示: 大漠插件图片 二、生成大漠类库 打开 大漠类库生成工具 文件夹,如下图所示: 大漠插件图片 打开 大漠类库生成工具 v28.0.exe 文件,如下图所示: 大漠插件图片 将 dm\7.2434\dm.dll 拖到 大漠类库生成工具 里面,如下图所示: 大漠插件图片 类名选择使用自定义类名,指定类名输入 DmSoftCustomClassName(这里只是示例,你可以输入你喜欢的名字,如:abcde、aabbc、abab 等),如下图所示: 大漠插件图片 点击生成按钮,如下图所示: 大漠插件图片 打开 \7.2434\Output\C# 文件夹,可以看到生成的结果,如下图所示: 大漠插件图片 生成的 obj.cs 即是使用在 C# 平台下的类库封装,稍后在 C# 免注册调用大漠插件的示例中会用到。 三、创建控制台应用程序 注意:我这里创建的是 .NET Core 8.0 的窗口应用程序,你也可以创建你喜欢的。 3.1 引入大漠插件 dll 在项目中创建 libs 文件夹,用于放置大漠插件的 dll,如下图所示: 大漠插件图片 dm.dll 在 \7.2434 文件夹下,如下图所示: 大漠插件图片 DmReg.dll 在 免注册\不注册调用dm.dll的方法 v15.0 文件夹下,如下图所示: 大漠插件图片 设置 dll 属性 复制到输出目录 为 始终复制: 在 dm.dll 上单击鼠标右键,选择 属性; 在属性面板中,“复制到输出目录”选项,选择“始终复制”; 在 DmReg.dll 也重复上面的操作。 大漠插件图片 3.2 引入大漠类库 在项目中创建 DmSoft 文件夹,用于放置大漠类库。 将之前生成的大漠类库(obj.cs)复制到项目中的 DmSoft 文件夹,并改名为 DmSoftCustomClassName(可以改名,也可以不改名,还可以改成任意名,你喜欢就好……),如下图所示: 大漠插件图片 3.3 创建 Resources 文件夹 在项目中创建 Resources 文件夹,用于放置大漠插件使用到的资源,比如图片、字库等,如下图所示: 大漠插件图片 3.4 创建大漠插件配置类 在项目中创建 Configs 文件夹,并在 Configs 中创建 DmConfig 类,用于设置大漠插件用到的常量。 DmConfig.cs namespace DmSoftTestConsoleApp.Configs { /// <summary> /// 大漠插件配置 /// </summary> public class DmConfig { /// <summary> /// 大漠插件免注册 DmReg.dll 路径 /// </summary> public const string DmRegDllPath = @"./libs/DmReg.dll"; /// <summary> /// 大漠插件 dm.dll 路径 /// </summary> public const string DmClassDllPath = @"./libs/dm.dll"; /// <summary> /// 大漠插件注册码 /// </summary> public const string DmRegCode = ""; /// <summary> /// 大漠插件版本附加信息 /// </summary> public const string DmVerInfo = ""; /// <summary> /// 大漠插件全局路径,设置了此路径后,所有接口调用中,相关的文件都相对于此路径. 比如图片,字库等. /// </summary> public const string DmGlobalPath = @"./Resources"; } }3.5 创建 C# 免注册调用大漠插件类 namespace DmSoftTestConsoleApp.Configs { /// <summary> /// 大漠插件配置 /// </summary> public class DmConfig { /// <summary> /// 大漠插件免注册 DmReg.dll 路径 /// </summary> public const string DmRegDllPath = @"./libs/DmReg.dll"; /// <summary> /// 大漠插件 dm.dll 路径 /// </summary> public const string DmClassDllPath = @"./libs/dm.dll"; /// <summary> /// 大漠插件注册码 /// </summary> public const string DmRegCode = ""; /// <summary> /// 大漠插件版本附加信息 /// </summary> public const string DmVerInfo = ""; /// <summary> /// 大漠插件全局路径,设置了此路径后,所有接口调用中,相关的文件都相对于此路径. 比如图片,字库等. /// </summary> public const string DmGlobalPath = @"./Resources"; } }在 DmSoft 文件夹创建 RegisterDmSoft 类,用于实现 C# 免注册调用大漠插件。 RegisterDmSoft.cs using System.Runtime.InteropServices; using DmSoftTestConsoleApp.Configs; namespace DmSoftTestConsoleApp.DmSoft { /// <summary> /// 免注册调用大漠插件 /// </summary> public static class RegisterDmSoft { // 不注册调用大漠插件,实际上是使用 dmreg.dll 来配合实现,这个文件有 2 个导出接口 SetDllPathW 和 SetDllPathA。 SetDllPathW 对应 unicode,SetDllPathA 对应 ascii 接口。 [DllImport(DmConfig.DmRegDllPath)] private static extern int SetDllPathA(string path, int mode); /// <summary> /// 免注册调用大漠插件 /// </summary> /// <returns></returns> public static bool RegisterDmSoftDll() { var setDllPathResult = SetDllPathA(DmConfig.DmClassDllPath, 1); if (setDllPathResult == 0) { // 加载 dm.dll 失败 return false; } return true; } } }注意,在 .NET Core 中,无法使用 64 位进程加载 32 位 dll。解决方法是将程序设置为 32 位的。 大漠插件图片 四、测试 4.1 测试 C# 免注册调用大漠插件 在 Program 类中编写测试代码。 Program.cs using System; using DmSoftTestConsoleApp.DmSoft; namespace DmSoftTestConsoleApp { class Program { static void Main(string[] args) { if (Environment.Is64BitProcess) { Console.WriteLine("这是 64 位程序"); Console.WriteLine("按任意键结束程序"); Console.ReadKey(); return; } // 免注册调用大漠插件 var registerDmSoftDllResult = RegisterDmSoft.RegisterDmSoftDll(); Console.WriteLine($"免注册调用大漠插件返回:{registerDmSoftDllResult}"); Console.WriteLine("按任意键结束程序"); Console.ReadKey(); } } }4.2 测试 Capture 方法 修改 Program 类。 Program.cs using System; using System.IO; using DmSoftTestConsoleApp.Configs; using DmSoftTestConsoleApp.DmSoft; namespace DmSoftTestConsoleApp { class Program { static void Main(string[] args) { if (Environment.Is64BitProcess) { Console.WriteLine("这是 64 位程序"); Console.WriteLine("按任意键结束程序"); Console.ReadKey(); return; } // 免注册调用大漠插件 var registerDmSoftDllResult = RegisterDmSoft.RegisterDmSoftDll(); Console.WriteLine($"免注册调用大漠插件返回:{registerDmSoftDllResult}"); if (!registerDmSoftDllResult) { throw new Exception("免注册调用大漠插件失败"); } // 创建对象 DmSoftCustomClassName dmSoft = new DmSoftCustomClassName(); // 收费注册 var regResult = dmSoft.Reg(DmConfig.DmRegCode, DmConfig.DmVerInfo); Console.WriteLine($"收费注册返回:{regResult}"); if (regResult != 1) { throw new Exception("收费注册失败"); } // 判断 Resources 是否存在,不存在就创建 if (!Directory.Exists(DmConfig.DmGlobalPath)) { Directory.CreateDirectory(DmConfig.DmGlobalPath); } // 设置全局路径,设置了此路径后,所有接口调用中,相关的文件都相对于此路径. 比如图片,字库等 dmSoft.SetPath(DmConfig.DmGlobalPath); // 抓取指定区域(x1, y1, x2, y2)的图像,保存为file(24位位图) var captureResult = dmSoft.Capture(0, 0, 2000, 2000, "screen.bmp"); Console.WriteLine($"Capture 返回:{captureResult}"); if (captureResult != 1) { throw new Exception("Capture 失败"); } Console.WriteLine("按任意键结束程序"); Console.ReadKey(); } } }运行程序,dmSoft.Reg() 方法返回 -2(进程没有以管理员方式运行)。 五、在 VS 中设置程序以管理员身份运行 添加应用程序清单文件到项目中(项目 → 右键 → 添加 → 新建项 → 应用程序清单文件),如下图所示: 大漠插件图片 打开 app.manifest 文件,将 requestedExecutionLevel 元素的 level 属性设置为 highestAvailable。 也就是将 <requestedExecutionLevel level="asInvoker" uiAccess="false" />改为 <requestedExecutionLevel level="highestAvailable" uiAccess="false" />按 F5 运行程序,VS 将提示“此任务要求应用程序具有提升的权限。”,点击“使用其他凭据重新启动(R)”,如下图所示: 大漠插件图片 VS 重新启动之后,按 F5 运行程序,screen.bmp 图片保存到 Resources 文件夹中。 六、源码地址 源码地址:https://github.com/astrid9527... 七、总结 本文已经完整地介绍了如何使用 C# 免注册调用大漠插件的方法,解决方案的结构如下图所示: 大漠插件图片 需要注意的地方有如下几点 在 .NET Core 中 LoadLibrary 无法使用 64 位进程加载 32 位 dll。解决方法是将程序设置为 32 位的。 dm.dll 和 DmReg.dll 需要设置为始终复制到输出目录。 注意检查 SetPath(path) 方法中的 path 是否存在,不存在就创建。 在 VS 中设置程序以管理员身份运行。
代码心得
潼语
1年前
0
16
0
2024-09-13
浪漫括号工具更新开发记录
前言 本工具为游戏浪漫庄园30级自动括号脚本工具,解放双手,节省时间,让括号不再变得枯燥无味. 声明 软件指为方便自己游戏,无任何商业行为. 效果图 浪漫括号图片 开发进程 19be6b 19be6b ed4014 结论总结 疑难杂症 脚本运行后无法正确的进入游戏,是否与脚本未写完有关? 脚本运行后无法准确运行填入预运行游戏个数,如何解决? 窗口绑定失败是什么原因造成的? 解决方案 软件特色 软件使用大漠插件最新收费版,速度更快更安全 脚本开发软件为TC综合开发工具 脚本更加直观,与普通软件一样,方便使用 软件下载
自制工具
潼语
1年前
0
11
0
2024-09-03
账号综合管理工具更新记录
前言 本工具为仿制工具,已完成大部分界面的设计,功能正在慢慢完善中... 声明 本软件仿制只为自己游戏方便使用,无任何商业行为,如有侵权请及时与站长联系.效果图 效果图图片 开发进程 19be6b 19be6b 19be6b 19be6b 19be6b 19be6b ed4014 软件下载
自制工具
潼语
1年前
0
27
0
2024-08-21
浪漫庄园公告自动发布
前言 当前脚本使用的开发语言是Python,功能是通过脚本的运行获取浪漫庄园每次游戏更新后的更新内容,并且通过钉钉api将内容实时发送到钉钉群内。 教程 第一步 在代码开头将编码设置为“gbk” # -*- coding: gbk -*-设置这一步是防止后续出现乱码的问题 第二步 需要添加相关的扩展 from sqlite3 import Timestamp import requests import chardet from bs4 import BeautifulSoup from datetime import datetime import mysql.connector import re其中需要安装的有:requests、bs4、mysql 第三步 数据库配置 # MySQL数据库配置 db_config = { 'user': 'user', //数据库用户名 'password': 'password', //数据库密码 'host': 'ip', //数据库IP地址 'database': 'database', //数据库名 'raise_on_warnings': True # 要保存的表名 table_name = 'huancun' //将“huancun”换成自己数据库中定义的表名 } 第四步 获取网页中需要的内容 def format_current_date(): # 获取当前日期 now = datetime.now() # 提取年份的后两位 year_last_two = str(now.year)[-2:] # 提取月份和日期的两位数字 month_two = str(now.month).zfill(2) # zfill确保总是两位数字 day_two = str(now.day).zfill(2) # 同上 # 组合成字符串并加上01 formatted_date = year_last_two + month_two + day_two + '01' return formatted_date def get_webpage_text_content(url_template): try: # 假设URL模板是 http://rc.leeuu.com/data/news/{date}.htm formatted_date = format_current_date() url = url_template.format(date=formatted_date) #url = url_template.format(date='24062601') response = requests.get(url) # 尝试检测编码(如果响应内容不是UTF-8) raw_data = response.content if not response.encoding.lower() == 'utf-8': result = chardet.detect(raw_data) encoding = result['encoding'] content = raw_data.decode(encoding, errors='ignore') # 使用检测到的编码解码 else: content = response.text # 如果已经是UTF-8,则直接使用text # 确保请求成功 if response.status_code == 200: # 使用BeautifulSoup解析HTML soup = BeautifulSoup(content, 'html.parser') # 提取所有文本内容(包括段落、标题等) text_content1 = soup.get_text(strip=True, separator='\n') # strip=True 去除多余空白,separator='\n' 以换行符分隔文本块 text_content = re.sub(r'(搜索.*\n复制.*)', '', text_content1, flags=re.DOTALL | re.MULTILINE) return text_content else: return f"Failed to retrieve the webpage. Status code: {response.status_code}" #报告网页错误 except requests.RequestException as e: return f"Oops: Something Error {e}" except UnicodeDecodeError as e: return f"Error decoding the webpage: {e}" 第五步 # 发送钉钉文本消息的函数 def send_dingtalk_text_message(content, webhook_url): headers = { 'Content-Type': 'application/json', 'Charset': 'UTF-8', } message = { "msgtype": "text", "text": { "content": content } } try: response = requests.post(webhook_url, json=message, headers=headers) response.raise_for_status() # 如果请求失败,抛出HTTPError异常 print("DingTalk text message sent successfully.") except requests.RequestException as e: print(f"Error sending DingTalk text message: {e}") #send_dingtalk_text_message("今日暂无更新", DINGTALK_WEBHOOK_URL) # 钉钉Webhook的URL DINGTALK_WEBHOOK_URL = 'https://oapi.dingtalk.com/robot/send?access_token=XXXX' //将XXXX替换为自己钉钉群内自定义机器人中的数据 # 使用URL模板 url_template = "http://rc.leeuu.com/data/news/{date}.htm" content = get_webpage_text_content(url_template)第六步 连接数据库并且添加获取到的内容进数据库,同时向钉钉群内发送消息 # 假设这是你从某个数据源获取的新内容及其相关信息 if "404" in content: new_content = "今日无更新内容。" else: new_content = content new_key_value = format_current_date() timestamp = datetime.now().strftime('%Y-%m-%d %H:%M:%S') # 获取当前时间戳 # 连接到MySQL数据库 cnx = mysql.connector.connect(**db_config) cursor = cnx.cursor() # 定义表名和字段 table_name = "huancun" key_field = 'key' # 替换为你的唯一键字段名 content_field = 'content' # 内容字段名 timestamp_field = 'timestamp' # 时间戳字段名 # 执行查询 query = f"SELECT {content_field} FROM {table_name} WHERE `{key_field}` = %s" cursor.execute(query, (new_key_value,)) # 使用参数化查询来防止SQL注入 # 获取查询结果 result = cursor.fetchone() # 因为是根据主键查询,所以预期只返回一个结果 # 检查 result 是否存在 if result: content1 = result[0] if content1 == new_content: print("当前数据未更新!") else: # 使用 f-string 构建 SQL 查询 insert_query = f""" INSERT INTO `{table_name}` (`{key_field}`, `{content_field}`, `{timestamp_field}`) VALUES (%s, %s, %s) ON DUPLICATE KEY UPDATE `{content_field}` = VALUES({content_field}), `{timestamp_field}` = VALUES({timestamp_field}) """ try: cursor.execute(insert_query, (new_key_value, new_content, timestamp)) cnx.commit() print("新内容已保存到数据库,或已存在的记录已更新。") if "404" not in new_content: send_dingtalk_text_message(new_content, DINGTALK_WEBHOOK_URL) except Exception as e: print(f"发生错误:{e}") else: # 如果没有找到记录,直接插入新数据 insert_query = f""" INSERT INTO `{table_name}` (`{key_field}`, `{content_field}`, `{timestamp_field}`) VALUES (%s, %s, %s) ON DUPLICATE KEY UPDATE `{content_field}` = VALUES({content_field}), `{timestamp_field}` = VALUES({timestamp_field}) """ try: cursor.execute(insert_query, (new_key_value, new_content, timestamp)) cnx.commit() print("新内容已保存到数据库,或已存在的记录已更新。") if "404" not in new_content: send_dingtalk_text_message(new_content, DINGTALK_WEBHOOK_URL) except Exception as e: print(f"发生错误:{e}") # 关闭游标和连接 cursor.close() cnx.close()代码到此完毕,后续根据实际情况会进行优化删减,使代码运行更加方便 第七步 最后一步将文件上传到服务器上,添加定时任务中的shell脚本填写以下代码: sudo -u root bash -c '#!/bin/bash . /etc/profile . ~/.bash_profile /usr/bin/XX /XXX/XXX/浪漫庄园公告.py'
代码心得
潼语
1年前
0
36
0
2024-08-20
牛奶咖啡更新日志
前言 本工具使用C#搭载NET Croe 8.0框架编译而成,软件功能单一更多功能慢慢开发中,仅供自己娱乐使用版本说明 从1.43.3.1版本开始将不按照顺序填写版本号,以此版本为例:1表示大版本号;43表示今年的第几周;3表示当周的第几天更新的;最后的1表示小版本号效果图 效果图图片 更新历程 {collapse-item label="详细更新说明" close} 19be6b 19be6b 19be6b 19be6b 19be6b 19be6b 19be6b 19be6b 19be6b 19be6b 19be6b 19be6b 19be6b 19be6b 19be6b 19be6b 19be6b 19be6b 19be6b 19be6b 19be6b 19be6b 19be6b 19be6b 19be6b 19be6b 19be6b 19be6b 19be6b 19be6b 19be6b 19be6b 19be6b 19be6b 19be6b 19be6b 19be6b 19be6b 19be6b 19be6b 19be6b 19be6b 19be6b 19be6b 19be6b 19be6b 19be6b 19be6b 19be6b 19be6b 19be6b 19be6b 19be6b 19be6b 19be6b 19be6b 19be6b 19be6b 19be6b 19be6b 19be6b 19be6b 19be6b 19be6b 19be6b ed4014 {/collapse-item} 下载地址 目前仅供个人使用,暂未开发开放版本!!!
牛奶咖啡日志
# 代码
# 游戏工具
# 牛奶咖啡
# C#
# NETcore8.0
潼语
1年前
0
32
1
上一页
1
2
3
下一页