コード例 #1
0
        static Info()
        {
            System.IO.Directory.CreateDirectory(Directory);

            try
            {
                if (Autostart && GetAutostartPath(Name) != ExecutablePath)
                {
                    SetAutostartPath(Name, ExecutablePath);
                }
            }catch (Exception e)
            {
                CLIOutput.WriteLine("Failed to set autostart path: probably program doesn't have permissions to do that!", ConsoleColor.DarkYellow);
#if DEBUG
                CLIOutput.WriteLine(e.StackTrace);
#endif
            }
        }
コード例 #2
0
 private static void SetAutostartPath(string name, string path)
 {
     try
     {
         using (RegistryKey rk = Registry.CurrentUser.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Run", true))
         {
             if (path != null)
             {
                 rk.SetValue(name, path, RegistryValueKind.String);
             }
             else
             {
                 rk.DeleteValue(name);
             }
         }
     }catch (Exception)
     {
         CLIOutput.WriteLine("Failed to set autostart path: probably program doesn't have permissions to do that!", ConsoleColor.DarkYellow);
     }
 }
コード例 #3
0
 public void Log(string str, params object[] parameters)
 {
     CLIOutput.WriteLine("| " + str, ConsoleColor.Gray, parameters);
 }