void Command_Numeric_Add_AddSubtractClipboard(bool add)
        {
            if (Selections.Count == 0)
            {
                return;
            }

            var clipboardStrings = Clipboard;

            if ((clipboardStrings.Count == 1) && (Selections.Count != 1))
            {
                clipboardStrings = Selections.Select(str => clipboardStrings[0]).ToList();
            }

            if (Selections.Count != clipboardStrings.Count())
            {
                throw new Exception("Must have either one or equal number of clipboards.");
            }

            var mult = add ? 1 : -1;

            ReplaceSelections(Selections.Zip(clipboardStrings, (sel, clip) => new { sel, clip }).AsParallel().AsOrdered().Select(obj => (double.Parse(GetString(obj.sel)) + double.Parse(obj.clip) * mult).ToString()).ToList());
        }
示例#2
0
 void Command_Region_Select_WithoutEnclosingRegion_Region(int useRegion) => SetSelections(Selections.Zip(GetEnclosingRegions(useRegion, mustBeInRegion: false), (selection, region) => region == null ? selection : null).Where(selection => selection != null).ToList());