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); } }
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(); } }
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); }
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); }
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); }
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; }
public void EditLink(LinkType EditLink) { //Delete DeleteLink(EditLink); //Create CreatLink(ParseAppName(EditLink), ParseDelayTime(EditLink), ParseAppLocaion(EditLink)); }
public void DeleteLink(LinkType DeleteMe) { try { System.IO.File.Delete(DeleteMe.LinkFullName); } catch { } }