冠蓝 发布的文章

打开注册表编辑器,分别打开

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server\Wds\rdpwd\Tds\tcp
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp

找到PortNumber字段进行修改,若开启了防火墙还需要修改防火墙放行新端口,完成后重启。

项目地址:https://github.com/fatedier/frp/releases

分别下载服务端和客户端系统对应的二进制包解压,包里的frps是服务器端,frpc是客户端。

首先编辑服务端配置文件frps.ini

[common]
bind_port = 7000 # 服务器端监听端口,可以自己指定,注意放通安全组和防火墙
token = *** # 密钥,服务端和客户端需要匹配才能连接,也可以删掉不要

然后把frps和编辑后的frps.ini上传服务器,执行时需要传入参数文件,我上传到的是/root目录,命令如下:

./frps -c ~/frps.ini

- 阅读剩余部分 -

使用Powershell执行

Get-PhysicalDisk

查看硬盘的CanPool状态,如果是False则会出现此错误。

使用Powershell执行

Get-PhysicalDisk -SerialNumber 磁盘序列号 | Reset-PhysicalDisk

重置硬盘状态即可,磁盘序列号即为执行Get-PhysicalDisk后显示的SerialNumber字段。

创建一个.bat或者.cmd的批处理文件,写入以下内容:

@echo off
pushd "%~dp0"
dir /b C:\Windows\servicing\Packages\Microsoft-Windows-GroupPolicy-ClientExtensions-Package~3*.mum >List.txt
dir /b C:\Windows\servicing\Packages\Microsoft-Windows-GroupPolicy-ClientTools-Package~3*.mum >>List.txt
for /f %%i in ('findstr /i . List.txt 2^>nul') do dism /online /norestart /add-package:"C:\Windows\servicing\Packages\%%i"
pause

保存右击以管理员身份运行即可

打开Github Release · code-server 下载可以执行文件的压缩包或安装文件 ,或打开官网 Install - code-server 使用脚本安装。

可执行文件的压缩包解压到/bin/code-server下,进入目录执行./code-server,安装文件安装的直接执行code-server即可运行起来。

微信截图_20220315164223.png

配置文件在~/.config/code-server/config.yaml,里面可以设置端口和密码;
运行起来后访问IP:端口,输入配置文件里面的密码即可打开,本地安装默认打开127.0.0.1:8080即可看到效果。

- 阅读剩余部分 -

package.json

{
    "name": "",
    "version": "1.0.0",
    "description": "",
    "author": "",
    "main": "main.js",
    "scripts": {
        "start": "electron ."
    },
    "repository": "",
    "keywords": [],
    "license": "",
    "devDependencies": {
        "electron": "^17.0.1",
        "electron-builder": "^22.14.13"
    },
    "build": {
        "productName": "",
        "appId": "",
        "copyright": "",
        "compression": "maximum",
        "directories": {
            "output": "build"
        },
        "asar": false,
        "win": {
            "icon": "logo/256.ico",
            "artifactName": "${productName}_setup_${version}.${ext}"
        },
        "mac": {
            "icon": "logo/512.png",
            "artifactName": "${productName}_setup_${version}.${ext}"
        },
        "linux": {
            "icon": "logo/256.ico",
            "artifactName": "${productName}_setup_${version}.${ext}"
        },
        "nsis": {
            "oneClick": false,
            "perMachine": true,
            "allowElevation": true,
            "allowToChangeInstallationDirectory": true,
            "installerIcon": "logo/256.ico",
            "uninstallerIcon": "logo/256.ico",
            "installerHeaderIcon": "logo/256.ico",
            "createDesktopShortcut": true,
            "createStartMenuShortcut": true,
            "shortcutName": ""
        }
    }
}

全局安装 electron-builder

npm install electron-builder -g

打包程序

electron-builder --ia32
# ia32 / x64

读取到的文件默认是根据修改时间排序的,如果要根据文件名排序可以使用

fileInfos.OrderBy(f => f.Name);

得到的顺序为:1、10、2、3 ... 9,使用以下方法即可解决

DirectoryInfo directoryInfo=new DirectoryInfo(folderPath);
FileInfo[] fileInfos= directoryInfo.GetFiles();

List<string> files=new List<string>();
Array.Sort(fileInfos, (x1, x2) => int.Parse(Regex.Match(x1.Name, @"\d+").Value).CompareTo(int.Parse(Regex.Match(x2.Name, @"\d+").Value)));
foreach (FileInfo file in fileInfos)
{
    files.Add(file.FullName);
}

原文链接:https://www.jianshu.com/p/d69461e7cbd7