private void SaveState() { var fragment = GeProfile.Fragment; GeProfile.Fragment = GeProfile.Profile; GeProfile.GetNodeProfileText(); NodeFragmentPosition = GeProfile.ProfileTextPostionList.GetFragmentPosition(fragment); }
public void CutSelection(FragmentSelection fragments) { Contract.Requires(GeProfile.IsSelectable(fragments.Start, fragments.End, false)); Contract.Ensures(GeProfile.IsInputable(fragments.Start)); SaveState(); NewProfile = GeProfile.ProfileText.Substring(0, fragments.Start) + GeProfile.ProfileText.Substring(fragments.End); ChangeProfile(); RestoreState(); }
public void InsertSelection(int position, FragmentSelection fragments) { Contract.Requires(GeProfile.IsInputable(position)); Contract.Ensures(GeProfile.IsSelectable(position, position + fragments.ProfileText.Length, false)); SaveState(); NewProfile = GeProfile.ProfileText.Insert(NodeFragmentPosition.Position.Offset + position, fragments.ProfileText); ChangeProfile(); RestoreState(); }
private void RestoreState() { GeProfile.Fragment = GeProfile.Profile; GeProfile.GetNodeProfileText(); Fragment after; Fragment before; GeProfile.GetFragmentsAt(out before, out after, NodeFragmentPosition.Position.Offset); GeProfile.Fragment = after; GeProfile.GetNodeProfileText(); }
public ModifyProfile(GeProfile geProfile) { GeProfile = geProfile; }
public ReplaceSelectionWithPlaceholderCommand(Text text, int selectionStart, int selectionEnd, GenDataId id, GeProfile geProfile) : base(geProfile) { Text = text; SelectionStart = selectionStart; SelectionEnd = selectionEnd; Id = id; Body = (FragmentBody)Text.Parent; FragmentIndex = Body.FragmentList.IndexOf(Text) + 1; Prefix = Text.TextValue.Substring(0, SelectionStart); Suffix = Text.TextValue.Substring(SelectionEnd); }
public InsertSelectionCommand(GeProfile geProfile, int position, FragmentSelection fragments) : base(geProfile) { Position = position; Fragments = fragments; }
public CutSelectionCommand(GeProfile geProfile, FragmentSelection fragments) : base(geProfile) { Fragments = fragments; }
protected ProfileCommandBase(GeProfile geProfile) { GeProfile = geProfile; }
public ReplacePlaceholderWithTextCommand(Placeholder placeholder, string substitutedText, GeProfile geProfile) : base(geProfile) { Placeholder = placeholder; SubstitutedText = substitutedText; SelectionStart = 0; SelectionEnd = SubstitutedText.Length; Id = new GenDataId { ClassName = Placeholder.Class, PropertyName = Placeholder.Property }; }