Beispiel #1
0
 public static void Delete(LLApplication app)
 {
     // delete the item from it's location
     if (app.RegistryInfo != null)
     {
         var regKeys = new List <RegistryKey>()
         {
             RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry64),
             RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry32),
             RegistryKey.OpenBaseKey(RegistryHive.CurrentUser, RegistryView.Registry64),
             RegistryKey.OpenBaseKey(RegistryHive.CurrentUser, RegistryView.Registry32)
         };
         foreach (var regKey in regKeys)
         {
             var registeryKey = regKey.OpenSubKey(app.RegistryInfo.RegistryLocation, true);
             if (registeryKey != null)
             {
                 if (registeryKey.GetValueNames().Contains(app.RegistryInfo.RegistryKey))
                 {
                     registeryKey.DeleteValue(app.RegistryInfo.RegistryKey, false);
                 }
             }
         }
     }
     else if (app.FolderInfo != null)
     {
         File.Delete(app.FolderInfo.ShortcutFullPath);
     }
 }
Beispiel #2
0
 public static void Restore(LLApplication app)
 {
     if (app.IsImported)
     {
         if (app.RegistryInfo != null)
         {
             var regKeys = new List <RegistryKey>()
             {
                 RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Default),
                 RegistryKey.OpenBaseKey(RegistryHive.CurrentUser, RegistryView.Default)
             };
             foreach (var regKey in regKeys)
             {
                 if (regKey.Name == app.RegistryInfo.RegistryName)
                 {
                     var registeryKey = regKey.OpenSubKey(app.RegistryInfo.RegistryLocation, true);
                     if (registeryKey != null)
                     {
                         registeryKey.SetValue(app.RegistryInfo.RegistryKey, app.RegistryInfo.RegistryValue);
                     }
                 }
             }
         }
         else if (app.FolderInfo != null)
         {
             LLUtilities.CreateShortcut(Environment.GetFolderPath(Environment.SpecialFolder.Startup), app.FullPath, app.Arguments, app.Name);
         }
     }
     else
     {
         LLUtilities.CreateShortcut(Environment.GetFolderPath(Environment.SpecialFolder.Startup), app.FullPath, app.Arguments, app.Name);
     }
 }
Beispiel #3
0
 public LLApplication(LLApplication app)
 {
     Name         = app.Name;
     FullPath     = app.FullPath;
     DelaySeconds = app.DelaySeconds;
     Arguments    = app.Arguments;
     Enabled      = app.Enabled;
 }
Beispiel #4
0
        public LLAppTimer(LLApplication app)
        {
            if (app == null)
            {
                return;
            }

            Started = false;
            App     = app;

            AppTimer    = new Timer(new TimerCallback(callback), null, App.DelaySeconds * 1000, App.DelaySeconds * 1000);
            startedTime = DateTime.Now;
        }
Beispiel #5
0
        public LLApplication CreateApp()
        {
            LLApplication newApp = null;

            if (this is StartupRegistryItem)
            {
                var registryItem = this as StartupRegistryItem;
                newApp = new LLApplication {
                    Arguments = registryItem.Arguments, DelaySeconds = 0, FullPath = registryItem.FullPath, Name = registryItem.Name, Enabled = true
                };
                newApp.RegistryInfo = new StartupRegistryInformation(registryItem.RegistryName, registryItem.RegistryLocation, registryItem.RegistryKey, registryItem.RegistryValue);
            }
            else if (this is StartupFolderItem)
            {
                var folderItem = this as StartupFolderItem;
                newApp = new LLApplication {
                    Arguments = folderItem.Arguments, DelaySeconds = 0, FullPath = folderItem.FullPath, Name = folderItem.Name, Enabled = true
                };
                newApp.FolderInfo = new StartupFolderInformation(folderItem.ShortcutFullPath);
            }
            return(newApp);
        }