public void SetData(ShortcutInfo other) { Url = other.Url; Hotkey = other.Hotkey; Name = other.Name; isCmd = other.isCmd; }
public void AddShortcutFolder() { SHDocVw.ShellWindows shellWindows = new SHDocVw.ShellWindowsClass(); string filename = ""; foreach (SHDocVw.InternetExplorer ie in shellWindows) { if (ie.LocationURL != "") { filename = ie.LocationURL; } } if (shellWindows.Count > 0) { int n = filename.Length; if (n > 0) { filename = filename.Replace("file:///", ""); filename = filename.Replace("%20", " "); filename = filename.Replace("%26", "&"); } else { filename = ""; } } ShortcutInfo inf = new ShortcutInfo(); inf.Url = filename; while (!ShortcutAskingProcess(ref inf)) { ; } }
public void AddWeblink() { SHDocVw.ShellWindows shellWindows = new SHDocVw.ShellWindowsClass(); string filename = "www."; foreach (SHDocVw.InternetExplorer ie in shellWindows) { filename = ie.LocationURL; break; } int n = filename.IndexOf("file:///"); if (n == 0) { filename = "www."; } ShortcutInfo inf = new ShortcutInfo(); if (AskShortCutInfo(ref inf, "Enter new weblink", m_lWeblink, true)) { m_lWeblink.Add(inf); SortShortcutInfo(m_lWeblink); UpdateScriptWeblink(); TransferProfileInCurrentScript(); } }
private void ReadScriptData(string filename, List <ShortcutInfo> l) { string line = null; string name = this.PathData + filename; if (System.IO.File.Exists(name)) { System.IO.TextReader readFile = new StreamReader(name); while (true) { ShortcutInfo inf = new ShortcutInfo(); line = readFile.ReadLine(); if (line != null && line != "") { int nBeg = 0, nEnd = 0, len = 0; nEnd = line.IndexOf(";", nBeg); len = nEnd - nBeg; inf.Hotkey = line.Substring(nBeg, len); nBeg = nEnd; ++nBeg; nEnd = line.IndexOf(";", nBeg); len = nEnd - nBeg; inf.Name = line.Substring(nBeg, len); nBeg = nEnd; ++nBeg; inf.Url = line.Substring(nBeg); l.Add(inf); } else { break; } } readFile.Close(); readFile = null; } }
private bool ShortcutAskingProcess(ref ShortcutInfo inf) { bool r = true; if (AskShortCutInfo(ref inf, "Enter new shortcut", m_lShortcut, false)) { if (System.IO.Directory.Exists(inf.Url) || System.IO.File.Exists(inf.Url)) { m_lShortcut.Add(inf); SortShortcutInfo(m_lShortcut); UpdateScriptShortcut(); TransferProfileInCurrentScript(); r = true; } else { System.Windows.Forms.MessageBox.Show("this shortcut doesn't exist"); r = false; } } return(r); }
public bool AskShortCutInfo(ref ShortcutInfo inf, string sQuestion, List <ShortcutInfo> lst, bool web) { forms.hkForm f = new PeonLib.forms.hkForm(inf.Url, sQuestion, web); foreach (ShortcutInfo o in lst) { f.RemoveHotkeyChoice(o.Hotkey); } f.infHotkey = inf.Hotkey; f.infUrl = inf.Url; f.infName = inf.Name; f.ShowDialog(); if (f.DialogResult == DialogResult.OK) { inf.Hotkey = f.infHotkey; inf.Url = f.infUrl; inf.Name = f.infName; return(true); } return(false); }