コード例 #1
0
        private void btTest_Click(object sender, EventArgs e)
        {
            if (listBoxMain.SelectedIndex != -1)
            {
                LinkType test = new LinkType();
                test = (LinkType)listBoxMain.SelectedItem;
                Process.Start(test.Target,test.Arguments);

            }
        }
コード例 #2
0
        private void btEdit_Click(object sender, EventArgs e)
        {
            if (listBoxMain.SelectedIndex != -1)
            {
                LinkType test = new LinkType();
                test = (LinkType)listBoxMain.SelectedItem;

                FormEditLink myEdit = new FormEditLink();
                myEdit.Edit = test;
                myEdit.ShowDialog();

                ListBoxMainRefresh();
            }
        }
コード例 #3
0
 public int ParseDelayTime(LinkType Input)
 {
     //{ "60" "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe"}
     int Start = Input.Arguments.IndexOf("\"") + 1 ;
     int end = Input.Arguments.IndexOf("\"",Start + 1);
     int lenght = end - Start;
     string time = Input.Arguments.Substring(Start, lenght);
     return Convert.ToInt32(time);
 }
コード例 #4
0
 public string ParseAppName(LinkType Input)
 {
     int Start = Input.Arguments.LastIndexOf("\\") + 1;
     int end = Input.Arguments.LastIndexOf(".");
     int lenght = end - Start;
     return Input.Arguments.Substring(Start, lenght);
 }
コード例 #5
0
 public string ParseAppLocaion(LinkType Input)
 {
     int End = Input.Arguments.LastIndexOf("\"");
     int Start = Input.Arguments.LastIndexOf("\"", End - 1) + 1;
     int lenght = End - Start;
     return Input.Arguments.Substring(Start,lenght);
 }
コード例 #6
0
        public List<LinkType> LoadLinksFromStartup()
        {
            DirectoryInfo di = new DirectoryInfo(GetStartupPath());
            FileInfo[] files = di.GetFiles("*DelayStartup.lnk");
            List<LinkType> listOfLinks = new List<LinkType>();

            foreach (FileInfo fi in files) {
                //parse link into string
                string pathOnly = Path.GetDirectoryName(fi.FullName);
                string filenameOnly = Path.GetFileName(fi.FullName);

                Shell32.Shell shell = new Shell32.ShellClass();
                Shell32.Folder folder = shell.NameSpace(pathOnly);
                Shell32.FolderItem folderItem = folder.ParseName(filenameOnly);

                if (folderItem != null)
                {
                    Shell32.ShellLinkObject link = (Shell32.ShellLinkObject)folderItem.GetLink;
                    LinkType a = new LinkType(link,fi);
                    listOfLinks.Add(a);
                }
            }
            return listOfLinks;
        }
コード例 #7
0
 public void EditLink(LinkType EditLink)
 {
     //Delete
     DeleteLink(EditLink);
     //Create
     CreatLink(ParseAppName(EditLink), ParseDelayTime(EditLink), ParseAppLocaion(EditLink));
 }
コード例 #8
0
 public void DeleteLink(LinkType DeleteMe)
 {
     try
     {
         System.IO.File.Delete(DeleteMe.LinkFullName);
     }
     catch
     { }
 }