---------------Set Registry Key--------------------------------
public static bool GenRegKey(string strKeyValue)
{
string strKeyName = "AK_ECDRKEY";
Microsoft.Win32.RegistryKey key;
if (!CheckRegKeyExistsOrNot(strKeyName))
{
try
{
key = Microsoft.Win32.Registry.CurrentUser.CreateSubKey(strKeyName);
key.SetValue(strKeyName, strKeyValue);
key.Close();
}
catch
{
return false;
}
}
return false;
}
-------------------Check Registry Key-----------------------------
public static bool CheckRegKeyExistsOrNot(string strKeyName)
{
Microsoft.Win32.RegistryKey key;
key = Microsoft.Win32.Registry.CurrentUser.OpenSubKey(strKeyName);
if (key == null)
{
return false;
}
else
{
key.Close();
return true;
}
}
-----------------Get Registry Key from system----------------
#region GetKey
private string GetKey()
{
string strKeyName = "AK_ECDRKEY";
Microsoft.Win32.RegistryKey key;
key = Microsoft.Win32.Registry.CurrentUser.OpenSubKey(strKeyName);
if (key == null)
{
return "";
}
else
{
string keyVal = key.GetValue("AK_ECDRKEY").ToString();
key.Close();
return keyVal;
}
}
#endregion
--------------------GEt MAC Address----------------------
public string GetMACAddress()
{
NetworkInterface[] nics = NetworkInterface.GetAllNetworkInterfaces();
String sMacAddress = string.Empty;
foreach (NetworkInterface adapter in nics)
{
if (sMacAddress == String.Empty)
{
IPInterfaceProperties properties = adapter.GetIPProperties();
sMacAddress = adapter.GetPhysicalAddress().ToString();
}
} return sMacAddress;
}
Subscribe to:
Post Comments (Atom)
What is AI? Artificial Intelligence (AI) is the ability of machines or computer systems to perform tasks that normally require human intell...
-
If you are new to AJAX, Please refer to my Simple AJAX Example to understand how simple to start with AJAX. Step 1: Add Script Manage...
-
What is .NET 3.0? In one simple equation .NET 3.0 = .NET 2.0 + Windows Communication Foundation + Windows Presentation Foundation +...
-
For Web Application using System.Runtime.InteropServices; [DllImport("Iphlpapi.dll")] private static extern int SendARP(...
No comments:
Post a Comment