Пример #1
0
 public void Dispose(bool disposing)
 {
     if (link != null)
     {
         Marshal.ReleaseComObject(link);
         link = null;
     }
 }
Пример #2
0
 public static string GetTitle(Shortcut.IShellLink link)
 {
     try
     {
         var ps = (WindowProperties.IPropertyStore)link;
         using (var pv = new WindowProperties.PropVariant())
         {
             ps.GetValue(ref PKEY_Title, pv);
             return((string)pv.GetValue());
         }
     }
     catch (Exception e)
     {
         Util.Logging.Log(e);
     }
     return("");
 }
Пример #3
0
        private void startWithWindows_Checked(object sender, RoutedEventArgs e)
        {
            config.SetValue("User", "startWithWindows", "true");

            string startupShotcut = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Startup), "osu!profile.lnk");

            Console.WriteLine(startupShotcut);
            if (!File.Exists(startupShotcut))
            {
                Shortcut.IShellLink link = (Shortcut.IShellLink) new Shortcut.ShellLink();

                link.SetDescription("osu!profile");
                link.SetPath(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase);

                IPersistFile file = (IPersistFile)link;
                file.Save(startupShotcut, false);
            }
        }