累计: 0
r u s t d

rustdesk远程客户端配置源码

5.00

★14次@未来之窗

A:赛忞初雪

上架: 2025-10-09 01:12:32

rustdesk远程客户端配置源码

         收藏
 

四方仙域传送阵         

using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; namespace FairyAllianceDeskConfigWriter { internal class Program { static void Main(string[] args) { try { string customRendezvousServer = "远程服务器"; string key = "默认密钥"; string 登录服务 = "仙盟api服务器"; // 检查参数数量 if (args.Length < 3) { Console.WriteLine("使用方法: FairyAllianceDeskConfigWriter.exe [custom-rendezvous-server] [key] [API]"); Console.WriteLine("示例: FairyAllianceDeskConfigWriter.exe 未来之窗东方仙盟 '00='"); Console.WriteLine("按任意键退出..."); // Console.ReadKey(); // return; } else { // 获取命令行参数 customRendezvousServer = args[0]; key = args[1]; 登录服务=args[2]; Console.WriteLine($"使用的custom-rendezvous-server: {customRendezvousServer}"); Console.WriteLine($"使用的key: {key}"); } // 获取当前用户信息 string currentUser = Environment.UserName; Console.WriteLine($"当前用户: {currentUser}"); // 构建配置文件路径 string appDataPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData); string configDirectory = Path.Combine(appDataPath, "RustDesk", "config"); string configFilePath = Path.Combine(configDirectory, "RustDesk2.toml"); // Console.WriteLine($"配置文件路径: {configFilePath}"); // 创建目录(如果不存在) if (!Directory.Exists(configDirectory)) { Directory.CreateDirectory(configDirectory); Console.WriteLine("已创建配置目录"); } // 配置内容(使用参数替换对应值) string configContent = $@"rendezvous_server = '{customRendezvousServer}:21116' nat_type = 2 serial = 0 unlock_pin = '' trusted_devices = '' [options] local-ip-addr = '192.168.1.157' custom-rendezvous-server = '{customRendezvousServer}' api-server = '{登录服务}' key = '{key}' av1-test = 'N' direct-server = 'Y' relay-server = '{customRendezvousServer}' allow-websocket = 'Y'"; // 写入配置文件 File.WriteAllText(configFilePath, configContent); Console.WriteLine("配置文件已成功写入"); // Console.WriteLine($"使用的custom-rendezvous-server: {customRendezvousServer}"); // Console.WriteLine($"使用的key: {key}"); } catch (Exception ex) { Console.WriteLine($"发生错误: {ex.Message}"); Console.WriteLine("请确保您有足够的权限写入该目录"); } // 等待用户查看结果 Console.WriteLine("按任意键退出..."); Console.ReadKey(); } } }

硬件app