Exemplo n.º 1
0
        private void checkSendToShortcut()
        {
            string sendToPath = Environment.GetFolderPath(Environment.SpecialFolder.SendTo);

            DirectoryInfo dir = new DirectoryInfo(sendToPath);

            FileInfo[] myFiles  = dir.GetFiles("*.lnk");
            bool       hasFound = false;

            foreach (FileInfo f in myFiles)
            {
                if (f.Name == "Sims 3 as Custom Content.lnk")
                {
                    hasFound = true;
                    MadScience.Shortcut link = new MadScience.Shortcut();
                    link.Load(f.FullName);
                    if (link.Path != Application.ExecutablePath)
                    {
                        hasFound = false;
                    }
                    break;
                }
            }

            if (hasFound == false)
            {
                if (File.Exists(Path.Combine(Application.StartupPath, "Sims 3 as Custom Content.lnk")))
                {
                    MadScience.Shortcut link = new MadScience.Shortcut(Path.Combine(Application.StartupPath, "Sims 3 as Custom Content.lnk"));
                    link.Path = Application.ExecutablePath;
                    link.Save(Path.Combine(sendToPath, "Sims 3 as Custom Content.lnk"));
                }
            }
        }
Exemplo n.º 2
0
        private void checkSendToShortcut()
        {
            string sendToPath = Environment.GetFolderPath(Environment.SpecialFolder.SendTo);

            DirectoryInfo dir = new DirectoryInfo(sendToPath);
            FileInfo[] myFiles = dir.GetFiles("*.lnk");
            bool hasFound = false;
            foreach (FileInfo f in myFiles)
            {
                if (f.Name == "Sims 3 as Custom Content.lnk")
                {
                    hasFound = true;
                    MadScience.Shortcut link = new MadScience.Shortcut();
                    link.Load(f.FullName);
                    if (link.Path != Application.ExecutablePath)
                    {
                        hasFound = false;
                    }
                    break;
                }
            }

            if (hasFound == false)
            {
                if (File.Exists(Path.Combine(Application.StartupPath, "Sims 3 as Custom Content.lnk")))
                {
                    MadScience.Shortcut link = new MadScience.Shortcut(Path.Combine(Application.StartupPath, "Sims 3 as Custom Content.lnk"));
                    link.Path = Application.ExecutablePath;
                    link.Save(Path.Combine(sendToPath, "Sims 3 as Custom Content.lnk"));
                }
            }
        }