如何使用c#进行软件跟踪 [英] How to make trail of Software using c#

查看:130
本文介绍了如何使用c#进行软件跟踪的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用c#创建了一个应用程序并且需要在用户机器上应用跟踪仅30天如何检查它?

I have made an application with c# and need to apply trail on user machine only for 30days how can i check it??

推荐答案




i建议采取以下步骤。



- >在注册表中创建两个变量 - 安装日期,上次打开日期与不同的键。

- >在main函数中,

*如果安装的日期为空或为null,请写上cuurent日期

*也将最后打开的日期写入当前日期。

*如果安装不为空或空,请检查当前日期的30天。如果小于30(用户可能更改系统日期),则检查最后打开的日期。

*如果您发现,日期跨越30天,停止应用程序的所有功能并显示消息给用户。



你可以参考使用C#从注册表中读取,写入和删除 [ ^ ]获取更多信息。



你也可以参考使用试用版制作应用程序 [ ^ ]



希望它有所帮助。
Hi,

i suggest the below steps.

-> create two variables in registry - Installed Date, Last opened date with different keys.
-> In main function,
* if the installed date is empty or null, write the cuurent date
* also write the last opened date to current date.
* If installed is not null or empty, check for 30 days with current date. if it less than 30 (user may change system date), then check with last opened date.
* if you found, the date cross 30 days, stop all functionality of the application and show the message to user.

you can refer Read, write and delete from registry with C#[^] for more information.

you can also refer Make Your Application with Trial Version[^]

hope it helps.


如果您使用基于文件的解决方案建议由aspnet_regiis提供,然后在这里。我把它输入记事本,所以你可能需要调整它但它应该可以解决。



If your going with the file based solution suggested by aspnet_regiis then here is below. I typed it into notepad so you might have to tweak it but it should work out.

using System.IO;

DateTime fileDateCreated = File.GetCreationTime(@"C:\temp\your_trail_file.txt");
DateTime now = DateTime.Now;
TimeSpan span = now - fileDateCreated;
int totalDays = span.TotalDays;

if(totalDays > 30)
{
	//Delete Trail File or whatever logic you wish to perform
}


这篇关于如何使用c#进行软件跟踪的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆