private void frmExportShortcut_Load(object sender, EventArgs e) { foreach (string s in ShortcutUtil.GetShortcutGroupNames()) { cblGroups.Items.Add(s); } }
/// <summary> /// Exports Shortcuts in Group to selected folder /// </summary> /// <param name="GroupName"></param> /// <param name="Directory"></param> /// <param name="RemoveInvalid"></param> private void ExportGroup(string GroupName, string Directory, bool RemoveInvalid) { string directoryName = GroupName; foreach (char c in System.IO.Path.GetInvalidPathChars()) { directoryName = GroupName.Replace(c.ToString(), "_"); } while (System.IO.Directory.Exists(System.IO.Path.Combine(Directory, directoryName))) { directoryName = GroupName + "__" + DateTime.Now.Millisecond.ToString(); } string strShortcutFile = AppConfig.GetShortcutFile(GroupName); string SaveToDirectory = System.IO.Path.Combine(Directory, directoryName); if (!System.IO.Directory.Exists(SaveToDirectory)) { System.IO.Directory.CreateDirectory(SaveToDirectory); } List <ShortcutItem> files = ShortcutUtil.GetShortcuts(GroupName); if (files != null && files.Count > 0) { foreach (ShortcutItem item in files) { item.CreateDesktopShortcut(SaveToDirectory, RemoveInvalid); } } }
// ======================================== // method // ======================================== public Mkamo.Common.Command.ICommand GetUpdateCommand() { return(new DelegatingCommand( () => { _settings.EmptyTrashBoxOnExit = _emptyTrasBoxCheckBox.Checked; _windowSettings.ShowStartPageOnStart = _showStartPageOnStartCheckBox.Checked; // _settings.CheckLatestOnStart = _checkLatestOnStartCheckBox.Checked; _windowSettings.MinimizeToTaskTray = _minimizeToTaskTrayCheckBox.Checked; _windowSettings.MinimizeOnStartUp = _minimizeOnStartUpCheckBox.Checked; _windowSettings.ReplaceMeiryoWithMeiryoUI = _replaceMeiryoCheckBox.Checked; if (_isWinXP) { var shortcutPath = MemopadConsts.StartUpShortcutFilePath; if (_startOnWindowsStartUpCheckBox.Checked) { if (!File.Exists(shortcutPath) && !Directory.Exists(shortcutPath)) { ShortcutUtil.CreateShortcut(shortcutPath, Application.ExecutablePath); } } else { if (File.Exists(shortcutPath)) { File.Delete(shortcutPath); } } } } )); }
private void Profiles_ItemDrag(object sender, ItemDragEventArgs e) { String file = null; if (Profiles.SelectedItems[0].Group == Profiles.Groups[0]) { file = ShortcutUtil.Create(SpecialDirectories.Temp, GameUtils.UnifiedExe, Profiles.SelectedItems[0].Text, String.Empty, Profiles.SelectedItems[0].Text); } else { file = ShortcutUtil.Create(SpecialDirectories.Temp, Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "Sims3AnyGameStarter.exe"), Profiles.SelectedItems[0].Text, "\"" + Profiles.SelectedItems[0].Text + "\"", Profiles.SelectedItems[0].Text); } if (file == null) { return; } var data = new DataObject(DataFormats.UnicodeText, file); data.SetText(file); var str = new StringCollection(); str.Add(file); data.SetFileDropList(str); Profiles.DoDragDrop(data, DragDropEffects.Move); var fileInfo = new FileInfo(file); if (fileInfo.Exists) { fileInfo.Delete(); } }
private void frmSearch_Load(object sender, EventArgs e) { List <string> l = ShortcutUtil.GetShortcutGroupNames(); l.Insert(0, ""); ddlShortcutFile.DataSource = l; lvSearchResult.View = View.Tile; }
private void desktopShortcutItem_Click(object sender, EventArgs e) { if (Profiles.SelectedItems[0].Group == Profiles.Groups[0]) { ShortcutUtil.Create(Environment.SpecialFolder.Desktop, GameUtils.UnifiedExe, Profiles.SelectedItems[0].Text, String.Empty, Profiles.SelectedItems[0].Text); } else { ShortcutUtil.Create(Environment.SpecialFolder.Desktop, Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "Sims3AnyGameStarter.exe"), Profiles.SelectedItems[0].Text, "\"" + Profiles.SelectedItems[0].Text + "\"", Profiles.SelectedItems[0].Text); } }
private void PromptForShortcut() { var confirmResult = MessageBox.Show("Create sync icon on desktop?", "Desktop Icon", MessageBoxButtons.YesNo); if (confirmResult == DialogResult.Yes) { //Save Shortcut to Desktop ShortcutUtil.CreateShortcut(); MessageBox.Show("Shortcut saved to desktop - it is recommended you pin it to the taskbar"); } }
internal void Build(ShortcutSettings sSettings) { // variables setting _sSettings = sSettings; gameObject.AddComponent <MeshRenderer> (); _filter = gameObject.AddComponent <MeshFilter>(); _meshBuilder = new MeshBuilder(); gameObject.GetComponent <MeshRenderer> ().sharedMaterial = ShortcutUtil.GetMaterial(); }
private bool AcceptDrop(IDataObject iDataObject, out ProcessFullPath pfp) { pfp = new ProcessFullPath(); Array a = (Array)iDataObject.GetData(DataFormats.FileDrop); if (a == null || a.GetLength(0) != 1) { return(false); } string fileName = (string)a.GetValue(0); pfp.FileName = Native.FindExecutable(fileName); if (pfp.FileName == null) { if (!fileName.EndsWith("lnk")) { return(false); } try { Bitmap icon; string displayName, targetPath, arguments; ShortcutUtil.ParseShortcut(fileName, out icon, out displayName, out targetPath, out arguments); pfp.FileName = targetPath; pfp.Arguments = arguments; return(true); } catch { return(false); } } else { if (!string.Equals(fileName, pfp.FileName, StringComparison.OrdinalIgnoreCase)) { pfp.Arguments = fileName; } } return(true); }
//Load the tab: Group Ordering private void LoadTabGroupOrdering() { try { List <string> groupNames = ShortcutUtil.GetShortcutGroupNames(); foreach (string groupName in groupNames) { lbGroups.Items.Add(groupName); } } catch (Exception ex) { MessageBox.Show("Error Loading Tab: Group Ordering: " + ex.ToString()); } }
private void btnSearch_Click(object sender, EventArgs e) { lvSearchResult.Items.Clear(); lvSearchResult.Groups.Clear(); if (string.IsNullOrEmpty(ddlShortcutFile.Text)) { //search all shortcut files foreach (string sGroup in ddlShortcutFile.Items) { if (!string.IsNullOrEmpty(sGroup)) { DataTable dt = SearchGroup(sGroup, tbShortcutName.Text); if (dt == null || dt.Rows.Count > 0) { lvSearchResult.ShowGroups = true; lvSearchResult.GridLines = true; ListViewGroup grp = new ListViewGroup(sGroup, sGroup); lvSearchResult.Groups.Add(grp); List <ShortcutItem> d = ShortcutUtil.ConvertToShortcut(dt); foreach (var item in d) { AddItem(item); } } } } } else { DataTable dt = SearchGroup(ddlShortcutFile.Text, tbShortcutName.Text); if (dt == null || dt.Rows.Count > 0) { lvSearchResult.ShowGroups = true; lvSearchResult.GridLines = true; ListViewGroup grp = new ListViewGroup(ddlShortcutFile.Text, ddlShortcutFile.Text); lvSearchResult.Groups.Add(grp); List <ShortcutItem> d = ShortcutUtil.ConvertToShortcut(dt); foreach (var item in d) { AddItem(item); } } } }
private static ShortcutSequence GetShortcutSequence(string shortcut) { // ReSharper registers chords twice, once where the second char doesn't have modifiers // and once where the second char repeats the modifier of the first char. // E.g. Ctrl+R, R and Ctrl+R, Ctrl+R. This allows for flexibility in hitting that chord // (do you hold Ctrl down all the time, or just for the first char? Doesn't matter!) // Empirically, there are only two actions that have a genuine alternative shortcut - // SafeDelete (VS): Ctrl+R, D and Alt+Delete // Rename (IntelliJ): F2 and Shift+F6 // These can be safely ignored, meaning we can just show the primary shortcut var parsedShortcut = ShortcutUtil.ParseKeyboardShortcut(shortcut); if (parsedShortcut == null) { return(null); } return(GetShortcutSequence(parsedShortcut)); }
private void SaveTabGroupOrdering() { List <ShortcutGroupItem> groupNames = new List <ShortcutGroupItem>(); foreach (string item in lbGroups.Items) { ShortcutGroupItem i = new ShortcutGroupItem() { Name = item.ToString() }; groupNames.Add(i); } ShortcutGroup group = new ShortcutGroup() { Items = groupNames }; ShortcutUtil.UpdateGroup(group); }
// Use this for initialization internal void Build(PointerSettings pSettings, PointerType type) { _type = type; _color = pSettings.Color; _radiusNormal = pSettings.RadiusNormal; _radiusHighlighted = pSettings.RadiusHighlighted; _thickness = pSettings.Thickness; _pointerObj = new GameObject("Pointer"); _pointerObj.transform.SetParent(gameObject.transform, false); MeshRenderer meshRenderer = _pointerObj.AddComponent <MeshRenderer> (); meshRenderer.sharedMaterial = ShortcutUtil.GetMaterial(); _pointerObj.AddComponent <MeshFilter> (); _meshBuilder = new MeshBuilder(); _pointerObj.GetComponent <MeshFilter> ().sharedMesh = _meshBuilder.Mesh; }
public void Build(ShortcutSettings sSettings) { // variables setting _sSettings = sSettings; float toDegree = 180 / (float)Mathf.PI; float eachItemAngle = _sSettings.EachItemDegree / toDegree; _startAngle = -(eachItemAngle / 2); _endAngle = eachItemAngle / 2; _meshStep = (int)Math.Round(Math.Max(2, (_endAngle - _startAngle) / Math.PI * 60)); // rendering gameObject.AddComponent <MeshRenderer> (); _filter = gameObject.AddComponent <MeshFilter>(); _meshBuilder = new MeshBuilder(); gameObject.GetComponent <MeshRenderer> ().sharedMaterial = ShortcutUtil.GetMaterial(); }
private static ActionShortcut ToActionShortcut(string binding) { var length = binding.IndexOf("::", StringComparison.Ordinal); return(ShortcutUtil.BindingsToShortcut(length > 0 ? binding.Substring(length + 2) : binding, onerror: null)); }