C#程序限次如何解决请详细说明源代码

来源:百度知道 编辑:UC知道 时间:2024/06/14 10:50:58
我是菜鸟。
用C#写了一个Windows应用程序(winform)想加限次功能
如果是修改注册表会不会被杀毒软件拦截?
麻烦说详细些包括源代码和位置!
如果解决另外加20分!谢谢!
杀毒会拦截,但不是我自己用。我做出来是给别人用的。要求限次唉!
我正在研究注册表。又让我控制线程了。晕更不会了。高手请多指点一下

//我个程序是把次数写在文件中来控制次数
using System;
using System.IO;
class Test
{
int count;
static void Main()
{
Test t = new Test();
int nowCount = t.accountCount();
if (nowCount >= 4)
{
Console.WriteLine("该程序运行次数超过4次了!!");
return; // 在此直接退出!!
}
else
{
Console.WriteLine("该程序使用了{0}次了!", nowCount.ToString());
Console.WriteLine("你还可以继续使用!");
}
Console.ReadLine();
}
public int accountCount()
{
if (File.Exists("sw.txt"))
{
StreamReader SR = new StreamReader("sw.txt");
while (!SR.EndOfStream)
{
count = int.Parse(SR.ReadLine());
}
SR.Close();
}