public static void SetAutoRun(string fileName, bool isAutoRun)
{
RegistryKey reg = null;
try
{
if (!(fileName))
throw new Exception("This file does not exist!");
String name = ((@"\") + 1);
reg = (@"SOFTWARE\Microsoft\Windows\CurrentVersion\Run", true);
if (reg == null)
reg = (@"SOFTWARE\Microsoft\Windows\CurrentVersion\Run");
if (isAutoRun)
(name, fileName);
else
(name, false);
}
catch (Exception ex)
{
throw new Exception(());
}
finally
{
if (reg != null)
();
}
{
RegistryKey reg = null;
try
{
if (!(fileName))
throw new Exception("This file does not exist!");
String name = ((@"\") + 1);
reg = (@"SOFTWARE\Microsoft\Windows\CurrentVersion\Run", true);
if (reg == null)
reg = (@"SOFTWARE\Microsoft\Windows\CurrentVersion\Run");
if (isAutoRun)
(name, fileName);
else
(name, false);
}
catch (Exception ex)
{
throw new Exception(());
}
finally
{
if (reg != null)
();
}