البته راههای دیگه ای هم هست
مثلا بیایی و تریخ رو بصورت رمزنگاری توی رجستری ذخیره کنی اونوقت اگه کاربر از روش ما اگاه بشه ساعتشو میکشه عقب اما لان ویندوزهای جدید مخصوصا 10 یه لحظه حواسش نباشه سیستم ساعت رو از time میگیره و بروز میکنه خواستی اینم سمپل مورد نظره
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Security.Cryptography;
namespace CreateTrailWinApp
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
try
{
CreateTrailfunctionality();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
private void CreateTrailfunctionality()
{
try
{
Microsoft.Win32.RegistryKey EncryptedKey;
RSACryptoServiceProvider crypto = new RSACryptoServiceProvider();
EncryptedKey = Microsoft.Win32.Registry.CurrentUser.CreateSubKey(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\EncryptedDate");
object value = EncryptedKey.GetValue("EncryptedDate");
if (value == null)
{
EncryptedKey = Microsoft.Win32.Registry.CurrentUser.CreateSubKey(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\EncryptedDate");
string keyvalue = DateTime.Now.ToString("dd-MMM-yyyy");
byte[] messageBytes = Encoding.Unicode.GetBytes(keyvalue);
string encryptedMessage = Convert.ToBase64String(messageBytes);
EncryptedKey.SetValue("EncryptedDate", encryptedMessage);
}
else
{
byte[] encryptedMessage1 = Convert.FromBase64String(value.ToString());
string key = System.Text.Encoding.Unicode.GetString(encryptedMessage1);
DateTime date = Convert.ToDateTime(key);
MessageBox.Show(date.ToString("dd-MMM-yyyy"));
}
}
catch (Exception e)
{ }
}
}
}
توسط
Dany
(7,164 امتیاز)
●4 ●7 ●141