思路:调用bat获取到C盘id,然后将id写入背景图的一个角落里的像素,再用一个像素记录修改次数,每次运行程序Awake对比到C盘id不一样,则改写并增加次数,改写次数大于10次直接推出程序,或者做其他小操作,等钱到账在去掉。
宗旨:拒绝白嫖怪,不做杨白劳
@echo off
echo select disk 0 >C:\Users\Administrator\Desktop\d1.txt
echo detail disk >>C:\Users\Administrator\Desktop\d1.txt
diskpart /s C:\Users\Administrator\Desktop\d1.txt|findstr "ID:" >C:\Users\Administrator\Desktop\e1.txt
del /q C:\Users\Administrator\Desktop\d1.txt
::不能在同一个文本里直接操作,需分开两个
exit
注:
1.@echo off 表示隐藏cmd窗口。
2.echo 字符串 >文本路径 表示将字符串覆盖全文写在文本里;
echo 字符串 >>文本路径 表示将字符串换行添加写在文本里。
3.cmd里可以一句一句输入,但是bat里需要diskpart调用中间文本里的另外两句命令。
4.del /q 文本路径 表示删除文本
5.双冒号表示注释
中间文本(3行):
“select disk 0
detail disk
”
输出文本(2行):
“磁盘 ID: C0F63564
”
------------------------------------------------------------------------------------------
@echo off
wmic CPU get ProcessorID> C:\Users\Administrator\Desktop\c1.txt
exit
注:输出文本为2行。
“ProcessorId ”,
“BFEBFBFF000906E9 ”
/// <summary>
/// 获取CPU序列号
/// </summary>
/// <returns></returns>
IEnumerator GetCPUId()
{
//#if !UNITY_EDITOR && UNITY_STANDALONE_WIN
string txtPath = @"C:/Users/Administrator/Desktop/temp.txt";
string batPath = @"C:/Users/Administrator/Desktop/temp.bat";
string resultPath = @"C:/Users/Administrator/Desktop/c1.txt";
if (File.Exists(txtPath)) { File.Delete(txtPath); }
if (File.Exists(batPath)) { File.Delete(batPath); }
if (File.Exists(resultPath)) { File.Delete(resultPath); }
File.WriteAllLines(txtPath, new string[]
{
@"@echo off",
@"wmic CPU get ProcessorID> C:\Users\Administrator\Desktop\c1.txt",
@"exit"
});
File.Move(txtPath, batPath);
Application.OpenURL(batPath);
yield return new WaitForSeconds(0.5f);//等待cmd输出结果到文本
cpuId = File.ReadAllLines(resultPath)[1].Trim();
Debug.Log("CPUId:" + cpuId);
}
-----------------------------------------
基操讲完,后面怎么将数据记录到程序的背景图(或其他程序不可缺的图)上面去,我就不多讲了,分享归分享,不能把自己的老底拿给人家看