├── .gitignore ├── .gitmodules ├── BasicSccProvider.Tests ├── BasicSccProvider.Tests.csproj ├── GetFileStatusTest.cs ├── GitFileStatusTrackerTest.cs ├── PackageTest.cs ├── Properties │ └── AssemblyInfo.cs └── RepositoryGraphTest.cs ├── BasicSccProvider.cs ├── BasicSccProvider.csproj ├── BasicSccProvider.sln ├── BasicSccProvider.vsmdi ├── ClassDiagram.cd ├── CommandId.cs ├── DataServices ├── Blob.cs ├── BlobContent.cs ├── Change.cs ├── Commit.cs ├── GitTreeObject.cs ├── GraphLink.cs ├── GraphNode.cs ├── Ref.cs ├── RepositoryGraph.cs ├── RepositoryInfo.cs └── Tree.cs ├── Diff ├── BackgroundParser.cs ├── DiffAdditionEditorFormatDefinition.cs ├── DiffFormatNames.cs ├── DiffMargin.cs ├── DiffMarginEnabled.cs ├── DiffMarginFactory.cs ├── DiffModificationEditorFormatDefinition.cs ├── DiffParseResultEventArgs.cs ├── DiffRemovedEditorFormatDefinition.cs ├── DiffUpdateBackgroundParser.cs ├── GitCommands.cs ├── GitTextViewOptions.cs ├── HunkRange.cs ├── HunkRangeInfo.cs ├── IGitCommands.cs ├── ParseResultEventArgs.cs ├── Resources │ ├── CopyOldText.png │ ├── NextArrow.png │ ├── PreviousArrow.png │ └── Rollback.png ├── View │ ├── DiffMarginControl.xaml │ └── DiffMarginControl.xaml.cs ├── ViewModel │ ├── DiffMarginViewModel.cs │ └── DiffViewModel.cs └── WeakReference.cs ├── DiffClassifier ├── DiffClassificationDefinitions.cs ├── DiffClassifier.cs ├── DiffClassifier.csproj ├── DiffClassifierProvider.cs └── Properties │ └── AssemblyInfo.cs ├── ExceptionExtensions.cs ├── GitApi ├── DataServices │ ├── Change.cs │ ├── Commit.cs │ ├── GitTreeObject.cs │ ├── GraphLink.cs │ ├── GraphNode.cs │ ├── Ref.cs │ └── RepositoryGraph.cs ├── GitApi.csproj ├── GitBash.cs ├── GitBashResult.cs ├── GitCommitResult.cs ├── GitFileStatus.cs ├── GitFileStatusTracker.cs └── Properties │ └── AssemblyInfo.cs ├── GitBash.cs ├── GitFileStatus.cs ├── GitFileStatusTracker.cs ├── GitProject.cs ├── GitSccOptions.cs ├── GitSharp licence.txt ├── GitToolCommands.cs ├── GitUI ├── App.xaml ├── App.xaml.cs ├── GitIntellisenseHelper.cs ├── GitSccOptions.cs ├── GitUI.csproj ├── GitViewModel.cs ├── ICSharpCode.AvalonEdit │ ├── AvalonEditCommands.cs │ ├── CodeCompletion │ │ ├── CompletionList.cs │ │ ├── CompletionList.xaml │ │ ├── CompletionListBox.cs │ │ ├── CompletionWindow.cs │ │ ├── CompletionWindowBase.cs │ │ ├── ICompletionData.cs │ │ ├── IOverloadProvider.cs │ │ ├── InsightWindow.cs │ │ ├── InsightWindow.xaml │ │ ├── OverloadInsightWindow.cs │ │ └── OverloadViewer.cs │ ├── Document │ │ ├── ChangeTrackingCheckpoint.cs │ │ ├── DocumentChangeEventArgs.cs │ │ ├── DocumentChangeOperation.cs │ │ ├── DocumentLine.cs │ │ ├── DocumentLineTree.cs │ │ ├── GapTextBuffer.cs │ │ ├── ILineTracker.cs │ │ ├── ISegment.cs │ │ ├── ITextSource.cs │ │ ├── IUndoableOperation.cs │ │ ├── LineManager.cs │ │ ├── LineNode.cs │ │ ├── NewLineFinder.cs │ │ ├── OffsetChangeMap.cs │ │ ├── TextAnchor.cs │ │ ├── TextAnchorNode.cs │ │ ├── TextAnchorTree.cs │ │ ├── TextDocument.cs │ │ ├── TextDocumentWeakEventManager.cs │ │ ├── TextLocation.cs │ │ ├── TextSegment.cs │ │ ├── TextSegmentCollection.cs │ │ ├── TextUtilities.cs │ │ ├── UndoOperationGroup.cs │ │ ├── UndoStack.cs │ │ └── WeakLineTracker.cs │ ├── Editing │ │ ├── AbstractMargin.cs │ │ ├── Caret.cs │ │ ├── CaretLayer.cs │ │ ├── CaretNavigationCommandHandler.cs │ │ ├── CaretWeakEventHandler.cs │ │ ├── DottedLineMargin.cs │ │ ├── DragDropException.cs │ │ ├── EditingCommandHandler.cs │ │ ├── EmptySelection.cs │ │ ├── IReadOnlySectionProvider.cs │ │ ├── LineNumberMargin.cs │ │ ├── NoReadOnlySections.cs │ │ ├── RectangleSelection.cs │ │ ├── Selection.cs │ │ ├── SelectionColorizer.cs │ │ ├── SelectionLayer.cs │ │ ├── SelectionMouseHandler.cs │ │ ├── SelectionSegment.cs │ │ ├── SimpleSelection.cs │ │ ├── TextArea.cs │ │ ├── TextAreaDefaultInputHandlers.cs │ │ ├── TextAreaInputHandler.cs │ │ └── TextSegmentReadOnlySectionProvider.cs │ ├── Folding │ │ ├── AbstractFoldingStrategy.cs │ │ ├── FoldingElementGenerator.cs │ │ ├── FoldingManager.cs │ │ ├── FoldingMargin.cs │ │ ├── FoldingMarginMarker.cs │ │ ├── FoldingSection.cs │ │ ├── NewFolding.cs │ │ └── XmlFoldingStrategy.cs │ ├── Highlighting │ │ ├── DocumentHighlighter.cs │ │ ├── HighlightedInlineBuilder.cs │ │ ├── HighlightedLine.cs │ │ ├── HighlightedSection.cs │ │ ├── HighlightingBrush.cs │ │ ├── HighlightingColor.cs │ │ ├── HighlightingColorizer.cs │ │ ├── HighlightingDefinitionInvalidException.cs │ │ ├── HighlightingDefinitionTypeConverter.cs │ │ ├── HighlightingManager.cs │ │ ├── HighlightingRule.cs │ │ ├── HighlightingRuleSet.cs │ │ ├── HighlightingSpan.cs │ │ ├── HtmlClipboard.cs │ │ ├── IHighlighter.cs │ │ ├── IHighlightingDefinition.cs │ │ ├── IHighlightingDefinitionReferenceResolver.cs │ │ ├── Resources │ │ │ ├── ASPX.xshd │ │ │ ├── Boo.xshd │ │ │ ├── CPP-Mode.xshd │ │ │ ├── CSS-Mode.xshd │ │ │ ├── CSharp-Mode.xshd │ │ │ ├── Coco-Mode.xshd │ │ │ ├── HTML-Mode.xshd │ │ │ ├── Java-Mode.xshd │ │ │ ├── JavaScript-Mode.xshd │ │ │ ├── ModeV1.xsd │ │ │ ├── ModeV2.xsd │ │ │ ├── PHP-Mode.xshd │ │ │ ├── Patch-Mode.xshd │ │ │ ├── Resources.cs │ │ │ ├── Tex-Mode.xshd │ │ │ ├── VBNET-Mode.xshd │ │ │ ├── XML-Mode.xshd │ │ │ └── XmlDoc.xshd │ │ └── Xshd │ │ │ ├── HighlightingLoader.cs │ │ │ ├── IXshdVisitor.cs │ │ │ ├── SaveXshdVisitor.cs │ │ │ ├── V1Loader.cs │ │ │ ├── V2Loader.cs │ │ │ ├── XmlHighlightingDefinition.cs │ │ │ ├── XshdColor.cs │ │ │ ├── XshdElement.cs │ │ │ ├── XshdImport.cs │ │ │ ├── XshdKeywords.cs │ │ │ ├── XshdReference.cs │ │ │ ├── XshdRule.cs │ │ │ ├── XshdRuleSet.cs │ │ │ ├── XshdSpan.cs │ │ │ └── XshdSyntaxDefinition.cs │ ├── ICSharpCode.AvalonEdit.csproj │ ├── ICSharpCode.AvalonEdit.snk │ ├── Indentation │ │ ├── CSharp │ │ │ ├── CSharpIndentationStrategy.cs │ │ │ ├── DocumentAccessor.cs │ │ │ └── IndentationReformatter.cs │ │ ├── DefaultIndentationStrategy.cs │ │ └── IIndentationStrategy.cs │ ├── Properties │ │ ├── AssemblyInfo.cs │ │ └── CodeAnalysisDictionary.xml │ ├── Rendering │ │ ├── BackgroundGeometryBuilder.cs │ │ ├── CollapsedLineSection.cs │ │ ├── ColorizingTransformer.cs │ │ ├── DocumentColorizingTransformer.cs │ │ ├── FormattedTextElement.cs │ │ ├── GlobalTextRunProperties.cs │ │ ├── HeightTree.cs │ │ ├── HeightTreeLineNode.cs │ │ ├── HeightTreeNode.cs │ │ ├── IBackgroundRenderer.cs │ │ ├── ITextRunConstructionContext.cs │ │ ├── ITextViewConnect.cs │ │ ├── IVisualLineTransformer.cs │ │ ├── InlineObjectRun.cs │ │ ├── Layer.cs │ │ ├── LayerPosition.cs │ │ ├── LinkElementGenerator.cs │ │ ├── MouseHoverLogic.cs │ │ ├── SimpleTextSource.cs │ │ ├── SingleCharacterElementGenerator.cs │ │ ├── TextLayer.cs │ │ ├── TextView.cs │ │ ├── TextViewCachedElements.cs │ │ ├── TextViewWeakEventManager.cs │ │ ├── VisualLine.cs │ │ ├── VisualLineConstructionStartEventArgs.cs │ │ ├── VisualLineElement.cs │ │ ├── VisualLineElementGenerator.cs │ │ ├── VisualLineElementTextRunProperties.cs │ │ ├── VisualLineLinkText.cs │ │ ├── VisualLineText.cs │ │ ├── VisualLineTextParagraphProperties.cs │ │ ├── VisualLineTextSource.cs │ │ ├── VisualLinesInvalidException.cs │ │ └── VisualYPosition.cs │ ├── Search │ │ ├── DropDownButton.cs │ │ ├── DropDownButton.xaml │ │ ├── ISearchStrategy.cs │ │ ├── Localization.cs │ │ ├── RegexSearchStrategy.cs │ │ ├── SearchCommands.cs │ │ ├── SearchPanel.cs │ │ ├── SearchPanel.xaml │ │ ├── SearchResultBackgroundRenderer.cs │ │ ├── SearchStrategyFactory.cs │ │ ├── next.png │ │ └── prev.png │ ├── Snippets │ │ ├── IActiveElement.cs │ │ ├── InsertionContext.cs │ │ ├── Snippet.cs │ │ ├── SnippetAnchorElement.cs │ │ ├── SnippetBoundElement.cs │ │ ├── SnippetCaretElement.cs │ │ ├── SnippetContainerElement.cs │ │ ├── SnippetElement.cs │ │ ├── SnippetEventArgs.cs │ │ ├── SnippetInputHandler.cs │ │ ├── SnippetReplaceableTextElement.cs │ │ ├── SnippetSelectionElement.cs │ │ └── SnippetTextElement.cs │ ├── TextEditor.cs │ ├── TextEditor.xaml │ ├── TextEditorAutomationPeer.cs │ ├── TextEditorComponent.cs │ ├── TextEditorOptions.cs │ ├── TextEditorWeakEventManager.cs │ ├── TextViewPosition.cs │ ├── Utils │ │ ├── Boxes.cs │ │ ├── BusyManager.cs │ │ ├── CallbackOnDispose.cs │ │ ├── CharRope.cs │ │ ├── CompressingTreeList.cs │ │ ├── Constants.cs │ │ ├── DelayedEvents.cs │ │ ├── Deque.cs │ │ ├── Empty.cs │ │ ├── ExtensionMethods.cs │ │ ├── FileReader.cs │ │ ├── ImmutableStack.cs │ │ ├── NullSafeCollection.cs │ │ ├── ObserveAddRemoveCollection.cs │ │ ├── PixelSnapHelpers.cs │ │ ├── PropertyChangedWeakEventManager.cs │ │ ├── Rope.cs │ │ ├── RopeNode.cs │ │ ├── RopeTextReader.cs │ │ ├── StringSegment.cs │ │ ├── TextFormatterFactory.cs │ │ ├── ThrowUtil.cs │ │ ├── WeakEventManagerBase.cs │ │ └── Win32.cs │ ├── Xml │ │ ├── AXmlAttribute.cs │ │ ├── AXmlAttributeCollection.cs │ │ ├── AXmlContainer.cs │ │ ├── AXmlDocument.cs │ │ ├── AXmlElement.cs │ │ ├── AXmlObject.cs │ │ ├── AXmlObjectCollection.cs │ │ ├── AXmlObjectEventArgs.cs │ │ ├── AXmlParser.cs │ │ ├── AXmlTag.cs │ │ ├── AXmlText.cs │ │ ├── AbstractAXmlVisitor.cs │ │ ├── CanonicalPrintAXmlVisitor.cs │ │ ├── ExtensionMethods.cs │ │ ├── FilteredCollection.cs │ │ ├── IAXmlVisitor.cs │ │ ├── InternalException.cs │ │ ├── MergedCollection.cs │ │ ├── PrettyPrintAXmlVisitor.cs │ │ ├── SyntaxError.cs │ │ ├── TagMatchingHeuristics.cs │ │ ├── TagReader.cs │ │ ├── TextType.cs │ │ ├── TokenReader.cs │ │ └── TrackedSegmentCollection.cs │ └── themes │ │ ├── RightArrow.cur │ │ └── generic.xaml ├── MainWindow.xaml ├── MainWindow.xaml.cs ├── Microsoft.Windows.Shell │ ├── JumpItem.cs │ ├── JumpList.cs │ ├── JumpPath.cs │ ├── JumpTask.cs │ ├── Microsoft.Windows.Shell.csproj │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── Standard │ │ ├── ComGuids.cs │ │ ├── Debug.cs │ │ ├── DoubleUtil.cs │ │ ├── DpiHelper.cs │ │ ├── ErrorCodes.cs │ │ ├── MessageWindow.cs │ │ ├── NativeMethods.cs │ │ ├── ShellProvider.cs │ │ ├── StreamHelper.cs │ │ ├── Utilities.cs │ │ └── Verify.cs │ ├── SystemCommands.cs │ ├── SystemParameters2.cs │ ├── TaskbarItemInfo.cs │ ├── ThumbButtonInfo.cs │ ├── ThumbButtonInfoCollection.cs │ ├── WindowChrome.cs │ ├── WindowChromeWorker.cs │ └── app.config ├── Options.cs ├── Properties │ ├── AssemblyInfo.cs │ ├── Resources.Designer.cs │ ├── Resources.resx │ ├── Settings.Designer.cs │ └── Settings.settings ├── Resources │ ├── Loading.png │ ├── Microsoft.Windows.Shell.dll.config │ ├── Microsoft.Windows.Shell.dll.lastcodeanalysissucceeded │ └── dragon.png ├── UI │ ├── BottomToolBar.xaml │ ├── BottomToolBar.xaml.cs │ ├── BranchPicker.xaml │ ├── BranchPicker.xaml.cs │ ├── CommitBox.xaml │ ├── CommitBox.xaml.cs │ ├── CommitDetails.xaml │ ├── CommitDetails.xaml.cs │ ├── CommitHead.xaml │ ├── CommitHead.xaml.cs │ ├── CommitRemote.xaml │ ├── CommitRemote.xaml.cs │ ├── CommitTag.xaml │ ├── CommitTag.xaml.cs │ ├── GitConsole.xaml │ ├── GitConsole.xaml.cs │ ├── HistoryGraph.xaml │ ├── HistoryGraph.xaml.cs │ ├── Loading.xaml │ ├── Loading.xaml.cs │ ├── MainToolBar.xaml │ ├── MainToolBar.xaml.cs │ ├── MouseHandlingMode.cs │ ├── PendingChanges.xaml │ ├── PendingChanges.xaml.cs │ └── ResourceDictionary.xaml └── ZoomAndPan │ ├── AnimationHelper.cs │ ├── Properties │ └── AssemblyInfo.cs │ ├── Themes │ └── Generic.xaml │ ├── ZoomAndPan.csproj │ ├── ZoomAndPanControl.cs │ └── ZoomAndPanControl_IScrollInfo.cs ├── GlobalCommandHook.cs ├── Guids.cs ├── HistoryToolWindow.cs ├── HistoryToolWindow.resx ├── HistoryView.xaml ├── HistoryView.xaml.cs ├── JGit licence.txt ├── License.txt ├── Local.testsettings ├── MiscUtil licence.txt ├── PendingChangesToolWindow.cs ├── PendingChangesToolWindow.resx ├── PendingChangesView.xaml ├── PendingChangesView.xaml.cs ├── PkgCmd.vsct ├── PlatformUI ├── HeaderColors.cs ├── PlatformColorHelper.cs └── TreeViewColors.cs ├── Properties └── AssemblyInfo.cs ├── ProvideSourceControlProvider.cs ├── ProvideToolsOptionsPageVisibility.cs ├── README.md ├── Readme.html ├── ResourceDictionary.xaml ├── Resources.Designer.cs ├── Resources.resx ├── Resources ├── Compare.png ├── History.png ├── Images_24bit.bmp ├── Images_32bit.bmp ├── Images_32bit.png ├── Loading.png ├── PendingCheckins.png ├── Product.ico ├── Refresh.png ├── SccGlyphs.bmp ├── SccGlyphs2012.png ├── Switch.png └── UndoCheckout.png ├── SccGlyphsHelper.cs ├── SccOnIdleEvent.cs ├── SccProviderOptions.cs ├── SccProviderOptionsControl.cs ├── SccProviderOptionsControl.resx ├── SccProviderService.cs ├── Schedulers └── QueuedTaskScheduler.cs ├── SharedAssemblyInfo.cs ├── TODO.md ├── TaskExtensions.cs ├── ToolWindowWithEditor.cs ├── TraceAndTestImpact.testsettings ├── UI ├── BranchPicker.xaml ├── BranchPicker.xaml.cs ├── CommitBox.xaml ├── CommitBox.xaml.cs ├── CommitDetails.xaml ├── CommitDetails.xaml.cs ├── CommitHead.xaml ├── CommitHead.xaml.cs ├── CommitRemote.xaml ├── CommitRemote.xaml.cs ├── CommitTag.xaml ├── CommitTag.xaml.cs ├── GitConsole.xaml ├── GitConsole.xaml.cs ├── GitIntellisenseHelper.cs ├── HistoryGraph.xaml ├── HistoryGraph.xaml.cs ├── Loading.xaml ├── Loading.xaml.cs ├── Settings.xaml └── Settings.xaml.cs ├── Winterdom.IO.FileMap License.txt ├── gitscc.reg ├── packages.config ├── packages ├── MvvmLight.4.1.26.1 │ ├── MvvmLight.4.1.26.1.nuspec │ └── lib │ │ └── net40 │ │ ├── GalaSoft.MvvmLight.WPF4.XML │ │ └── GalaSoft.MvvmLight.WPF4.dll └── repositories.config ├── solution explorer.png └── source.extension.vsixmanifest /.gitignore: -------------------------------------------------------------------------------- 1 | #ignore thumbnails created by windows 2 | Thumbs.db 3 | #Ignore files build by Visual Studio 4 | *.obj 5 | *.exe 6 | *.pdb 7 | *.user 8 | *.aps 9 | *.pch 10 | *.vspscc 11 | *_i.c 12 | *_p.c 13 | *.ncb 14 | *.suo 15 | *.sln.docstates 16 | *.tlb 17 | *.tlh 18 | *.bak 19 | *.cache 20 | *.ilk 21 | *.log 22 | [Bb]in 23 | [Dd]ebug*/ 24 | *.lib 25 | *.sbr 26 | obj/ 27 | [Rr]elease*/ 28 | _ReSharper*/ 29 | [Tt]est[Rr]esult* 30 | Publish*/ 31 | GitUI/Resources/*.dll 32 | GitUI/Resources/*.xml 33 | *.pkg 34 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "ngit"] 2 | path = ngit 3 | url = https://github.com/yysun/ngit.git 4 | -------------------------------------------------------------------------------- /BasicSccProvider.Tests/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("BasicSccProvider.Tests")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("Microsoft")] 12 | [assembly: AssemblyProduct("BasicSccProvider.Tests")] 13 | [assembly: AssemblyCopyright("Copyright © Microsoft 2010")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("c6686e46-d8d4-4f1c-8098-4b9d8bbaf537")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | [assembly: AssemblyVersion("1.0.0.0")] 35 | [assembly: AssemblyFileVersion("1.0.0.0")] 36 | -------------------------------------------------------------------------------- /BasicSccProvider.vsmdi: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /ClassDiagram.cd: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | EAAAC4AYgCBAGAAAEAIABCEAYgQAAIAqAAAQuIASAAA= 7 | SccProviderService.cs 8 | 9 | 10 | 11 | 12 | 13 | 14 | AAEAAAAACCAAAQABAAAAAAAAAAAAAAAAAAAAAAAAAEA= 15 | BasicSccProvider.cs 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /DataServices/Blob.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | using System.Text; 6 | 7 | namespace GitScc.DataServices 8 | { 9 | public class Blob : ITreeObject 10 | { 11 | public string Id { get; set; } 12 | public string Name { get; set; } 13 | public byte[] Content { get; set; } 14 | } 15 | } -------------------------------------------------------------------------------- /DataServices/BlobContent.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | using System.Data.Services.Common; 6 | using System.IO; 7 | using System.Text; 8 | 9 | namespace GitScc.DataServices 10 | { 11 | [DataServiceKey("Id")] 12 | public class BlobContent 13 | { 14 | public string Id { get; set; } 15 | public string RepoFolder { get; set; } 16 | 17 | private byte[] bytes; 18 | public byte[] Bytes 19 | { 20 | get 21 | { 22 | if (bytes == null) 23 | { 24 | // var fileName = Path.GetTempFileName(); 25 | 26 | // Git.RunCmd("cat-file -p " + this.Id + " > " + fileName, 27 | // this.RepoFolder); 28 | 29 | // bytes = File.ReadAllBytes(fileName); 30 | 31 | // if (File.Exists(fileName)) File.Delete(fileName); 32 | } 33 | return bytes; 34 | } 35 | } 36 | 37 | } 38 | } -------------------------------------------------------------------------------- /DataServices/Change.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace GitScc.DataServices 7 | { 8 | public class Change 9 | { 10 | public ChangeType ChangeType { get; set; } 11 | public string Name { get; set; } 12 | } 13 | 14 | public enum ChangeType 15 | { 16 | Added, 17 | Deleted, 18 | Modified, 19 | TypeChanged, 20 | Renamed, 21 | Copied 22 | } 23 | } 24 | 25 | -------------------------------------------------------------------------------- /DataServices/Commit.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | 6 | namespace GitScc.DataServices 7 | { 8 | public class Commit 9 | { 10 | public string Id { get; set; } 11 | public IList ParentIds { get; set; } 12 | public IList ChildIds { get; set; } 13 | public string Message { get; set; } 14 | public string CommitterName { get; set; } 15 | public string CommitterEmail { get; set; } 16 | public DateTime CommitDate { get; set; } 17 | public string CommitDateRelative { get; set; } 18 | internal bool deleted { get; set; } 19 | } 20 | } -------------------------------------------------------------------------------- /DataServices/GraphLink.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | 6 | namespace GitScc.DataServices 7 | { 8 | public class GraphLink 9 | { 10 | public string Id { get; set; } 11 | public int X1 { get; set; } 12 | public int Y1 { get; set; } 13 | public int X2 { get; set; } 14 | public int Y2 { get; set; } 15 | 16 | } 17 | } -------------------------------------------------------------------------------- /DataServices/GraphNode.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | 6 | namespace GitScc.DataServices 7 | { 8 | public class GraphNode : Commit 9 | { 10 | public Ref[] Refs { get; set; } 11 | //public string[] Branches { get; set; } 12 | public int X { get; set; } 13 | public int Y { get; set; } 14 | } 15 | } -------------------------------------------------------------------------------- /DataServices/Ref.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | 6 | namespace GitScc.DataServices 7 | { 8 | public class Ref 9 | { 10 | public string Id { get; set; } 11 | public string RefName { get; set; } 12 | public string Name 13 | { 14 | get 15 | { 16 | var name = RefName.Replace("refs/", ""); 17 | return name.Substring(name.IndexOf("/") + 1); 18 | } 19 | } 20 | public RefTypes Type 21 | { 22 | get 23 | { 24 | if (RefName == "HEAD") return RefTypes.HEAD; 25 | else if (RefName.StartsWith("refs/heads")) return RefTypes.Branch; 26 | else if (RefName.StartsWith("refs/tags")) return RefTypes.Tag; 27 | else if (RefName.StartsWith("refs/remotes")) return RefTypes.RemoteBranch; 28 | return RefTypes.Unknown; 29 | } 30 | } 31 | 32 | public override string ToString() 33 | { 34 | return Name; 35 | } 36 | } 37 | 38 | public enum RefTypes 39 | { 40 | Unknown, 41 | HEAD, 42 | Branch, 43 | Tag, 44 | RemoteBranch 45 | } 46 | 47 | } -------------------------------------------------------------------------------- /DataServices/Tree.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | using System.Data.Services.Common; 6 | 7 | namespace GitScc.DataServices 8 | { 9 | [DataServiceKey("Id")] 10 | public class Tree 11 | { 12 | public string Id { get; set; } 13 | public string Name { get; set; } 14 | public string RepoFolder { get; set; } 15 | 16 | public IEnumerable Trees 17 | { 18 | get 19 | { 20 | var repository = NGit.Api.Git.Open(RepoFolder).GetRepository(); 21 | 22 | //repository.Close(); 23 | //return from c in Git.Run("ls-tree " + this.Id, this.RepoFolder).Split('\n') 24 | // where !string.IsNullOrWhiteSpace(c) && 25 | // c.Substring(7, 4) == "tree" 26 | // select new Tree 27 | // { 28 | // Id = c.Substring(12, 40), 29 | // RepoFolder = this.RepoFolder, 30 | // Name = this.Name + c.Substring(52) + "\\", 31 | // }; 32 | 33 | return null; 34 | } 35 | } 36 | 37 | public IEnumerable Blobs 38 | { 39 | get 40 | { 41 | //return from c in Git.Run("ls-tree " + this.Id, this.RepoFolder).Split('\n') 42 | // where !string.IsNullOrWhiteSpace(c) && 43 | // c.Substring(7, 4) == "blob" 44 | // select new Blob 45 | // { 46 | // Id = c.Substring(12, 40), 47 | // Name = c.Substring(52), 48 | // Content = new BlobContent 49 | // { 50 | // Id = c.Substring(12, 40), 51 | // RepoFolder = this.RepoFolder, 52 | // } 53 | // }; 54 | 55 | return null; 56 | } 57 | } 58 | } 59 | } -------------------------------------------------------------------------------- /Diff/DiffAdditionEditorFormatDefinition.cs: -------------------------------------------------------------------------------- 1 | namespace GitScc.Diff 2 | { 3 | using System.ComponentModel.Composition; 4 | using System.Windows.Media; 5 | using Microsoft.VisualStudio.Text.Classification; 6 | using Microsoft.VisualStudio.Utilities; 7 | 8 | [Export(typeof(EditorFormatDefinition))] 9 | [Name(DiffFormatNames.Addition)] 10 | [UserVisible(true)] 11 | internal sealed class DiffAdditionEditorFormatDefinition : EditorFormatDefinition 12 | { 13 | public DiffAdditionEditorFormatDefinition() 14 | { 15 | BackgroundColor = Color.FromRgb(180, 255, 180); 16 | ForegroundCustomizable = false; 17 | DisplayName = "Git Diff Addition"; 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Diff/DiffFormatNames.cs: -------------------------------------------------------------------------------- 1 | namespace GitScc.Diff 2 | { 3 | public static class DiffFormatNames 4 | { 5 | public const string Addition = "GitDiffAddition"; 6 | public const string Modification = "GitDiffModification"; 7 | public const string Removed = "GitDiffRemoved"; 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /Diff/DiffMarginEnabled.cs: -------------------------------------------------------------------------------- 1 | namespace GitScc.Diff 2 | { 3 | using System.ComponentModel.Composition; 4 | using Microsoft.VisualStudio.Text.Editor; 5 | using Microsoft.VisualStudio.Utilities; 6 | 7 | [Export(typeof(EditorOptionDefinition))] 8 | [Name(GitTextViewOptions.DiffMarginName)] 9 | public sealed class DiffMarginEnabled : ViewOptionDefinition 10 | { 11 | public override bool Default 12 | { 13 | get 14 | { 15 | return true; 16 | } 17 | } 18 | 19 | public override EditorOptionKey Key 20 | { 21 | get 22 | { 23 | return GitTextViewOptions.DiffMarginId; 24 | } 25 | } 26 | 27 | [Export(typeof(IWpfTextViewCreationListener))] 28 | [ContentType("text")] 29 | [TextViewRole(PredefinedTextViewRoles.Document)] 30 | private class TextViewListener : IWpfTextViewCreationListener 31 | { 32 | public void TextViewCreated(IWpfTextView textView) 33 | { 34 | if (textView == null) 35 | return; 36 | 37 | textView.Options.SetOptionValue(GitTextViewOptions.DiffMarginId, !GitSccOptions.Current.DisableDiffMargin); 38 | } 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /Diff/DiffMarginFactory.cs: -------------------------------------------------------------------------------- 1 | namespace GitScc.Diff 2 | { 3 | using System.ComponentModel.Composition; 4 | using Microsoft.VisualStudio.Text; 5 | using Microsoft.VisualStudio.Text.Classification; 6 | using Microsoft.VisualStudio.Text.Editor; 7 | using Microsoft.VisualStudio.Utilities; 8 | 9 | [Export(typeof(IWpfTextViewMarginProvider))] 10 | [Name(DiffMargin.MarginName)] 11 | [Order(After = PredefinedMarginNames.Spacer, Before = PredefinedMarginNames.Outlining)] 12 | [MarginContainer(PredefinedMarginNames.LeftSelection)] 13 | [ContentType("text")] 14 | [TextViewRole(PredefinedTextViewRoles.Editable)] 15 | internal sealed class DiffMarginFactory : IWpfTextViewMarginProvider 16 | { 17 | [Import] 18 | internal ITextDocumentFactoryService TextDocumentFactoryService 19 | { 20 | get; 21 | private set; 22 | } 23 | 24 | [Import] 25 | internal IClassificationFormatMapService ClassificationFormatMapService 26 | { 27 | get; 28 | private set; 29 | } 30 | 31 | [Import] 32 | internal IEditorFormatMapService EditorFormatMapService 33 | { 34 | get; 35 | private set; 36 | } 37 | 38 | public IWpfTextViewMargin CreateMargin(IWpfTextViewHost textViewHost, IWpfTextViewMargin containerMargin) 39 | { 40 | return new DiffMargin(textViewHost.TextView, this); 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /Diff/DiffModificationEditorFormatDefinition.cs: -------------------------------------------------------------------------------- 1 | namespace GitScc.Diff 2 | { 3 | using System.ComponentModel.Composition; 4 | using System.Windows.Media; 5 | using Microsoft.VisualStudio.Text.Classification; 6 | using Microsoft.VisualStudio.Utilities; 7 | 8 | [Export(typeof(EditorFormatDefinition))] 9 | [Name(DiffFormatNames.Modification)] 10 | [UserVisible(true)] 11 | internal sealed class DiffModificationEditorFormatDefinition : EditorFormatDefinition 12 | { 13 | public DiffModificationEditorFormatDefinition() 14 | { 15 | BackgroundColor = Color.FromRgb(160, 200, 255); 16 | ForegroundCustomizable = false; 17 | DisplayName = "Git Diff Modification"; 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Diff/DiffParseResultEventArgs.cs: -------------------------------------------------------------------------------- 1 | namespace GitScc.Diff 2 | { 3 | using System; 4 | using System.Collections.Generic; 5 | using Microsoft.VisualStudio.Text; 6 | 7 | public class DiffParseResultEventArgs : ParseResultEventArgs 8 | { 9 | private readonly List _diff; 10 | 11 | public DiffParseResultEventArgs(ITextSnapshot snapshot, TimeSpan elapsedTime, List diff) 12 | : base(snapshot, elapsedTime) 13 | { 14 | _diff = diff; 15 | } 16 | 17 | public List Diff 18 | { 19 | get 20 | { 21 | return _diff; 22 | } 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Diff/DiffRemovedEditorFormatDefinition.cs: -------------------------------------------------------------------------------- 1 | namespace GitScc.Diff 2 | { 3 | using System.ComponentModel.Composition; 4 | using System.Windows.Media; 5 | using Microsoft.VisualStudio.Text.Classification; 6 | using Microsoft.VisualStudio.Utilities; 7 | 8 | [Export(typeof(EditorFormatDefinition))] 9 | [Name(DiffFormatNames.Removed)] 10 | [UserVisible(true)] 11 | internal sealed class DiffRemovedEditorFormatDefinition : EditorFormatDefinition 12 | { 13 | public DiffRemovedEditorFormatDefinition() 14 | { 15 | BackgroundColor = Color.FromRgb(255, 160, 180); 16 | ForegroundCustomizable = false; 17 | DisplayName = "Git Diff Removed"; 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Diff/GitTextViewOptions.cs: -------------------------------------------------------------------------------- 1 | namespace GitScc.Diff 2 | { 3 | using Microsoft.VisualStudio.Text.Editor; 4 | 5 | public static class GitTextViewOptions 6 | { 7 | public const string DiffMarginName = "GitScc/DiffMarginName"; 8 | 9 | public static readonly EditorOptionKey DiffMarginId = new EditorOptionKey(DiffMarginName); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Diff/HunkRange.cs: -------------------------------------------------------------------------------- 1 | namespace GitScc.Diff 2 | { 3 | public struct HunkRange 4 | { 5 | private readonly int _startingLineNumber; 6 | private readonly int _numberOfLines; 7 | 8 | public HunkRange(int startingLineNumber, int numberOfLines) 9 | { 10 | _startingLineNumber = startingLineNumber; 11 | _numberOfLines = numberOfLines; 12 | } 13 | 14 | public int StartingLineNumber 15 | { 16 | get 17 | { 18 | return _startingLineNumber; 19 | } 20 | } 21 | 22 | public int NumberOfLines 23 | { 24 | get 25 | { 26 | return _numberOfLines; 27 | } 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /Diff/IGitCommands.cs: -------------------------------------------------------------------------------- 1 | namespace GitScc.Diff 2 | { 3 | using System.Collections.Generic; 4 | using ITextDocument = Microsoft.VisualStudio.Text.ITextDocument; 5 | using ITextSnapshot = Microsoft.VisualStudio.Text.ITextSnapshot; 6 | 7 | public interface IGitCommands 8 | { 9 | IEnumerable GetGitDiffFor(ITextDocument textDocument, ITextSnapshot snapshot); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Diff/ParseResultEventArgs.cs: -------------------------------------------------------------------------------- 1 | /* The MIT License 2 | * 3 | * Copyright (c) 2013 Sam Harwell, Tunnel Vision Labs, LLC 4 | * 5 | * Permission is hereby granted, free of charge, to any person obtaining 6 | * a copy of this software and associated documentation files (the 7 | * "Software"), to deal in the Software without restriction, including 8 | * without limitation the rights to use, copy, modify, merge, publish, 9 | * distribute, sublicense, and/or sell copies of the Software, and to 10 | * permit persons to whom the Software is furnished to do so, subject to 11 | * the following conditions: 12 | * 13 | * The above copyright notice and this permission notice shall be 14 | * included in all copies or substantial portions of the Software. 15 | * 16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 19 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 20 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 21 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 22 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 23 | */ 24 | 25 | namespace GitScc.Diff 26 | { 27 | using System; 28 | using Microsoft.VisualStudio.Text; 29 | 30 | public class ParseResultEventArgs : EventArgs 31 | { 32 | public ParseResultEventArgs(ITextSnapshot snapshot) 33 | { 34 | this.Snapshot = snapshot; 35 | } 36 | 37 | public ParseResultEventArgs(ITextSnapshot snapshot, TimeSpan elapsedTime) 38 | { 39 | this.Snapshot = snapshot; 40 | this.ElapsedTime = elapsedTime; 41 | } 42 | 43 | public ITextSnapshot Snapshot 44 | { 45 | get; 46 | private set; 47 | } 48 | 49 | public TimeSpan? ElapsedTime 50 | { 51 | get; 52 | private set; 53 | } 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /Diff/Resources/CopyOldText.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yysun/Git-Source-Control-Provider/dd8bd933482600f2caf5c2dd935327fbfde8b057/Diff/Resources/CopyOldText.png -------------------------------------------------------------------------------- /Diff/Resources/NextArrow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yysun/Git-Source-Control-Provider/dd8bd933482600f2caf5c2dd935327fbfde8b057/Diff/Resources/NextArrow.png -------------------------------------------------------------------------------- /Diff/Resources/PreviousArrow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yysun/Git-Source-Control-Provider/dd8bd933482600f2caf5c2dd935327fbfde8b057/Diff/Resources/PreviousArrow.png -------------------------------------------------------------------------------- /Diff/Resources/Rollback.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yysun/Git-Source-Control-Provider/dd8bd933482600f2caf5c2dd935327fbfde8b057/Diff/Resources/Rollback.png -------------------------------------------------------------------------------- /Diff/View/DiffMarginControl.xaml.cs: -------------------------------------------------------------------------------- 1 | namespace GitScc.Diff.View 2 | { 3 | using System.Windows.Controls; 4 | 5 | public partial class DiffMarginControl : UserControl 6 | { 7 | public DiffMarginControl() 8 | { 9 | InitializeComponent(); 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /DiffClassifier/DiffClassifierProvider.cs: -------------------------------------------------------------------------------- 1 | //*************************************************************************** 2 | // 3 | // Copyright (c) Microsoft Corporation. All rights reserved. 4 | // This code is licensed under the Visual Studio SDK license terms. 5 | // THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF 6 | // ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY 7 | // IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR 8 | // PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT. 9 | // 10 | //*************************************************************************** 11 | 12 | // Copyright (c) Microsoft Corporation 13 | // All rights reserved 14 | 15 | namespace DiffClassifier 16 | { 17 | using System.ComponentModel.Composition; 18 | using Microsoft.VisualStudio.Text; 19 | using Microsoft.VisualStudio.Text.Classification; 20 | using Microsoft.VisualStudio.Utilities; 21 | 22 | [Export(typeof(IClassifierProvider))] 23 | [ContentType("diff")] 24 | internal class DiffClassifierProvider : IClassifierProvider 25 | { 26 | [Import] 27 | internal IClassificationTypeRegistryService ClassificationRegistry = null; 28 | 29 | static DiffClassifier diffClassifier; 30 | 31 | public IClassifier GetClassifier(ITextBuffer buffer) 32 | { 33 | if (diffClassifier == null) 34 | diffClassifier = new DiffClassifier(ClassificationRegistry); 35 | 36 | return diffClassifier; 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /DiffClassifier/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("DiffClassifier")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("Microsoft")] 12 | [assembly: AssemblyProduct("DiffClassifier")] 13 | [assembly: AssemblyCopyright("Copyright © Microsoft 2011")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("2a14b445-6437-494b-8417-bcfc08617377")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /GitApi/DataServices/Change.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace GitScc.DataServices 7 | { 8 | public class Change 9 | { 10 | public ChangeType ChangeType { get; set; } 11 | public string Name { get; set; } 12 | } 13 | 14 | public enum ChangeType 15 | { 16 | Added, 17 | Deleted, 18 | Modified, 19 | TypeChanged, 20 | Renamed, 21 | Copied, 22 | Unmerged, 23 | Unknown 24 | } 25 | } 26 | 27 | -------------------------------------------------------------------------------- /GitApi/DataServices/Commit.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | 6 | namespace GitScc.DataServices 7 | { 8 | public class Commit 9 | { 10 | public string Id { get; set; } 11 | public IList ParentIds { get; set; } 12 | public IList ChildIds { get; set; } 13 | public string Subject { get; set; } 14 | public string Message { get; set; } 15 | public string TreeId { get; set; } 16 | public string AuthorName { get; set; } 17 | public string AuthorEmail { get; set; } 18 | public DateTime AuthorDate { get; set; } 19 | public string AuthorDateRelative { get; set; } 20 | internal bool deleted { get; set; } 21 | 22 | public override string ToString() 23 | { 24 | return string.Format("[{0}] {1}", ShortId, Subject.Replace("\r", "")); 25 | } 26 | 27 | public string ShortId { get { return Id.Substring(0, 7); } } } 28 | } -------------------------------------------------------------------------------- /GitApi/DataServices/GraphLink.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | 6 | namespace GitScc.DataServices 7 | { 8 | public class GraphLink 9 | { 10 | public string Id { get; set; } 11 | public int X1 { get; set; } 12 | public int Y1 { get; set; } 13 | public int X2 { get; set; } 14 | public int Y2 { get; set; } 15 | 16 | } 17 | } -------------------------------------------------------------------------------- /GitApi/DataServices/GraphNode.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | 6 | namespace GitScc.DataServices 7 | { 8 | public class GraphNode : Commit 9 | { 10 | public Ref[] Refs { get; set; } 11 | //public string[] Branches { get; set; } 12 | public int X { get; set; } 13 | public int Y { get; set; } 14 | } 15 | } -------------------------------------------------------------------------------- /GitApi/DataServices/Ref.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Web; 5 | 6 | namespace GitScc.DataServices 7 | { 8 | public class Ref 9 | { 10 | public string Id { get; set; } 11 | public string RefName { get; set; } 12 | public string Name 13 | { 14 | get 15 | { 16 | var name = RefName.Replace("refs/", ""); 17 | return name.Substring(name.IndexOf("/") + 1); 18 | } 19 | } 20 | public RefTypes Type 21 | { 22 | get 23 | { 24 | if (RefName == "HEAD") return RefTypes.HEAD; 25 | else if (RefName.StartsWith("refs/heads")) return RefTypes.Branch; 26 | else if (RefName.StartsWith("refs/tags")) return RefTypes.Tag; 27 | else if (RefName.StartsWith("refs/remotes")) return RefTypes.RemoteBranch; 28 | return RefTypes.Unknown; 29 | } 30 | } 31 | 32 | public override string ToString() 33 | { 34 | return Name; 35 | } 36 | } 37 | 38 | public enum RefTypes 39 | { 40 | Unknown, 41 | HEAD, 42 | Branch, 43 | Tag, 44 | RemoteBranch 45 | } 46 | 47 | } -------------------------------------------------------------------------------- /GitApi/GitBashResult.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace GitScc 7 | { 8 | public class GitBashResult 9 | { 10 | public bool HasError { get; set; } 11 | 12 | public string Error { get; set; } 13 | 14 | public string Output { get; set; } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /GitApi/GitCommitResult.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace GitScc 7 | { 8 | public class GitCommitResult 9 | { 10 | public bool IsSha1 { get; set; } 11 | 12 | public string Message { get; set; } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /GitApi/GitFileStatus.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using System.ComponentModel; 5 | 6 | namespace GitScc 7 | { 8 | public enum GitFileStatus 9 | { 10 | NotControlled, 11 | New, 12 | Tracked, 13 | Modified, 14 | Staged, 15 | Removed, 16 | Added, 17 | Deleted, 18 | Conflict, 19 | Merged, 20 | Ignored, 21 | Renamed, 22 | Copied 23 | } 24 | 25 | public class GitFile : INotifyPropertyChanged 26 | { 27 | public GitFileStatus Status { get; set; } 28 | public string FileName { get; set; } 29 | public bool IsStaged { 30 | get 31 | { 32 | return Status == GitFileStatus.Added || 33 | Status == GitFileStatus.Staged || 34 | Status == GitFileStatus.Removed || 35 | Status == GitFileStatus.Renamed; 36 | } 37 | } 38 | 39 | public bool isSelected; 40 | public bool IsSelected 41 | { 42 | get { return isSelected; } 43 | set { isSelected = value; OnPropertyChanged("IsSelected"); } 44 | } 45 | 46 | public event PropertyChangedEventHandler PropertyChanged; 47 | 48 | protected void OnPropertyChanged(string name) 49 | { 50 | PropertyChangedEventHandler handler = PropertyChanged; 51 | if (handler != null) 52 | { 53 | handler(this, new PropertyChangedEventArgs(name)); 54 | } 55 | } 56 | 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /GitApi/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("GitApi")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("Microsoft")] 12 | [assembly: AssemblyProduct("GitApi")] 13 | [assembly: AssemblyCopyright("Copyright © Microsoft 2011")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("5d4ce710-e1fa-4b51-aa4e-f53ea8321466")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /GitFileStatus.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using System.ComponentModel; 5 | 6 | namespace GitScc 7 | { 8 | public enum GitFileStatus 9 | { 10 | NotControlled, 11 | New, 12 | Tracked, 13 | Modified, 14 | Staged, 15 | Removed, 16 | Added, 17 | Deleted, 18 | Conflict, 19 | Ignored, 20 | Renamed, 21 | Copied 22 | } 23 | 24 | public class GitFile : INotifyPropertyChanged 25 | { 26 | public GitFileStatus Status { get; set; } 27 | public string FileName { get; set; } 28 | public bool IsStaged { 29 | get 30 | { 31 | return Status == GitFileStatus.Added || 32 | Status == GitFileStatus.Staged || 33 | Status == GitFileStatus.Removed || 34 | Status == GitFileStatus.Renamed; 35 | } 36 | } 37 | 38 | public bool isSelected; 39 | public bool IsSelected 40 | { 41 | get { return isSelected; } 42 | set { isSelected = value; OnPropertyChanged("IsSelected"); } 43 | } 44 | 45 | public event PropertyChangedEventHandler PropertyChanged; 46 | 47 | protected void OnPropertyChanged(string name) 48 | { 49 | PropertyChangedEventHandler handler = PropertyChanged; 50 | if (handler != null) 51 | { 52 | handler(this, new PropertyChangedEventArgs(name)); 53 | } 54 | } 55 | 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /GitProject.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using Microsoft.VisualStudio.Shell.Interop; 6 | 7 | namespace GitScc 8 | { 9 | public class GitProject 10 | { 11 | //public string ProjectDirectory { get; set; } 12 | public GitFileStatusTracker Tracker { get; set; } 13 | //public uint IVsHierarchyEventsCookie { get; set; } 14 | //public IVsHierarchy Hierarchy { get; set; } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /GitSharp licence.txt: -------------------------------------------------------------------------------- 1 | Git# is Copyright (C) 2007-2009 by the Git Development Community 2 | See source file headers for specific contributor copyrights 3 | 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or 7 | without modification, are permitted provided that the following 8 | conditions are met: 9 | 10 | - Redistributions of source code must retain the above copyright 11 | notice, this list of conditions and the following disclaimer. 12 | 13 | - Redistributions in binary form must reproduce the above 14 | copyright notice, this list of conditions and the following 15 | disclaimer in the documentation and/or other materials provided 16 | with the distribution. 17 | 18 | - Neither the name of the Git Development Community nor the 19 | names of its contributors may be used to endorse or promote 20 | products derived from this software without specific prior 21 | written permission. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 24 | CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 25 | INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 26 | OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 27 | ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 28 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 29 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 30 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 31 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 32 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 33 | STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 34 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 35 | ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 36 | 37 | -------------------------------------------------------------------------------- /GitUI/App.xaml: -------------------------------------------------------------------------------- 1 |  5 | 6 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /GitUI/App.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Configuration; 4 | using System.Data; 5 | using System.Linq; 6 | using System.Windows; 7 | using System.Reflection; 8 | using System.IO; 9 | 10 | namespace GitUI 11 | { 12 | /// 13 | /// Interaction logic for App.xaml 14 | /// 15 | public partial class App : Application 16 | { 17 | public App() 18 | { 19 | AppDomain.CurrentDomain.AssemblyResolve += (sender, args) => 20 | { 21 | String resourceName = "GitUI.Resources." + new AssemblyName(args.Name).Name + ".dll"; 22 | 23 | using (var stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(resourceName)) 24 | { 25 | if (stream == null) return null; 26 | 27 | Byte[] assemblyData = new Byte[stream.Length]; 28 | stream.Read(assemblyData, 0, assemblyData.Length); 29 | return Assembly.Load(assemblyData); 30 | } 31 | }; 32 | 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /GitUI/ICSharpCode.AvalonEdit/CodeCompletion/ICompletionData.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt) 2 | // This code is distributed under the GNU LGPL (for details please see \doc\license.txt) 3 | 4 | using System; 5 | using System.Windows.Media; 6 | using ICSharpCode.AvalonEdit.Document; 7 | using ICSharpCode.AvalonEdit.Editing; 8 | 9 | namespace ICSharpCode.AvalonEdit.CodeCompletion 10 | { 11 | /// 12 | /// Describes an entry in the . 13 | /// 14 | public interface ICompletionData 15 | { 16 | /// 17 | /// Gets the image. 18 | /// 19 | ImageSource Image { get; } 20 | 21 | /// 22 | /// Gets the text. This property is used to filter the list of visible elements. 23 | /// 24 | string Text { get; } 25 | 26 | /// 27 | /// The displayed content. This can be the same as 'Text', or a WPF UIElement if 28 | /// you want to display rich content. 29 | /// 30 | object Content { get; } 31 | 32 | /// 33 | /// Gets the description. 34 | /// 35 | object Description { get; } 36 | 37 | /// 38 | /// Gets the priority. This property is used in the selection logic. You can use it to prefer selecting those items 39 | /// which the user is accessing most frequently. 40 | /// 41 | double Priority { get; } 42 | 43 | /// 44 | /// Perform the completion. 45 | /// 46 | /// The text area on which completion is performed. 47 | /// The text segment that was used by the completion window if 48 | /// the user types (segment between CompletionWindow.StartOffset and CompletionWindow.EndOffset). 49 | /// The EventArgs used for the insertion request. 50 | /// These can be TextCompositionEventArgs, KeyEventArgs, MouseEventArgs, depending on how 51 | /// the insertion was triggered. 52 | void Complete(TextArea textArea, ISegment completionSegment, EventArgs insertionRequestEventArgs); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /GitUI/ICSharpCode.AvalonEdit/CodeCompletion/IOverloadProvider.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt) 2 | // This code is distributed under the GNU LGPL (for details please see \doc\license.txt) 3 | 4 | using System; 5 | using System.Collections.ObjectModel; 6 | using System.ComponentModel; 7 | using System.Windows; 8 | using System.Windows.Controls; 9 | 10 | namespace ICSharpCode.AvalonEdit.CodeCompletion 11 | { 12 | /// 13 | /// Provides the items for the OverloadViewer. 14 | /// 15 | public interface IOverloadProvider : INotifyPropertyChanged 16 | { 17 | /// 18 | /// Gets/Sets the selected index. 19 | /// 20 | int SelectedIndex { get; set; } 21 | 22 | /// 23 | /// Gets the number of overloads. 24 | /// 25 | int Count { get; } 26 | 27 | /// 28 | /// Gets the text 'SelectedIndex of Count'. 29 | /// 30 | string CurrentIndexText { get; } 31 | 32 | /// 33 | /// Gets the current header. 34 | /// 35 | object CurrentHeader { get; } 36 | 37 | /// 38 | /// Gets the current content. 39 | /// 40 | object CurrentContent { get; } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /GitUI/ICSharpCode.AvalonEdit/CodeCompletion/OverloadInsightWindow.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt) 2 | // This code is distributed under the GNU LGPL (for details please see \doc\license.txt) 3 | 4 | using System; 5 | using System.Windows; 6 | using System.Windows.Input; 7 | 8 | using ICSharpCode.AvalonEdit.Editing; 9 | 10 | namespace ICSharpCode.AvalonEdit.CodeCompletion 11 | { 12 | /// 13 | /// Insight window that shows an OverloadViewer. 14 | /// 15 | public class OverloadInsightWindow : InsightWindow 16 | { 17 | OverloadViewer overloadViewer = new OverloadViewer(); 18 | 19 | /// 20 | /// Creates a new OverloadInsightWindow. 21 | /// 22 | public OverloadInsightWindow(TextArea textArea) : base(textArea) 23 | { 24 | overloadViewer.Margin = new Thickness(2,0,0,0); 25 | this.Content = overloadViewer; 26 | } 27 | 28 | /// 29 | /// Gets/Sets the item provider. 30 | /// 31 | public IOverloadProvider Provider { 32 | get { return overloadViewer.Provider; } 33 | set { overloadViewer.Provider = value; } 34 | } 35 | 36 | /// 37 | protected override void OnKeyDown(KeyEventArgs e) 38 | { 39 | base.OnKeyDown(e); 40 | if (!e.Handled && this.Provider.Count > 1) { 41 | switch (e.Key) { 42 | case Key.Up: 43 | e.Handled = true; 44 | overloadViewer.ChangeIndex(-1); 45 | break; 46 | case Key.Down: 47 | e.Handled = true; 48 | overloadViewer.ChangeIndex(+1); 49 | break; 50 | } 51 | if (e.Handled) { 52 | UpdateLayout(); 53 | UpdatePosition(); 54 | } 55 | } 56 | } 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /GitUI/ICSharpCode.AvalonEdit/Document/DocumentChangeOperation.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt) 2 | // This code is distributed under the GNU LGPL (for details please see \doc\license.txt) 3 | 4 | using System; 5 | using System.Diagnostics; 6 | 7 | namespace ICSharpCode.AvalonEdit.Document 8 | { 9 | /// 10 | /// Describes a change to a TextDocument. 11 | /// 12 | sealed class DocumentChangeOperation : IUndoableOperationWithContext 13 | { 14 | TextDocument document; 15 | DocumentChangeEventArgs change; 16 | 17 | public DocumentChangeOperation(TextDocument document, DocumentChangeEventArgs change) 18 | { 19 | this.document = document; 20 | this.change = change; 21 | } 22 | 23 | public void Undo(UndoStack stack) 24 | { 25 | Debug.Assert(stack.state == UndoStack.StatePlayback); 26 | stack.RegisterAffectedDocument(document); 27 | stack.state = UndoStack.StatePlaybackModifyDocument; 28 | this.Undo(); 29 | stack.state = UndoStack.StatePlayback; 30 | } 31 | 32 | public void Redo(UndoStack stack) 33 | { 34 | Debug.Assert(stack.state == UndoStack.StatePlayback); 35 | stack.RegisterAffectedDocument(document); 36 | stack.state = UndoStack.StatePlaybackModifyDocument; 37 | this.Redo(); 38 | stack.state = UndoStack.StatePlayback; 39 | } 40 | 41 | public void Undo() 42 | { 43 | OffsetChangeMap map = change.OffsetChangeMapOrNull; 44 | document.Replace(change.Offset, change.InsertionLength, change.RemovedText, map != null ? map.Invert() : null); 45 | } 46 | 47 | public void Redo() 48 | { 49 | document.Replace(change.Offset, change.RemovalLength, change.InsertedText, change.OffsetChangeMapOrNull); 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /GitUI/ICSharpCode.AvalonEdit/Document/IUndoableOperation.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt) 2 | // This code is distributed under the GNU LGPL (for details please see \doc\license.txt) 3 | 4 | using System; 5 | 6 | namespace ICSharpCode.AvalonEdit.Document 7 | { 8 | /// 9 | /// This Interface describes a the basic Undo/Redo operation 10 | /// all Undo Operations must implement this interface. 11 | /// 12 | public interface IUndoableOperation 13 | { 14 | /// 15 | /// Undo the last operation 16 | /// 17 | void Undo(); 18 | 19 | /// 20 | /// Redo the last operation 21 | /// 22 | void Redo(); 23 | } 24 | 25 | interface IUndoableOperationWithContext : IUndoableOperation 26 | { 27 | void Undo(UndoStack stack); 28 | void Redo(UndoStack stack); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /GitUI/ICSharpCode.AvalonEdit/Document/UndoOperationGroup.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt) 2 | // This code is distributed under the GNU LGPL (for details please see \doc\license.txt) 3 | 4 | using System; 5 | using System.Diagnostics; 6 | using ICSharpCode.AvalonEdit.Utils; 7 | 8 | namespace ICSharpCode.AvalonEdit.Document 9 | { 10 | /// 11 | /// This class stacks the last x operations from the undostack and makes 12 | /// one undo/redo operation from it. 13 | /// 14 | sealed class UndoOperationGroup : IUndoableOperationWithContext 15 | { 16 | IUndoableOperation[] undolist; 17 | 18 | public UndoOperationGroup(Deque stack, int numops) 19 | { 20 | if (stack == null) { 21 | throw new ArgumentNullException("stack"); 22 | } 23 | 24 | Debug.Assert(numops > 0 , "UndoOperationGroup : numops should be > 0"); 25 | Debug.Assert(numops <= stack.Count); 26 | 27 | undolist = new IUndoableOperation[numops]; 28 | for (int i = 0; i < numops; ++i) { 29 | undolist[i] = stack.PopBack(); 30 | } 31 | } 32 | 33 | public void Undo() 34 | { 35 | for (int i = 0; i < undolist.Length; ++i) { 36 | undolist[i].Undo(); 37 | } 38 | } 39 | 40 | public void Undo(UndoStack stack) 41 | { 42 | for (int i = 0; i < undolist.Length; ++i) { 43 | stack.RunUndo(undolist[i]); 44 | } 45 | } 46 | 47 | public void Redo() 48 | { 49 | for (int i = undolist.Length - 1; i >= 0; --i) { 50 | undolist[i].Redo(); 51 | } 52 | } 53 | 54 | public void Redo(UndoStack stack) 55 | { 56 | for (int i = undolist.Length - 1; i >= 0; --i) { 57 | stack.RunRedo(undolist[i]); 58 | } 59 | } 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /GitUI/ICSharpCode.AvalonEdit/Editing/CaretWeakEventHandler.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt) 2 | // This code is distributed under the GNU LGPL (for details please see \doc\license.txt) 3 | 4 | using ICSharpCode.AvalonEdit.Utils; 5 | using System; 6 | 7 | namespace ICSharpCode.AvalonEdit.Editing 8 | { 9 | /// 10 | /// Contains classes for handling weak events on the Caret class. 11 | /// 12 | public static class CaretWeakEventManager 13 | { 14 | /// 15 | /// Handles the Caret.PositionChanged event. 16 | /// 17 | [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible")] 18 | public sealed class PositionChanged : WeakEventManagerBase 19 | { 20 | /// 21 | protected override void StartListening(Caret source) 22 | { 23 | source.PositionChanged += DeliverEvent; 24 | } 25 | 26 | /// 27 | protected override void StopListening(Caret source) 28 | { 29 | source.PositionChanged -= DeliverEvent; 30 | } 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /GitUI/ICSharpCode.AvalonEdit/Editing/DottedLineMargin.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt) 2 | // This code is distributed under the GNU LGPL (for details please see \doc\license.txt) 3 | 4 | using System; 5 | using System.Windows; 6 | using System.Windows.Data; 7 | using System.Windows.Media; 8 | using System.Windows.Shapes; 9 | 10 | namespace ICSharpCode.AvalonEdit.Editing 11 | { 12 | /// 13 | /// Margin for use with the text area. 14 | /// A vertical dotted line to separate the line numbers from the text view. 15 | /// 16 | public static class DottedLineMargin 17 | { 18 | static readonly object tag = new object(); 19 | 20 | /// 21 | /// Creates a vertical dotted line to separate the line numbers from the text view. 22 | /// 23 | public static UIElement Create() 24 | { 25 | Line line = new Line { 26 | X1 = 0, Y1 = 0, X2 = 0, Y2 = 1, 27 | StrokeDashArray = { 0, 2 }, 28 | Stretch = Stretch.Fill, 29 | StrokeThickness = 1, 30 | StrokeDashCap = PenLineCap.Round, 31 | Margin = new Thickness(2, 0, 2, 0), 32 | Tag = tag 33 | }; 34 | 35 | return line; 36 | } 37 | 38 | /// 39 | /// Creates a vertical dotted line to separate the line numbers from the text view. 40 | /// 41 | [Obsolete("This method got published accidentally; and will be removed again in a future version. Use the parameterless overload instead.")] 42 | public static UIElement Create(TextEditor editor) 43 | { 44 | Line line = (Line)Create(); 45 | 46 | line.SetBinding( 47 | Line.StrokeProperty, 48 | new Binding("LineNumbersForeground") { Source = editor } 49 | ); 50 | 51 | return line; 52 | } 53 | 54 | /// 55 | /// Gets whether the specified UIElement is the result of a DottedLineMargin.Create call. 56 | /// 57 | public static bool IsDottedLineMargin(UIElement element) 58 | { 59 | Line l = element as Line; 60 | return l != null && l.Tag == tag; 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /GitUI/ICSharpCode.AvalonEdit/Editing/DragDropException.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt) 2 | // This code is distributed under the GNU LGPL (for details please see \doc\license.txt) 3 | 4 | using System; 5 | using System.Runtime.Serialization; 6 | 7 | namespace ICSharpCode.AvalonEdit.Editing 8 | { 9 | /// 10 | /// Wraps exceptions that occur during drag'n'drop. 11 | /// Exceptions during drag'n'drop might 12 | /// get swallowed by WPF/COM, so AvalonEdit catches them and re-throws them later 13 | /// wrapped in a DragDropException. 14 | /// 15 | [Serializable()] 16 | public class DragDropException : Exception 17 | { 18 | /// 19 | /// Creates a new DragDropException. 20 | /// 21 | public DragDropException() : base() 22 | { 23 | } 24 | 25 | /// 26 | /// Creates a new DragDropException. 27 | /// 28 | public DragDropException(string message) : base(message) 29 | { 30 | } 31 | 32 | /// 33 | /// Creates a new DragDropException. 34 | /// 35 | public DragDropException(string message, Exception innerException) : base(message, innerException) 36 | { 37 | } 38 | 39 | /// 40 | /// Deserializes a DragDropException. 41 | /// 42 | protected DragDropException(SerializationInfo info, StreamingContext context) : base(info, context) 43 | { 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /GitUI/ICSharpCode.AvalonEdit/Editing/IReadOnlySectionProvider.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt) 2 | // This code is distributed under the GNU LGPL (for details please see \doc\license.txt) 3 | 4 | using System; 5 | using System.Collections.Generic; 6 | using ICSharpCode.AvalonEdit.Document; 7 | 8 | namespace ICSharpCode.AvalonEdit.Editing 9 | { 10 | /// 11 | /// Determines whether the document can be modified. 12 | /// 13 | public interface IReadOnlySectionProvider 14 | { 15 | /// 16 | /// Gets whether insertion is possible at the specified offset. 17 | /// 18 | bool CanInsert(int offset); 19 | 20 | /// 21 | /// Gets the deletable segments inside the given segment. 22 | /// 23 | /// 24 | /// All segments in the result must be within the given segment, and they must be returned in order 25 | /// (e.g. if two segments are returned, EndOffset of first segment must be less than StartOffset of second segment). 26 | /// 27 | /// For replacements, the last segment being returned will be replaced with the new text. If an empty list is returned, 28 | /// no replacement will be done. 29 | /// 30 | IEnumerable GetDeletableSegments(ISegment segment); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /GitUI/ICSharpCode.AvalonEdit/Editing/NoReadOnlySections.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt) 2 | // This code is distributed under the GNU LGPL (for details please see \doc\license.txt) 3 | 4 | using System; 5 | using System.Linq; 6 | using System.Collections.Generic; 7 | using ICSharpCode.AvalonEdit.Document; 8 | using ICSharpCode.AvalonEdit.Utils; 9 | 10 | namespace ICSharpCode.AvalonEdit.Editing 11 | { 12 | /// 13 | /// that has no read-only sections; all text is editable. 14 | /// 15 | sealed class NoReadOnlySections : IReadOnlySectionProvider 16 | { 17 | public static readonly NoReadOnlySections Instance = new NoReadOnlySections(); 18 | 19 | public bool CanInsert(int offset) 20 | { 21 | return true; 22 | } 23 | 24 | public IEnumerable GetDeletableSegments(ISegment segment) 25 | { 26 | if (segment == null) 27 | throw new ArgumentNullException("segment"); 28 | // the segment is always deletable 29 | return ExtensionMethods.Sequence(segment); 30 | } 31 | } 32 | 33 | /// 34 | /// that completely disables editing. 35 | /// 36 | sealed class ReadOnlyDocument : IReadOnlySectionProvider 37 | { 38 | public static readonly ReadOnlyDocument Instance = new ReadOnlyDocument(); 39 | 40 | public bool CanInsert(int offset) 41 | { 42 | return false; 43 | } 44 | 45 | public IEnumerable GetDeletableSegments(ISegment segment) 46 | { 47 | return Enumerable.Empty(); 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /GitUI/ICSharpCode.AvalonEdit/Editing/SelectionLayer.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt) 2 | // This code is distributed under the GNU LGPL (for details please see \doc\license.txt) 3 | 4 | using System; 5 | using System.Windows; 6 | using System.Windows.Media; 7 | 8 | using ICSharpCode.AvalonEdit.Rendering; 9 | 10 | namespace ICSharpCode.AvalonEdit.Editing 11 | { 12 | sealed class SelectionLayer : Layer, IWeakEventListener 13 | { 14 | readonly TextArea textArea; 15 | 16 | public SelectionLayer(TextArea textArea) : base(textArea.TextView, KnownLayer.Selection) 17 | { 18 | this.IsHitTestVisible = false; 19 | 20 | this.textArea = textArea; 21 | TextViewWeakEventManager.VisualLinesChanged.AddListener(textView, this); 22 | TextViewWeakEventManager.ScrollOffsetChanged.AddListener(textView, this); 23 | } 24 | 25 | bool IWeakEventListener.ReceiveWeakEvent(Type managerType, object sender, EventArgs e) 26 | { 27 | if (managerType == typeof(TextViewWeakEventManager.VisualLinesChanged) 28 | || managerType == typeof(TextViewWeakEventManager.ScrollOffsetChanged)) 29 | { 30 | InvalidateVisual(); 31 | return true; 32 | } 33 | return false; 34 | } 35 | 36 | protected override void OnRender(DrawingContext drawingContext) 37 | { 38 | base.OnRender(drawingContext); 39 | 40 | BackgroundGeometryBuilder geoBuilder = new BackgroundGeometryBuilder(); 41 | geoBuilder.AlignToMiddleOfPixels = true; 42 | geoBuilder.ExtendToFullWidthAtLineEnd = textArea.Selection.EnableVirtualSpace; 43 | geoBuilder.CornerRadius = textArea.SelectionCornerRadius; 44 | foreach (var segment in textArea.Selection.Segments) { 45 | geoBuilder.AddSegment(textView, segment); 46 | } 47 | Geometry geometry = geoBuilder.CreateGeometry(); 48 | if (geometry != null) { 49 | drawingContext.DrawGeometry(textArea.SelectionBrush, textArea.SelectionBorder, geometry); 50 | } 51 | } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /GitUI/ICSharpCode.AvalonEdit/Folding/AbstractFoldingStrategy.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt) 2 | // This code is distributed under the GNU LGPL (for details please see \doc\license.txt) 3 | 4 | using System; 5 | using ICSharpCode.AvalonEdit.Document; 6 | using System.Collections.Generic; 7 | 8 | namespace ICSharpCode.AvalonEdit.Folding 9 | { 10 | /// 11 | /// Base class for folding strategies. 12 | /// 13 | public abstract class AbstractFoldingStrategy 14 | { 15 | /// 16 | /// Create s for the specified document and updates the folding manager with them. 17 | /// 18 | public void UpdateFoldings(FoldingManager manager, TextDocument document) 19 | { 20 | int firstErrorOffset; 21 | IEnumerable foldings = CreateNewFoldings(document, out firstErrorOffset); 22 | manager.UpdateFoldings(foldings, firstErrorOffset); 23 | } 24 | 25 | /// 26 | /// Create s for the specified document. 27 | /// 28 | public abstract IEnumerable CreateNewFoldings(TextDocument document, out int firstErrorOffset); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /GitUI/ICSharpCode.AvalonEdit/Folding/NewFolding.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt) 2 | // This code is distributed under the GNU LGPL (for details please see \doc\license.txt) 3 | 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Collections.ObjectModel; 7 | using System.Windows; 8 | using System.Windows.Threading; 9 | 10 | using ICSharpCode.AvalonEdit.Document; 11 | using ICSharpCode.AvalonEdit.Editing; 12 | using ICSharpCode.AvalonEdit.Rendering; 13 | using ICSharpCode.AvalonEdit.Utils; 14 | 15 | namespace ICSharpCode.AvalonEdit.Folding 16 | { 17 | /// 18 | /// Helper class used for . 19 | /// 20 | public class NewFolding : ISegment 21 | { 22 | /// 23 | /// Gets/Sets the start offset. 24 | /// 25 | public int StartOffset { get; set; } 26 | 27 | /// 28 | /// Gets/Sets the end offset. 29 | /// 30 | public int EndOffset { get; set; } 31 | 32 | /// 33 | /// Gets/Sets the name displayed for the folding. 34 | /// 35 | public string Name { get; set; } 36 | 37 | /// 38 | /// Gets/Sets whether the folding is closed by default. 39 | /// 40 | public bool DefaultClosed { get; set; } 41 | 42 | /// 43 | /// Creates a new NewFolding instance. 44 | /// 45 | public NewFolding() 46 | { 47 | } 48 | 49 | /// 50 | /// Creates a new NewFolding instance. 51 | /// 52 | public NewFolding(int start, int end) 53 | { 54 | if (!(start <= end)) 55 | throw new ArgumentException("'start' must be less than 'end'"); 56 | this.StartOffset = start; 57 | this.EndOffset = end; 58 | this.Name = null; 59 | this.DefaultClosed = false; 60 | } 61 | 62 | int ISegment.Offset { 63 | get { return this.StartOffset; } 64 | } 65 | 66 | int ISegment.Length { 67 | get { return this.EndOffset - this.StartOffset; } 68 | } 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /GitUI/ICSharpCode.AvalonEdit/Highlighting/HighlightedSection.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt) 2 | // This code is distributed under the GNU LGPL (for details please see \doc\license.txt) 3 | 4 | using System; 5 | using ICSharpCode.AvalonEdit.Document; 6 | 7 | namespace ICSharpCode.AvalonEdit.Highlighting 8 | { 9 | /// 10 | /// A text section with syntax highlighting information. 11 | /// 12 | public class HighlightedSection : ISegment 13 | { 14 | /// 15 | /// Gets/sets the document offset of the section. 16 | /// 17 | public int Offset { get; set; } 18 | 19 | /// 20 | /// Gets/sets the length of the section. 21 | /// 22 | public int Length { get; set; } 23 | 24 | int ISegment.EndOffset { 25 | get { return this.Offset + this.Length; } 26 | } 27 | 28 | /// 29 | /// Gets the highlighting color associated with the highlighted section. 30 | /// 31 | public HighlightingColor Color { get; set; } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /GitUI/ICSharpCode.AvalonEdit/Highlighting/HighlightingDefinitionInvalidException.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt) 2 | // This code is distributed under the GNU LGPL (for details please see \doc\license.txt) 3 | 4 | using System; 5 | using System.Runtime.Serialization; 6 | 7 | namespace ICSharpCode.AvalonEdit.Highlighting 8 | { 9 | /// 10 | /// Indicates that the highlighting definition that was tried to load was invalid. 11 | /// 12 | [Serializable()] 13 | public class HighlightingDefinitionInvalidException : Exception 14 | { 15 | /// 16 | /// Creates a new HighlightingDefinitionInvalidException instance. 17 | /// 18 | public HighlightingDefinitionInvalidException() : base() 19 | { 20 | } 21 | 22 | /// 23 | /// Creates a new HighlightingDefinitionInvalidException instance. 24 | /// 25 | public HighlightingDefinitionInvalidException(string message) : base(message) 26 | { 27 | } 28 | 29 | /// 30 | /// Creates a new HighlightingDefinitionInvalidException instance. 31 | /// 32 | public HighlightingDefinitionInvalidException(string message, Exception innerException) : base(message, innerException) 33 | { 34 | } 35 | 36 | /// 37 | /// Creates a new HighlightingDefinitionInvalidException instance. 38 | /// 39 | protected HighlightingDefinitionInvalidException(SerializationInfo info, StreamingContext context) : base(info, context) 40 | { 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /GitUI/ICSharpCode.AvalonEdit/Highlighting/HighlightingDefinitionTypeConverter.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt) 2 | // This code is distributed under the GNU LGPL (for details please see \doc\license.txt) 3 | 4 | using System; 5 | using System.ComponentModel; 6 | using System.Globalization; 7 | 8 | namespace ICSharpCode.AvalonEdit.Highlighting 9 | { 10 | /// 11 | /// Converts between strings and by treating the string as the definition name 12 | /// and calling HighlightingManager.Instance.GetDefinition(name). 13 | /// 14 | public sealed class HighlightingDefinitionTypeConverter : TypeConverter 15 | { 16 | /// 17 | public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType) 18 | { 19 | if (sourceType == typeof(string)) 20 | return true; 21 | else 22 | return base.CanConvertFrom(context, sourceType); 23 | } 24 | 25 | /// 26 | public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value) 27 | { 28 | string definitionName = value as string; 29 | if (definitionName != null) 30 | return HighlightingManager.Instance.GetDefinition(definitionName); 31 | else 32 | return base.ConvertFrom(context, culture, value); 33 | } 34 | 35 | /// 36 | public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType) 37 | { 38 | if (destinationType == typeof(string)) 39 | return true; 40 | else 41 | return base.CanConvertTo(context, destinationType); 42 | } 43 | 44 | /// 45 | public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType) 46 | { 47 | IHighlightingDefinition definition = value as IHighlightingDefinition; 48 | if (definition != null && destinationType == typeof(string)) 49 | return definition.Name; 50 | else 51 | return base.ConvertTo(context, culture, value, destinationType); 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /GitUI/ICSharpCode.AvalonEdit/Highlighting/HighlightingRule.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt) 2 | // This code is distributed under the GNU LGPL (for details please see \doc\license.txt) 3 | 4 | using System; 5 | using System.Text.RegularExpressions; 6 | 7 | namespace ICSharpCode.AvalonEdit.Highlighting 8 | { 9 | /// 10 | /// A highlighting rule. 11 | /// 12 | [Serializable] 13 | public class HighlightingRule 14 | { 15 | /// 16 | /// Gets/Sets the regular expression for the rule. 17 | /// 18 | public Regex Regex { get; set; } 19 | 20 | /// 21 | /// Gets/Sets the highlighting color. 22 | /// 23 | public HighlightingColor Color { get; set; } 24 | 25 | /// 26 | public override string ToString() 27 | { 28 | return "[" + GetType().Name + " " + Regex + "]"; 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /GitUI/ICSharpCode.AvalonEdit/Highlighting/HighlightingRuleSet.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt) 2 | // This code is distributed under the GNU LGPL (for details please see \doc\license.txt) 3 | 4 | using System; 5 | using System.Collections.Generic; 6 | using ICSharpCode.AvalonEdit.Utils; 7 | 8 | namespace ICSharpCode.AvalonEdit.Highlighting 9 | { 10 | /// 11 | /// A highlighting rule set describes a set of spans that are valid at a given code location. 12 | /// 13 | [Serializable] 14 | public class HighlightingRuleSet 15 | { 16 | /// 17 | /// Creates a new RuleSet instance. 18 | /// 19 | public HighlightingRuleSet() 20 | { 21 | this.Spans = new NullSafeCollection(); 22 | this.Rules = new NullSafeCollection(); 23 | } 24 | 25 | /// 26 | /// Gets/Sets the name of the rule set. 27 | /// 28 | public string Name { get; set; } 29 | 30 | /// 31 | /// Gets the list of spans. 32 | /// 33 | public IList Spans { get; private set; } 34 | 35 | /// 36 | /// Gets the list of rules. 37 | /// 38 | public IList Rules { get; private set; } 39 | 40 | /// 41 | public override string ToString() 42 | { 43 | return "[" + GetType().Name + " " + Name + "]"; 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /GitUI/ICSharpCode.AvalonEdit/Highlighting/HighlightingSpan.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt) 2 | // This code is distributed under the GNU LGPL (for details please see \doc\license.txt) 3 | 4 | using System; 5 | using System.Text.RegularExpressions; 6 | 7 | namespace ICSharpCode.AvalonEdit.Highlighting 8 | { 9 | /// 10 | /// A highlighting span is a region with start+end expression that has a different RuleSet inside 11 | /// and colors the region. 12 | /// 13 | [Serializable] 14 | public class HighlightingSpan 15 | { 16 | /// 17 | /// Gets/Sets the start expression. 18 | /// 19 | public Regex StartExpression { get; set; } 20 | 21 | /// 22 | /// Gets/Sets the end expression. 23 | /// 24 | public Regex EndExpression { get; set; } 25 | 26 | /// 27 | /// Gets/Sets the rule set that applies inside this span. 28 | /// 29 | public HighlightingRuleSet RuleSet { get; set; } 30 | 31 | /// 32 | /// Gets the color used for the text matching the start expression. 33 | /// 34 | public HighlightingColor StartColor { get; set; } 35 | 36 | /// 37 | /// Gets the color used for the text between start and end. 38 | /// 39 | public HighlightingColor SpanColor { get; set; } 40 | 41 | /// 42 | /// Gets the color used for the text matching the end expression. 43 | /// 44 | public HighlightingColor EndColor { get; set; } 45 | 46 | /// 47 | public override string ToString() 48 | { 49 | return "[" + GetType().Name + " Start=" + StartExpression + ", End=" + EndExpression + "]"; 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /GitUI/ICSharpCode.AvalonEdit/Highlighting/IHighlighter.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt) 2 | // This code is distributed under the GNU LGPL (for details please see \doc\license.txt) 3 | 4 | using System; 5 | using ICSharpCode.AvalonEdit.Document; 6 | using ICSharpCode.AvalonEdit.Utils; 7 | 8 | namespace ICSharpCode.AvalonEdit.Highlighting 9 | { 10 | /// 11 | /// Represents a highlighted document. 12 | /// 13 | /// This interface is used by the to register the highlighter as a TextView service. 14 | public interface IHighlighter 15 | { 16 | /// 17 | /// Gets the underlying text document. 18 | /// 19 | TextDocument Document { get; } 20 | 21 | /// 22 | /// Gets the span stack at the end of the specified line. 23 | /// -> GetSpanStack(1) returns the spans at the start of the second line. 24 | /// 25 | /// GetSpanStack(0) is valid and will always return the empty stack. 26 | ImmutableStack GetSpanStack(int lineNumber); 27 | 28 | /// 29 | /// Highlights the specified document line. 30 | /// 31 | /// The line to highlight. 32 | /// A line object that represents the highlighted sections. 33 | HighlightedLine HighlightLine(int lineNumber); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /GitUI/ICSharpCode.AvalonEdit/Highlighting/IHighlightingDefinition.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt) 2 | // This code is distributed under the GNU LGPL (for details please see \doc\license.txt) 3 | 4 | using System; 5 | using System.Collections.Generic; 6 | using System.ComponentModel; 7 | 8 | namespace ICSharpCode.AvalonEdit.Highlighting 9 | { 10 | /// 11 | /// A highlighting definition. 12 | /// 13 | [TypeConverter(typeof(HighlightingDefinitionTypeConverter))] 14 | public interface IHighlightingDefinition 15 | { 16 | /// 17 | /// Gets the name of the highlighting definition. 18 | /// 19 | string Name { get; } 20 | 21 | /// 22 | /// Gets the main rule set. 23 | /// 24 | HighlightingRuleSet MainRuleSet { get; } 25 | 26 | /// 27 | /// Gets a rule set by name. 28 | /// 29 | /// The rule set, or null if it is not found. 30 | HighlightingRuleSet GetNamedRuleSet(string name); 31 | 32 | /// 33 | /// Gets a named highlighting color. 34 | /// 35 | /// The highlighting color, or null if it is not found. 36 | HighlightingColor GetNamedColor(string name); 37 | 38 | /// 39 | /// Gets the list of named highlighting colors. 40 | /// 41 | IEnumerable NamedHighlightingColors { get; } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /GitUI/ICSharpCode.AvalonEdit/Highlighting/IHighlightingDefinitionReferenceResolver.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt) 2 | // This code is distributed under the GNU LGPL (for details please see \doc\license.txt) 3 | 4 | using System; 5 | 6 | namespace ICSharpCode.AvalonEdit.Highlighting 7 | { 8 | /// 9 | /// Interface for resolvers that can solve cross-definition references. 10 | /// 11 | public interface IHighlightingDefinitionReferenceResolver 12 | { 13 | /// 14 | /// Gets the highlighting definition by name, or null if it is not found. 15 | /// 16 | IHighlightingDefinition GetDefinition(string name); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /GitUI/ICSharpCode.AvalonEdit/Highlighting/Resources/ASPX.xshd: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | <% 9 | %> 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /GitUI/ICSharpCode.AvalonEdit/Highlighting/Resources/CSS-Mode.xshd: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | /\* 14 | \*/ 15 | 16 | 20 | \{ 21 | \} 22 | 23 | 24 | \# 25 | \s 26 | 27 | [\d\w] 28 | 29 | 30 | 31 | 32 | /\* 33 | \*/ 34 | 35 | 36 | \: 37 | \;|(?=\}) 38 | 39 | 40 | " 41 | " 42 | 43 | 44 | 45 | 46 | 47 | ' 48 | ' 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | -------------------------------------------------------------------------------- /GitUI/ICSharpCode.AvalonEdit/Highlighting/Resources/Patch-Mode.xshd: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | Index:\s 12 | 13 | 14 | == 15 | 16 | 17 | --- 18 | 19 | 20 | \+\+\+ 21 | 22 | 23 | @@ 24 | 25 | 26 | - 27 | 28 | 29 | \+ 30 | 31 | 32 | \s 33 | 34 | 35 | -------------------------------------------------------------------------------- /GitUI/ICSharpCode.AvalonEdit/Highlighting/Resources/XmlDoc.xshd: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | < 11 | > 12 | 13 | 14 | " 15 | " 16 | 17 | 18 | / 19 | | 20 | = 21 | 22 | 23 | c 24 | code 25 | example 26 | exception 27 | list 28 | para 29 | param 30 | paramref 31 | permission 32 | remarks 33 | returns 34 | see 35 | seealso 36 | summary 37 | value 38 | 39 | type 40 | name 41 | cref 42 | item 43 | term 44 | description 45 | listheader 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /GitUI/ICSharpCode.AvalonEdit/Highlighting/Xshd/IXshdVisitor.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt) 2 | // This code is distributed under the GNU LGPL (for details please see \doc\license.txt) 3 | 4 | using System; 5 | 6 | namespace ICSharpCode.AvalonEdit.Highlighting.Xshd 7 | { 8 | /// 9 | /// A visitor over the XSHD element tree. 10 | /// 11 | public interface IXshdVisitor 12 | { 13 | /// 14 | object VisitRuleSet(XshdRuleSet ruleSet); 15 | 16 | /// 17 | object VisitColor(XshdColor color); 18 | 19 | /// 20 | object VisitKeywords(XshdKeywords keywords); 21 | 22 | /// 23 | object VisitSpan(XshdSpan span); 24 | 25 | /// 26 | [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1716:IdentifiersShouldNotMatchKeywords", Justification = "A VB programmer implementing a visitor?")] 27 | object VisitImport(XshdImport import); 28 | 29 | /// 30 | object VisitRule(XshdRule rule); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /GitUI/ICSharpCode.AvalonEdit/Highlighting/Xshd/XshdElement.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt) 2 | // This code is distributed under the GNU LGPL (for details please see \doc\license.txt) 3 | 4 | using System; 5 | 6 | namespace ICSharpCode.AvalonEdit.Highlighting.Xshd 7 | { 8 | /// 9 | /// An element in a XSHD rule set. 10 | /// 11 | [Serializable] 12 | public abstract class XshdElement 13 | { 14 | /// 15 | /// Gets the line number in the .xshd file. 16 | /// 17 | public int LineNumber { get; set; } 18 | 19 | /// 20 | /// Gets the column number in the .xshd file. 21 | /// 22 | public int ColumnNumber { get; set; } 23 | 24 | /// 25 | /// Applies the visitor to this element. 26 | /// 27 | public abstract object AcceptVisitor(IXshdVisitor visitor); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /GitUI/ICSharpCode.AvalonEdit/Highlighting/Xshd/XshdImport.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt) 2 | // This code is distributed under the GNU LGPL (for details please see \doc\license.txt) 3 | 4 | using System; 5 | 6 | namespace ICSharpCode.AvalonEdit.Highlighting.Xshd 7 | { 8 | /// 9 | /// <Import> element. 10 | /// 11 | [Serializable] 12 | public class XshdImport : XshdElement 13 | { 14 | /// 15 | /// Gets/sets the referenced rule set. 16 | /// 17 | public XshdReference RuleSetReference { get; set; } 18 | 19 | /// 20 | public override object AcceptVisitor(IXshdVisitor visitor) 21 | { 22 | return visitor.VisitImport(this); 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /GitUI/ICSharpCode.AvalonEdit/Highlighting/Xshd/XshdKeywords.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt) 2 | // This code is distributed under the GNU LGPL (for details please see \doc\license.txt) 3 | 4 | using System; 5 | using System.Collections.Generic; 6 | using ICSharpCode.AvalonEdit.Utils; 7 | 8 | namespace ICSharpCode.AvalonEdit.Highlighting.Xshd 9 | { 10 | /// 11 | /// A list of keywords. 12 | /// 13 | [Serializable] 14 | public class XshdKeywords : XshdElement 15 | { 16 | /// 17 | /// The color. 18 | /// 19 | public XshdReference ColorReference { get; set; } 20 | 21 | readonly NullSafeCollection words = new NullSafeCollection(); 22 | 23 | /// 24 | /// Gets the list of key words. 25 | /// 26 | public IList Words { 27 | get { return words; } 28 | } 29 | 30 | /// 31 | public override object AcceptVisitor(IXshdVisitor visitor) 32 | { 33 | return visitor.VisitKeywords(this); 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /GitUI/ICSharpCode.AvalonEdit/Highlighting/Xshd/XshdRule.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt) 2 | // This code is distributed under the GNU LGPL (for details please see \doc\license.txt) 3 | 4 | using System; 5 | 6 | namespace ICSharpCode.AvalonEdit.Highlighting.Xshd 7 | { 8 | /// 9 | /// <Rule> element. 10 | /// 11 | [Serializable] 12 | public class XshdRule : XshdElement 13 | { 14 | /// 15 | /// Gets/sets the rule regex. 16 | /// 17 | public string Regex { get; set; } 18 | 19 | /// 20 | /// Gets/sets the rule regex type. 21 | /// 22 | public XshdRegexType RegexType { get; set; } 23 | 24 | /// 25 | /// Gets/sets the color reference. 26 | /// 27 | public XshdReference ColorReference { get; set; } 28 | 29 | /// 30 | public override object AcceptVisitor(IXshdVisitor visitor) 31 | { 32 | return visitor.VisitRule(this); 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /GitUI/ICSharpCode.AvalonEdit/Highlighting/Xshd/XshdRuleSet.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt) 2 | // This code is distributed under the GNU LGPL (for details please see \doc\license.txt) 3 | 4 | using System; 5 | using System.Collections.Generic; 6 | using ICSharpCode.AvalonEdit.Utils; 7 | 8 | namespace ICSharpCode.AvalonEdit.Highlighting.Xshd 9 | { 10 | /// 11 | /// A rule set in a XSHD file. 12 | /// 13 | [Serializable] 14 | public class XshdRuleSet : XshdElement 15 | { 16 | /// 17 | /// Gets/Sets the name of the rule set. 18 | /// 19 | public string Name { get; set; } 20 | 21 | /// 22 | /// Gets/sets whether the case is ignored in expressions inside this rule set. 23 | /// 24 | public bool? IgnoreCase { get; set; } 25 | 26 | readonly NullSafeCollection elements = new NullSafeCollection(); 27 | 28 | /// 29 | /// Gets the collection of elements. 30 | /// 31 | public IList Elements { 32 | get { return elements; } 33 | } 34 | 35 | /// 36 | /// Applies the visitor to all elements. 37 | /// 38 | public void AcceptElements(IXshdVisitor visitor) 39 | { 40 | foreach (XshdElement element in Elements) { 41 | element.AcceptVisitor(visitor); 42 | } 43 | } 44 | 45 | /// 46 | public override object AcceptVisitor(IXshdVisitor visitor) 47 | { 48 | return visitor.VisitRuleSet(this); 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /GitUI/ICSharpCode.AvalonEdit/Highlighting/Xshd/XshdSyntaxDefinition.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt) 2 | // This code is distributed under the GNU LGPL (for details please see \doc\license.txt) 3 | 4 | using System; 5 | using System.Collections.Generic; 6 | using ICSharpCode.AvalonEdit.Utils; 7 | 8 | namespace ICSharpCode.AvalonEdit.Highlighting.Xshd 9 | { 10 | /// 11 | /// A <SyntaxDefinition> element. 12 | /// 13 | [Serializable] 14 | public class XshdSyntaxDefinition 15 | { 16 | /// 17 | /// Creates a new XshdSyntaxDefinition object. 18 | /// 19 | public XshdSyntaxDefinition() 20 | { 21 | this.Elements = new NullSafeCollection(); 22 | this.Extensions = new NullSafeCollection(); 23 | } 24 | 25 | /// 26 | /// Gets/sets the definition name 27 | /// 28 | public string Name { get; set; } 29 | 30 | /// 31 | /// Gets the associated extensions. 32 | /// 33 | public IList Extensions { get; private set; } 34 | 35 | /// 36 | /// Gets the collection of elements. 37 | /// 38 | public IList Elements { get; private set; } 39 | 40 | /// 41 | /// Applies the visitor to all elements. 42 | /// 43 | public void AcceptElements(IXshdVisitor visitor) 44 | { 45 | foreach (XshdElement element in Elements) { 46 | element.AcceptVisitor(visitor); 47 | } 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /GitUI/ICSharpCode.AvalonEdit/ICSharpCode.AvalonEdit.snk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yysun/Git-Source-Control-Provider/dd8bd933482600f2caf5c2dd935327fbfde8b057/GitUI/ICSharpCode.AvalonEdit/ICSharpCode.AvalonEdit.snk -------------------------------------------------------------------------------- /GitUI/ICSharpCode.AvalonEdit/Indentation/DefaultIndentationStrategy.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt) 2 | // This code is distributed under the GNU LGPL (for details please see \doc\license.txt) 3 | 4 | using ICSharpCode.AvalonEdit.Utils; 5 | using System; 6 | using ICSharpCode.AvalonEdit.Document; 7 | 8 | namespace ICSharpCode.AvalonEdit.Indentation 9 | { 10 | /// 11 | /// Handles indentation by copying the indentation from the previous line. 12 | /// Does not support indenting multiple lines. 13 | /// 14 | public class DefaultIndentationStrategy : IIndentationStrategy 15 | { 16 | /// 17 | public virtual void IndentLine(TextDocument document, DocumentLine line) 18 | { 19 | if (document == null) 20 | throw new ArgumentNullException("document"); 21 | if (line == null) 22 | throw new ArgumentNullException("line"); 23 | DocumentLine previousLine = line.PreviousLine; 24 | if (previousLine != null) { 25 | ISegment indentationSegment = TextUtilities.GetWhitespaceAfter(document, previousLine.Offset); 26 | string indentation = document.GetText(indentationSegment); 27 | // copy indentation to line 28 | indentationSegment = TextUtilities.GetWhitespaceAfter(document, line.Offset); 29 | document.Replace(indentationSegment, indentation); 30 | } 31 | } 32 | 33 | /// 34 | /// Does nothing: indenting multiple lines is useless without a smart indentation strategy. 35 | /// 36 | public virtual void IndentLines(TextDocument document, int beginLine, int endLine) 37 | { 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /GitUI/ICSharpCode.AvalonEdit/Indentation/IIndentationStrategy.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt) 2 | // This code is distributed under the GNU LGPL (for details please see \doc\license.txt) 3 | 4 | using ICSharpCode.AvalonEdit.Document; 5 | using System; 6 | 7 | namespace ICSharpCode.AvalonEdit.Indentation 8 | { 9 | /// 10 | /// Strategy how the text editor handles indentation when new lines are inserted. 11 | /// 12 | public interface IIndentationStrategy 13 | { 14 | /// 15 | /// Sets the indentation for the specified line. 16 | /// Usually this is constructed from the indentation of the previous line. 17 | /// 18 | void IndentLine(TextDocument document, DocumentLine line); 19 | 20 | /// 21 | /// Reindents a set of lines. 22 | /// 23 | void IndentLines(TextDocument document, int beginLine, int endLine); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /GitUI/ICSharpCode.AvalonEdit/Properties/CodeAnalysisDictionary.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Uncollapse 7 | Foldings 8 | Xshd 9 | Utils 10 | Deque 11 | Colorizer 12 | Renderer 13 | Renderers 14 | Deletable 15 | 16 | y 17 | 18 | 19 | 20 | Lineup 21 | 22 | 23 | 24 | Bestest 25 | 26 | 27 | 28 | 29 | 30 | WiX 31 | 32 | 33 | -------------------------------------------------------------------------------- /GitUI/ICSharpCode.AvalonEdit/Rendering/GlobalTextRunProperties.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt) 2 | // This code is distributed under the GNU LGPL (for details please see \doc\license.txt) 3 | 4 | using System; 5 | using System.Windows; 6 | using System.Windows.Media; 7 | using System.Windows.Media.TextFormatting; 8 | 9 | namespace ICSharpCode.AvalonEdit.Rendering 10 | { 11 | sealed class GlobalTextRunProperties : TextRunProperties 12 | { 13 | internal Typeface typeface; 14 | internal double fontRenderingEmSize; 15 | internal Brush foregroundBrush; 16 | internal Brush backgroundBrush; 17 | internal System.Globalization.CultureInfo cultureInfo; 18 | 19 | public override Typeface Typeface { get { return typeface; } } 20 | public override double FontRenderingEmSize { get { return fontRenderingEmSize; } } 21 | public override double FontHintingEmSize { get { return fontRenderingEmSize; } } 22 | public override TextDecorationCollection TextDecorations { get { return null; } } 23 | public override Brush ForegroundBrush { get { return foregroundBrush; } } 24 | public override Brush BackgroundBrush { get { return backgroundBrush; } } 25 | public override System.Globalization.CultureInfo CultureInfo { get { return cultureInfo; } } 26 | public override TextEffectCollection TextEffects { get { return null; } } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /GitUI/ICSharpCode.AvalonEdit/Rendering/HeightTreeLineNode.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt) 2 | // This code is distributed under the GNU LGPL (for details please see \doc\license.txt) 3 | 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Diagnostics; 7 | 8 | namespace ICSharpCode.AvalonEdit.Rendering 9 | { 10 | struct HeightTreeLineNode 11 | { 12 | internal HeightTreeLineNode(double height) 13 | { 14 | this.collapsedSections = null; 15 | this.height = height; 16 | } 17 | 18 | internal double height; 19 | internal List collapsedSections; 20 | 21 | internal bool IsDirectlyCollapsed { 22 | get { return collapsedSections != null; } 23 | } 24 | 25 | internal void AddDirectlyCollapsed(CollapsedLineSection section) 26 | { 27 | if (collapsedSections == null) 28 | collapsedSections = new List(); 29 | collapsedSections.Add(section); 30 | } 31 | 32 | internal void RemoveDirectlyCollapsed(CollapsedLineSection section) 33 | { 34 | Debug.Assert(collapsedSections.Contains(section)); 35 | collapsedSections.Remove(section); 36 | if (collapsedSections.Count == 0) 37 | collapsedSections = null; 38 | } 39 | 40 | /// 41 | /// Returns 0 if the line is directly collapsed, otherwise, returns . 42 | /// 43 | internal double TotalHeight { 44 | get { 45 | return IsDirectlyCollapsed ? 0 : height; 46 | } 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /GitUI/ICSharpCode.AvalonEdit/Rendering/IBackgroundRenderer.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt) 2 | // This code is distributed under the GNU LGPL (for details please see \doc\license.txt) 3 | 4 | using System; 5 | using System.Windows.Media; 6 | 7 | namespace ICSharpCode.AvalonEdit.Rendering 8 | { 9 | /// 10 | /// Background renderers draw in the background of a known layer. 11 | /// You can use background renderers to draw non-interactive elements on the TextView 12 | /// without introducing new UIElements. 13 | /// 14 | public interface IBackgroundRenderer 15 | { 16 | /// 17 | /// Gets the layer on which this background renderer should draw. 18 | /// 19 | KnownLayer Layer { get; } 20 | 21 | /// 22 | /// Causes the background renderer to draw. 23 | /// 24 | void Draw(TextView textView, DrawingContext drawingContext); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /GitUI/ICSharpCode.AvalonEdit/Rendering/ITextRunConstructionContext.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt) 2 | // This code is distributed under the GNU LGPL (for details please see \doc\license.txt) 3 | 4 | using System; 5 | using System.Windows.Media.TextFormatting; 6 | using ICSharpCode.AvalonEdit.Document; 7 | using ICSharpCode.AvalonEdit.Utils; 8 | 9 | namespace ICSharpCode.AvalonEdit.Rendering 10 | { 11 | /// 12 | /// Contains information relevant for text run creation. 13 | /// 14 | public interface ITextRunConstructionContext 15 | { 16 | /// 17 | /// Gets the text document. 18 | /// 19 | TextDocument Document { get; } 20 | 21 | /// 22 | /// Gets the text view for which the construction runs. 23 | /// 24 | TextView TextView { get; } 25 | 26 | /// 27 | /// Gets the visual line that is currently being constructed. 28 | /// 29 | VisualLine VisualLine { get; } 30 | 31 | /// 32 | /// Gets the global text run properties. 33 | /// 34 | TextRunProperties GlobalTextRunProperties { get; } 35 | 36 | /// 37 | /// Gets a piece of text from the document. 38 | /// 39 | /// 40 | /// This method is allowed to return a larger string than requested. 41 | /// It does this by returning a that describes the requested segment within the returned string. 42 | /// This method should be the preferred text access method in the text transformation pipeline, as it can avoid repeatedly allocating string instances 43 | /// for text within the same line. 44 | /// 45 | StringSegment GetText(int offset, int length); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /GitUI/ICSharpCode.AvalonEdit/Rendering/ITextViewConnect.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt) 2 | // This code is distributed under the GNU LGPL (for details please see \doc\license.txt) 3 | 4 | using System; 5 | 6 | namespace ICSharpCode.AvalonEdit.Rendering 7 | { 8 | /// 9 | /// Allows s, s and 10 | /// s to be notified when they are added or removed from a text view. 11 | /// 12 | public interface ITextViewConnect 13 | { 14 | /// 15 | /// Called when added to a text view. 16 | /// 17 | void AddToTextView(TextView textView); 18 | 19 | /// 20 | /// Called when removed from a text view. 21 | /// 22 | void RemoveFromTextView(TextView textView); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /GitUI/ICSharpCode.AvalonEdit/Rendering/IVisualLineTransformer.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt) 2 | // This code is distributed under the GNU LGPL (for details please see \doc\license.txt) 3 | 4 | using System; 5 | using System.Collections.Generic; 6 | 7 | namespace ICSharpCode.AvalonEdit.Rendering 8 | { 9 | /// 10 | /// Allows transforming visual line elements. 11 | /// 12 | public interface IVisualLineTransformer 13 | { 14 | /// 15 | /// Applies the transformation to the specified list of visual line elements. 16 | /// 17 | void Transform(ITextRunConstructionContext context, IList elements); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /GitUI/ICSharpCode.AvalonEdit/Rendering/Layer.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt) 2 | // This code is distributed under the GNU LGPL (for details please see \doc\license.txt) 3 | 4 | using System; 5 | using System.Diagnostics; 6 | using System.Windows; 7 | using System.Windows.Media; 8 | 9 | namespace ICSharpCode.AvalonEdit.Rendering 10 | { 11 | /// 12 | /// Base class for known layers. 13 | /// 14 | class Layer : UIElement 15 | { 16 | protected readonly TextView textView; 17 | protected readonly KnownLayer knownLayer; 18 | 19 | public Layer(TextView textView, KnownLayer knownLayer) 20 | { 21 | Debug.Assert(textView != null); 22 | this.textView = textView; 23 | this.knownLayer = knownLayer; 24 | this.Focusable = false; 25 | } 26 | 27 | protected override GeometryHitTestResult HitTestCore(GeometryHitTestParameters hitTestParameters) 28 | { 29 | return null; 30 | } 31 | 32 | protected override HitTestResult HitTestCore(PointHitTestParameters hitTestParameters) 33 | { 34 | return null; 35 | } 36 | 37 | protected override void OnRender(DrawingContext drawingContext) 38 | { 39 | base.OnRender(drawingContext); 40 | textView.RenderBackground(drawingContext, knownLayer); 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /GitUI/ICSharpCode.AvalonEdit/Rendering/SimpleTextSource.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt) 2 | // This code is distributed under the GNU LGPL (for details please see \doc\license.txt) 3 | 4 | using System; 5 | using System.Diagnostics; 6 | using System.Windows.Media.TextFormatting; 7 | 8 | namespace ICSharpCode.AvalonEdit.Rendering 9 | { 10 | sealed class SimpleTextSource : TextSource 11 | { 12 | readonly string text; 13 | readonly TextRunProperties properties; 14 | 15 | public SimpleTextSource(string text, TextRunProperties properties) 16 | { 17 | this.text = text; 18 | this.properties = properties; 19 | } 20 | 21 | public override TextRun GetTextRun(int textSourceCharacterIndex) 22 | { 23 | if (textSourceCharacterIndex < text.Length) 24 | return new TextCharacters(text, textSourceCharacterIndex, text.Length - textSourceCharacterIndex, properties); 25 | else 26 | return new TextEndOfParagraph(1); 27 | } 28 | 29 | public override int GetTextEffectCharacterIndexFromTextSourceCharacterIndex(int textSourceCharacterIndex) 30 | { 31 | throw new NotImplementedException(); 32 | } 33 | 34 | public override TextSpan GetPrecedingText(int textSourceCharacterIndexLimit) 35 | { 36 | throw new NotImplementedException(); 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /GitUI/ICSharpCode.AvalonEdit/Rendering/TextViewCachedElements.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt) 2 | // This code is distributed under the GNU LGPL (for details please see \doc\license.txt) 3 | 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Windows.Media; 7 | using System.Windows.Media.TextFormatting; 8 | using ICSharpCode.AvalonEdit.Utils; 9 | 10 | namespace ICSharpCode.AvalonEdit.Rendering 11 | { 12 | sealed class TextViewCachedElements : IDisposable 13 | { 14 | TextFormatter formatter; 15 | Dictionary nonPrintableCharacterTexts; 16 | 17 | public TextLine GetTextForNonPrintableCharacter(string text, ITextRunConstructionContext context) 18 | { 19 | if (nonPrintableCharacterTexts == null) 20 | nonPrintableCharacterTexts = new Dictionary(); 21 | TextLine textLine; 22 | if (!nonPrintableCharacterTexts.TryGetValue(text, out textLine)) { 23 | var p = new VisualLineElementTextRunProperties(context.GlobalTextRunProperties); 24 | p.SetForegroundBrush(context.TextView.NonPrintableCharacterBrush); 25 | if (formatter == null) 26 | formatter = TextFormatterFactory.Create(context.TextView); 27 | textLine = FormattedTextElement.PrepareText(formatter, text, p); 28 | nonPrintableCharacterTexts[text] = textLine; 29 | } 30 | return textLine; 31 | } 32 | 33 | public void Dispose() 34 | { 35 | if (nonPrintableCharacterTexts != null) { 36 | foreach (TextLine line in nonPrintableCharacterTexts.Values) 37 | line.Dispose(); 38 | } 39 | if (formatter != null) 40 | formatter.Dispose(); 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /GitUI/ICSharpCode.AvalonEdit/Rendering/VisualLineConstructionStartEventArgs.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt) 2 | // This code is distributed under the GNU LGPL (for details please see \doc\license.txt) 3 | 4 | using System; 5 | using ICSharpCode.AvalonEdit.Document; 6 | 7 | namespace ICSharpCode.AvalonEdit.Rendering 8 | { 9 | /// 10 | /// EventArgs for the event. 11 | /// 12 | public class VisualLineConstructionStartEventArgs : EventArgs 13 | { 14 | /// 15 | /// Gets/Sets the first line that is visible in the TextView. 16 | /// 17 | public DocumentLine FirstLineInView { get; private set; } 18 | 19 | /// 20 | /// Creates a new VisualLineConstructionStartEventArgs instance. 21 | /// 22 | public VisualLineConstructionStartEventArgs(DocumentLine firstLineInView) 23 | { 24 | if (firstLineInView == null) 25 | throw new ArgumentNullException("firstLineInView"); 26 | this.FirstLineInView = firstLineInView; 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /GitUI/ICSharpCode.AvalonEdit/Rendering/VisualLineTextParagraphProperties.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt) 2 | // This code is distributed under the GNU LGPL (for details please see \doc\license.txt) 3 | 4 | using System; 5 | using System.Windows; 6 | using System.Windows.Media.TextFormatting; 7 | 8 | namespace ICSharpCode.AvalonEdit.Rendering 9 | { 10 | sealed class VisualLineTextParagraphProperties : TextParagraphProperties 11 | { 12 | internal TextRunProperties defaultTextRunProperties; 13 | internal TextWrapping textWrapping; 14 | internal double tabSize; 15 | internal double indent; 16 | internal bool firstLineInParagraph; 17 | 18 | public override double DefaultIncrementalTab { 19 | get { return tabSize; } 20 | } 21 | 22 | public override FlowDirection FlowDirection { get { return FlowDirection.LeftToRight; } } 23 | public override TextAlignment TextAlignment { get { return TextAlignment.Left; } } 24 | public override double LineHeight { get { return double.NaN; } } 25 | public override bool FirstLineInParagraph { get { return firstLineInParagraph; } } 26 | public override TextRunProperties DefaultTextRunProperties { get { return defaultTextRunProperties; } } 27 | public override TextWrapping TextWrapping { get { return textWrapping; } } 28 | public override TextMarkerProperties TextMarkerProperties { get { return null; } } 29 | public override double Indent { get { return indent; } } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /GitUI/ICSharpCode.AvalonEdit/Rendering/VisualLinesInvalidException.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt) 2 | // This code is distributed under the GNU LGPL (for details please see \doc\license.txt) 3 | 4 | using System; 5 | using System.Runtime.Serialization; 6 | 7 | namespace ICSharpCode.AvalonEdit.Rendering 8 | { 9 | /// 10 | /// A VisualLinesInvalidException indicates that you accessed the property 11 | /// of the while the visual lines were invalid. 12 | /// 13 | [Serializable] 14 | public class VisualLinesInvalidException : Exception 15 | { 16 | /// 17 | /// Creates a new VisualLinesInvalidException instance. 18 | /// 19 | public VisualLinesInvalidException() : base() 20 | { 21 | } 22 | 23 | /// 24 | /// Creates a new VisualLinesInvalidException instance. 25 | /// 26 | public VisualLinesInvalidException(string message) : base(message) 27 | { 28 | } 29 | 30 | /// 31 | /// Creates a new VisualLinesInvalidException instance. 32 | /// 33 | public VisualLinesInvalidException(string message, Exception innerException) : base(message, innerException) 34 | { 35 | } 36 | 37 | /// 38 | /// Creates a new VisualLinesInvalidException instance. 39 | /// 40 | protected VisualLinesInvalidException(SerializationInfo info, StreamingContext context) : base(info, context) 41 | { 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /GitUI/ICSharpCode.AvalonEdit/Rendering/VisualYPosition.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt) 2 | // This code is distributed under the GNU LGPL (for details please see \doc\license.txt) 3 | 4 | using System; 5 | 6 | namespace ICSharpCode.AvalonEdit.Rendering 7 | { 8 | /// 9 | /// An enum that specifies the possible Y positions that can be returned by VisualLine.GetVisualPosition. 10 | /// 11 | public enum VisualYPosition 12 | { 13 | /// 14 | /// Returns the top of the TextLine. 15 | /// 16 | LineTop, 17 | /// 18 | /// Returns the top of the text. If the line contains inline UI elements larger than the text, TextTop 19 | /// will be below LineTop. 20 | /// 21 | TextTop, 22 | /// 23 | /// Returns the bottom of the TextLine. This is the same as the bottom of the text (the text is always 24 | /// aligned at the bottom border). 25 | /// 26 | LineBottom, 27 | /// 28 | /// The middle between LineTop and LineBottom. 29 | /// 30 | LineMiddle 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /GitUI/ICSharpCode.AvalonEdit/Search/Localization.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt) 2 | // This code is distributed under the GNU LGPL (for details please see \doc\license.txt) 3 | 4 | using System; 5 | using System.ComponentModel; 6 | 7 | namespace ICSharpCode.AvalonEdit.Search 8 | { 9 | /// 10 | /// Holds default texts for buttons and labels in the SearchPanel. Override properties to add other languages. 11 | /// 12 | public class Localization 13 | { 14 | /// 15 | /// Default: 'Match case' 16 | /// 17 | public virtual string MatchCaseText { 18 | get { return "Match case"; } 19 | } 20 | 21 | /// 22 | /// Default: 'Match whole words' 23 | /// 24 | public virtual string MatchWholeWordsText { 25 | get { return "Match whole words"; } 26 | } 27 | 28 | 29 | /// 30 | /// Default: 'Use regular expressions' 31 | /// 32 | public virtual string UseRegexText { 33 | get { return "Use regular expressions"; } 34 | } 35 | 36 | /// 37 | /// Default: 'Find next (F3)' 38 | /// 39 | public virtual string FindNextText { 40 | get { return "Find next (F3)"; } 41 | } 42 | 43 | /// 44 | /// Default: 'Find previous (Shift+F3)' 45 | /// 46 | public virtual string FindPreviousText { 47 | get { return "Find previous (Shift+F3)"; } 48 | } 49 | 50 | /// 51 | /// Default: 'Error: ' 52 | /// 53 | public virtual string ErrorText { 54 | get { return "Error: "; } 55 | } 56 | 57 | /// 58 | /// Default: 'No matches found!' 59 | /// 60 | public virtual string NoMatchesFoundText { 61 | get { return "No matches found!"; } 62 | } 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /GitUI/ICSharpCode.AvalonEdit/Search/RegexSearchStrategy.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt) 2 | // This code is distributed under the GNU LGPL (for details please see \doc\license.txt) 3 | 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Text.RegularExpressions; 9 | 10 | using ICSharpCode.AvalonEdit.Document; 11 | 12 | namespace ICSharpCode.AvalonEdit.Search 13 | { 14 | class RegexSearchStrategy : ISearchStrategy 15 | { 16 | readonly Regex searchPattern; 17 | 18 | public RegexSearchStrategy(Regex searchPattern) 19 | { 20 | if (searchPattern == null) 21 | throw new ArgumentNullException("searchPattern"); 22 | this.searchPattern = searchPattern; 23 | } 24 | 25 | public IEnumerable FindAll(ITextSource document, int offset, int length) 26 | { 27 | int endOffset = offset + length; 28 | foreach (Match result in searchPattern.Matches(document.Text)) { 29 | if (offset <= result.Index && endOffset >= (result.Length + result.Index)) 30 | yield return new SearchResult { StartOffset = result.Index, Length = result.Length, Data = result }; 31 | } 32 | } 33 | 34 | public ISearchResult FindNext(ITextSource document, int offset, int length) 35 | { 36 | return FindAll(document, offset, length).FirstOrDefault(); 37 | } 38 | 39 | public bool Equals(ISearchStrategy other) 40 | { 41 | var strategy = other as RegexSearchStrategy; 42 | return strategy != null && 43 | strategy.searchPattern.ToString() == searchPattern.ToString() && 44 | strategy.searchPattern.Options == searchPattern.Options && 45 | strategy.searchPattern.RightToLeft == searchPattern.RightToLeft; 46 | } 47 | } 48 | 49 | class SearchResult : TextSegment, ISearchResult 50 | { 51 | public Match Data { get; set; } 52 | 53 | public string ReplaceWith(string replacement) 54 | { 55 | return Data.Result(replacement); 56 | } 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /GitUI/ICSharpCode.AvalonEdit/Search/next.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yysun/Git-Source-Control-Provider/dd8bd933482600f2caf5c2dd935327fbfde8b057/GitUI/ICSharpCode.AvalonEdit/Search/next.png -------------------------------------------------------------------------------- /GitUI/ICSharpCode.AvalonEdit/Search/prev.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yysun/Git-Source-Control-Provider/dd8bd933482600f2caf5c2dd935327fbfde8b057/GitUI/ICSharpCode.AvalonEdit/Search/prev.png -------------------------------------------------------------------------------- /GitUI/ICSharpCode.AvalonEdit/Snippets/IActiveElement.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt) 2 | // This code is distributed under the GNU LGPL (for details please see \doc\license.txt) 3 | 4 | using System; 5 | using System.Windows.Media; 6 | using ICSharpCode.AvalonEdit.Document; 7 | 8 | namespace ICSharpCode.AvalonEdit.Snippets 9 | { 10 | /// 11 | /// Represents an active element that allows the snippet to stay interactive after insertion. 12 | /// 13 | public interface IActiveElement 14 | { 15 | /// 16 | /// Called when the all snippet elements have been inserted. 17 | /// 18 | void OnInsertionCompleted(); 19 | 20 | /// 21 | /// Called when the interactive mode is deactivated. 22 | /// 23 | void Deactivate(SnippetEventArgs e); 24 | 25 | /// 26 | /// Gets whether this element is editable (the user will be able to select it with Tab). 27 | /// 28 | bool IsEditable { get; } 29 | 30 | /// 31 | /// Gets the segment associated with this element. May be null. 32 | /// 33 | ISegment Segment { get; } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /GitUI/ICSharpCode.AvalonEdit/Snippets/Snippet.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt) 2 | // This code is distributed under the GNU LGPL (for details please see \doc\license.txt) 3 | 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Windows.Documents; 7 | 8 | using ICSharpCode.AvalonEdit.Document; 9 | using ICSharpCode.AvalonEdit.Editing; 10 | using ICSharpCode.AvalonEdit.Utils; 11 | 12 | namespace ICSharpCode.AvalonEdit.Snippets 13 | { 14 | /// 15 | /// A code snippet that can be inserted into the text editor. 16 | /// 17 | [Serializable] 18 | public class Snippet : SnippetContainerElement 19 | { 20 | /// 21 | /// Inserts the snippet into the text area. 22 | /// 23 | public void Insert(TextArea textArea) 24 | { 25 | if (textArea == null) 26 | throw new ArgumentNullException("textArea"); 27 | 28 | ISegment selection = textArea.Selection.SurroundingSegment; 29 | int insertionPosition = textArea.Caret.Offset; 30 | 31 | if (selection != null) // if something is selected 32 | // use selection start instead of caret position, 33 | // because caret could be at end of selection or anywhere inside. 34 | // Removal of the selected text causes the caret position to be invalid. 35 | insertionPosition = selection.Offset + TextUtilities.GetWhitespaceAfter(textArea.Document, selection.Offset).Length; 36 | 37 | InsertionContext context = new InsertionContext(textArea, insertionPosition); 38 | 39 | using (context.Document.RunUpdate()) { 40 | if (selection != null) 41 | textArea.Document.Remove(insertionPosition, selection.EndOffset - insertionPosition); 42 | Insert(context); 43 | context.RaiseInsertionCompleted(EventArgs.Empty); 44 | } 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /GitUI/ICSharpCode.AvalonEdit/Snippets/SnippetCaretElement.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt) 2 | // This code is distributed under the GNU LGPL (for details please see \doc\license.txt) 3 | 4 | using System; 5 | using System.Windows.Input; 6 | using ICSharpCode.AvalonEdit.Document; 7 | 8 | namespace ICSharpCode.AvalonEdit.Snippets 9 | { 10 | /// 11 | /// Sets the caret position after interactive mode has finished. 12 | /// 13 | [Serializable] 14 | public class SnippetCaretElement : SnippetElement 15 | { 16 | /// 17 | public override void Insert(InsertionContext context) 18 | { 19 | if (!string.IsNullOrEmpty(context.SelectedText)) 20 | SetCaret(context); 21 | } 22 | 23 | internal static void SetCaret(InsertionContext context) 24 | { 25 | TextAnchor pos = context.Document.CreateAnchor(context.InsertionPosition); 26 | pos.MovementType = AnchorMovementType.BeforeInsertion; 27 | pos.SurviveDeletion = true; 28 | context.Deactivated += (sender, e) => { 29 | if (e.Reason == DeactivateReason.ReturnPressed || e.Reason == DeactivateReason.NoActiveElements) { 30 | context.TextArea.Caret.Offset = pos.Offset; 31 | } 32 | }; 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /GitUI/ICSharpCode.AvalonEdit/Snippets/SnippetContainerElement.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt) 2 | // This code is distributed under the GNU LGPL (for details please see \doc\license.txt) 3 | 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Text; 7 | using System.Windows.Documents; 8 | 9 | using ICSharpCode.AvalonEdit.Editing; 10 | using ICSharpCode.AvalonEdit.Utils; 11 | 12 | namespace ICSharpCode.AvalonEdit.Snippets 13 | { 14 | /// 15 | /// A snippet element that has sub-elements. 16 | /// 17 | [Serializable] 18 | public class SnippetContainerElement : SnippetElement 19 | { 20 | NullSafeCollection elements = new NullSafeCollection(); 21 | 22 | /// 23 | /// Gets the list of child elements. 24 | /// 25 | public IList Elements { 26 | get { return elements; } 27 | } 28 | 29 | /// 30 | public override void Insert(InsertionContext context) 31 | { 32 | foreach (SnippetElement e in this.Elements) { 33 | e.Insert(context); 34 | } 35 | } 36 | 37 | /// 38 | public override Inline ToTextRun() 39 | { 40 | Span span = new Span(); 41 | foreach (SnippetElement e in this.Elements) { 42 | Inline r = e.ToTextRun(); 43 | if (r != null) 44 | span.Inlines.Add(r); 45 | } 46 | return span; 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /GitUI/ICSharpCode.AvalonEdit/Snippets/SnippetElement.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt) 2 | // This code is distributed under the GNU LGPL (for details please see \doc\license.txt) 3 | 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Windows.Documents; 7 | 8 | using ICSharpCode.AvalonEdit.Editing; 9 | using ICSharpCode.AvalonEdit.Utils; 10 | 11 | namespace ICSharpCode.AvalonEdit.Snippets 12 | { 13 | /// 14 | /// An element inside a snippet. 15 | /// 16 | [Serializable] 17 | public abstract class SnippetElement 18 | { 19 | /// 20 | /// Performs insertion of the snippet. 21 | /// 22 | public abstract void Insert(InsertionContext context); 23 | 24 | /// 25 | /// Converts the snippet to text, with replaceable fields in italic. 26 | /// 27 | public virtual Inline ToTextRun() 28 | { 29 | return null; 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /GitUI/ICSharpCode.AvalonEdit/Snippets/SnippetEventArgs.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt) 2 | // This code is distributed under the GNU LGPL (for details please see \doc\license.txt) 3 | 4 | using System; 5 | 6 | namespace ICSharpCode.AvalonEdit.Snippets 7 | { 8 | /// 9 | /// Provides information about the event that occured during use of snippets. 10 | /// 11 | public class SnippetEventArgs : EventArgs 12 | { 13 | /// 14 | /// Gets the reason for deactivation. 15 | /// 16 | public DeactivateReason Reason { get; private set; } 17 | 18 | /// 19 | /// Creates a new SnippetEventArgs object, with a DeactivateReason. 20 | /// 21 | public SnippetEventArgs(DeactivateReason reason) 22 | { 23 | this.Reason = reason; 24 | } 25 | } 26 | 27 | /// 28 | /// Describes the reason for deactivation of a . 29 | /// 30 | public enum DeactivateReason 31 | { 32 | /// 33 | /// Unknown reason. 34 | /// 35 | Unknown, 36 | /// 37 | /// Snippet was deleted. 38 | /// 39 | Deleted, 40 | /// 41 | /// There are no active elements in the snippet. 42 | /// 43 | NoActiveElements, 44 | /// 45 | /// The SnippetInputHandler was detached. 46 | /// 47 | InputHandlerDetached, 48 | /// 49 | /// Return was pressed by the user. 50 | /// 51 | ReturnPressed, 52 | /// 53 | /// Escape was pressed by the user. 54 | /// 55 | EscapePressed 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /GitUI/ICSharpCode.AvalonEdit/Snippets/SnippetSelectionElement.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt) 2 | // This code is distributed under the GNU LGPL (for details please see \doc\license.txt) 3 | 4 | using System; 5 | using System.Text; 6 | using System.Windows.Input; 7 | using ICSharpCode.AvalonEdit.Document; 8 | 9 | namespace ICSharpCode.AvalonEdit.Snippets 10 | { 11 | /// 12 | /// Inserts the previously selected text at the selection marker. 13 | /// 14 | [Serializable] 15 | public class SnippetSelectionElement : SnippetElement 16 | { 17 | /// 18 | /// Gets/Sets the new indentation of the selected text. 19 | /// 20 | public int Indentation { get; set; } 21 | 22 | /// 23 | public override void Insert(InsertionContext context) 24 | { 25 | StringBuilder tabString = new StringBuilder(); 26 | 27 | for (int i = 0; i < Indentation; i++) { 28 | tabString.Append(context.Tab); 29 | } 30 | 31 | string indent = tabString.ToString(); 32 | 33 | string text = context.SelectedText.TrimStart(' ', '\t'); 34 | 35 | text = text.Replace(context.LineTerminator, 36 | context.LineTerminator + indent); 37 | 38 | context.Document.Insert(context.InsertionPosition, text); 39 | context.InsertionPosition += text.Length; 40 | 41 | if (string.IsNullOrEmpty(context.SelectedText)) 42 | SnippetCaretElement.SetCaret(context); 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /GitUI/ICSharpCode.AvalonEdit/Snippets/SnippetTextElement.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt) 2 | // This code is distributed under the GNU LGPL (for details please see \doc\license.txt) 3 | 4 | using System; 5 | using System.Windows.Documents; 6 | using ICSharpCode.AvalonEdit.Document; 7 | 8 | namespace ICSharpCode.AvalonEdit.Snippets 9 | { 10 | /// 11 | /// Represents a text element in a snippet. 12 | /// 13 | [Serializable] 14 | public class SnippetTextElement : SnippetElement 15 | { 16 | string text; 17 | 18 | /// 19 | /// The text to be inserted. 20 | /// 21 | public string Text { 22 | get { return text; } 23 | set { text = value; } 24 | } 25 | 26 | /// 27 | public override void Insert(InsertionContext context) 28 | { 29 | if (text != null) 30 | context.InsertText(text); 31 | } 32 | 33 | /// 34 | public override Inline ToTextRun() 35 | { 36 | return new Run(text ?? string.Empty); 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /GitUI/ICSharpCode.AvalonEdit/TextEditorAutomationPeer.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt) 2 | // This code is distributed under the GNU LGPL (for details please see \doc\license.txt) 3 | 4 | using System; 5 | using System.Diagnostics; 6 | using System.Windows.Automation; 7 | using System.Windows.Automation.Peers; 8 | using System.Windows.Automation.Provider; 9 | using System.Windows.Controls; 10 | 11 | using ICSharpCode.AvalonEdit.Utils; 12 | 13 | namespace ICSharpCode.AvalonEdit 14 | { 15 | /// 16 | /// Exposes to automation. 17 | /// 18 | public class TextEditorAutomationPeer : FrameworkElementAutomationPeer, IValueProvider 19 | { 20 | /// 21 | /// Creates a new TextEditorAutomationPeer instance. 22 | /// 23 | public TextEditorAutomationPeer(TextEditor owner) : base(owner) 24 | { 25 | Debug.WriteLine("TextEditorAutomationPeer was created"); 26 | } 27 | 28 | private TextEditor TextEditor { 29 | get { return (TextEditor)base.Owner; } 30 | } 31 | 32 | void IValueProvider.SetValue(string value) 33 | { 34 | this.TextEditor.Text = value; 35 | } 36 | 37 | string IValueProvider.Value { 38 | get { return this.TextEditor.Text; } 39 | } 40 | 41 | bool IValueProvider.IsReadOnly { 42 | get { return this.TextEditor.IsReadOnly; } 43 | } 44 | 45 | /// 46 | public override object GetPattern(PatternInterface patternInterface) 47 | { 48 | if (patternInterface == PatternInterface.Value) 49 | return this; 50 | 51 | if (patternInterface == PatternInterface.Scroll) { 52 | ScrollViewer scrollViewer = this.TextEditor.ScrollViewer; 53 | if (scrollViewer != null) 54 | return UIElementAutomationPeer.CreatePeerForElement(scrollViewer); 55 | } 56 | 57 | return base.GetPattern(patternInterface); 58 | } 59 | 60 | internal void RaiseIsReadOnlyChanged(bool oldValue, bool newValue) 61 | { 62 | RaisePropertyChangedEvent(ValuePatternIdentifiers.IsReadOnlyProperty, Boxes.Box(oldValue), Boxes.Box(newValue)); 63 | } 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /GitUI/ICSharpCode.AvalonEdit/TextEditorComponent.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt) 2 | // This code is distributed under the GNU LGPL (for details please see \doc\license.txt) 3 | 4 | using System; 5 | using System.ComponentModel; 6 | using ICSharpCode.AvalonEdit.Document; 7 | using ICSharpCode.AvalonEdit.Editing; 8 | using ICSharpCode.AvalonEdit.Rendering; 9 | 10 | namespace ICSharpCode.AvalonEdit 11 | { 12 | /// 13 | /// Represents a text editor control (, 14 | /// or ). 15 | /// 16 | public interface ITextEditorComponent : IServiceProvider 17 | { 18 | /// 19 | /// Gets the document being edited. 20 | /// 21 | TextDocument Document { get; } 22 | 23 | /// 24 | /// Occurs when the Document property changes (when the text editor is connected to another 25 | /// document - not when the document content changes). 26 | /// 27 | event EventHandler DocumentChanged; 28 | 29 | /// 30 | /// Gets the options of the text editor. 31 | /// 32 | TextEditorOptions Options { get; } 33 | 34 | /// 35 | /// Occurs when the Options property changes, or when an option inside the current option list 36 | /// changes. 37 | /// 38 | event PropertyChangedEventHandler OptionChanged; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /GitUI/ICSharpCode.AvalonEdit/TextEditorWeakEventManager.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt) 2 | // This code is distributed under the GNU LGPL (for details please see \doc\license.txt) 3 | 4 | using ICSharpCode.AvalonEdit.Utils; 5 | using System; 6 | 7 | namespace ICSharpCode.AvalonEdit 8 | { 9 | /// 10 | /// Contains weak event managers for . 11 | /// 12 | public static class TextEditorWeakEventManager 13 | { 14 | /// 15 | /// Weak event manager for the event. 16 | /// 17 | [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible")] 18 | public sealed class DocumentChanged : WeakEventManagerBase 19 | { 20 | /// 21 | protected override void StartListening(ITextEditorComponent source) 22 | { 23 | source.DocumentChanged += DeliverEvent; 24 | } 25 | 26 | /// 27 | protected override void StopListening(ITextEditorComponent source) 28 | { 29 | source.DocumentChanged -= DeliverEvent; 30 | } 31 | } 32 | 33 | /// 34 | /// Weak event manager for the event. 35 | /// 36 | [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1034:NestedTypesShouldNotBeVisible")] 37 | public sealed class OptionChanged : WeakEventManagerBase 38 | { 39 | /// 40 | protected override void StartListening(ITextEditorComponent source) 41 | { 42 | source.OptionChanged += DeliverEvent; 43 | } 44 | 45 | /// 46 | protected override void StopListening(ITextEditorComponent source) 47 | { 48 | source.OptionChanged -= DeliverEvent; 49 | } 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /GitUI/ICSharpCode.AvalonEdit/Utils/Boxes.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt) 2 | // This code is distributed under the GNU LGPL (for details please see \doc\license.txt) 3 | 4 | using System; 5 | 6 | namespace ICSharpCode.AvalonEdit.Utils 7 | { 8 | /// 9 | /// Reuse the same instances for boxed booleans. 10 | /// 11 | static class Boxes 12 | { 13 | public static readonly object True = true; 14 | public static readonly object False = false; 15 | 16 | public static object Box(bool value) 17 | { 18 | return value ? True : False; 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /GitUI/ICSharpCode.AvalonEdit/Utils/BusyManager.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt) 2 | // This code is distributed under the GNU LGPL (for details please see \doc\license.txt) 3 | 4 | using System; 5 | using System.Collections.Generic; 6 | 7 | namespace ICSharpCode.AvalonEdit.Utils 8 | { 9 | /// 10 | /// This class is used to prevent stack overflows by representing a 'busy' flag 11 | /// that prevents reentrance when another call is running. 12 | /// However, using a simple 'bool busy' is not thread-safe, so we use a 13 | /// thread-static BusyManager. 14 | /// 15 | static class BusyManager 16 | { 17 | public struct BusyLock : IDisposable 18 | { 19 | public static readonly BusyLock Failed = new BusyLock(null); 20 | 21 | readonly List objectList; 22 | 23 | public BusyLock(List objectList) 24 | { 25 | this.objectList = objectList; 26 | } 27 | 28 | public bool Success { 29 | get { return objectList != null; } 30 | } 31 | 32 | public void Dispose() 33 | { 34 | if (objectList != null) { 35 | objectList.RemoveAt(objectList.Count - 1); 36 | } 37 | } 38 | } 39 | 40 | [ThreadStatic] static List _activeObjects; 41 | 42 | public static BusyLock Enter(object obj) 43 | { 44 | List activeObjects = _activeObjects; 45 | if (activeObjects == null) 46 | activeObjects = _activeObjects = new List(); 47 | for (int i = 0; i < activeObjects.Count; i++) { 48 | if (activeObjects[i] == obj) 49 | return BusyLock.Failed; 50 | } 51 | activeObjects.Add(obj); 52 | return new BusyLock(activeObjects); 53 | } 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /GitUI/ICSharpCode.AvalonEdit/Utils/CallbackOnDispose.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt) 2 | // This code is distributed under the GNU LGPL (for details please see \doc\license.txt) 3 | 4 | using System; 5 | using System.Diagnostics; 6 | using System.Threading; 7 | 8 | namespace ICSharpCode.AvalonEdit.Utils 9 | { 10 | /// 11 | /// Invokes an action when it is disposed. 12 | /// 13 | /// 14 | /// This class ensures the callback is invoked at most once, 15 | /// even when Dispose is called on multiple threads. 16 | /// 17 | sealed class CallbackOnDispose : IDisposable 18 | { 19 | Action action; 20 | 21 | public CallbackOnDispose(Action action) 22 | { 23 | Debug.Assert(action != null); 24 | this.action = action; 25 | } 26 | 27 | public void Dispose() 28 | { 29 | Action a = Interlocked.Exchange(ref action, null); 30 | if (a != null) { 31 | a(); 32 | } 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /GitUI/ICSharpCode.AvalonEdit/Utils/Constants.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt) 2 | // This code is distributed under the GNU LGPL (for details please see \doc\license.txt) 3 | 4 | using System; 5 | 6 | namespace ICSharpCode.AvalonEdit.Utils 7 | { 8 | static class Constants 9 | { 10 | /// 11 | /// Multiply with this constant to convert from points to device-independent pixels. 12 | /// 13 | public const double PixelPerPoint = 4 / 3.0; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /GitUI/ICSharpCode.AvalonEdit/Utils/DelayedEvents.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt) 2 | // This code is distributed under the GNU LGPL (for details please see \doc\license.txt) 3 | 4 | using System; 5 | using System.Collections.Generic; 6 | 7 | namespace ICSharpCode.AvalonEdit.Utils 8 | { 9 | /// 10 | /// Maintains a list of delayed events to raise. 11 | /// 12 | sealed class DelayedEvents 13 | { 14 | struct EventCall 15 | { 16 | EventHandler handler; 17 | object sender; 18 | EventArgs e; 19 | 20 | public EventCall(EventHandler handler, object sender, EventArgs e) 21 | { 22 | this.handler = handler; 23 | this.sender = sender; 24 | this.e = e; 25 | } 26 | 27 | public void Call() 28 | { 29 | handler(sender, e); 30 | } 31 | } 32 | 33 | Queue eventCalls = new Queue(); 34 | 35 | public void DelayedRaise(EventHandler handler, object sender, EventArgs e) 36 | { 37 | if (handler != null) { 38 | eventCalls.Enqueue(new EventCall(handler, sender, e)); 39 | } 40 | } 41 | 42 | public void RaiseEvents() 43 | { 44 | while (eventCalls.Count > 0) 45 | eventCalls.Dequeue().Call(); 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /GitUI/ICSharpCode.AvalonEdit/Utils/Empty.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt) 2 | // This code is distributed under the GNU LGPL (for details please see \doc\license.txt) 3 | 4 | using System; 5 | using System.Collections.ObjectModel; 6 | 7 | namespace ICSharpCode.AvalonEdit.Utils 8 | { 9 | /// 10 | /// Provides immutable empty list instances. 11 | /// 12 | static class Empty 13 | { 14 | public static readonly T[] Array = new T[0]; 15 | //public static readonly ReadOnlyCollection ReadOnlyCollection = new ReadOnlyCollection(Array); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /GitUI/ICSharpCode.AvalonEdit/Utils/NullSafeCollection.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt) 2 | // This code is distributed under the GNU LGPL (for details please see \doc\license.txt) 3 | 4 | using System; 5 | using System.Collections.ObjectModel; 6 | 7 | namespace ICSharpCode.AvalonEdit.Utils 8 | { 9 | /// 10 | /// A collection that cannot contain null values. 11 | /// 12 | [Serializable] 13 | public class NullSafeCollection : Collection where T : class 14 | { 15 | /// 16 | protected override void InsertItem(int index, T item) 17 | { 18 | if (item == null) 19 | throw new ArgumentNullException("item"); 20 | base.InsertItem(index, item); 21 | } 22 | 23 | /// 24 | protected override void SetItem(int index, T item) 25 | { 26 | if (item == null) 27 | throw new ArgumentNullException("item"); 28 | base.SetItem(index, item); 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /GitUI/ICSharpCode.AvalonEdit/Utils/ObserveAddRemoveCollection.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt) 2 | // This code is distributed under the GNU LGPL (for details please see \doc\license.txt) 3 | 4 | using System; 5 | using System.Collections.ObjectModel; 6 | 7 | namespace ICSharpCode.AvalonEdit.Utils 8 | { 9 | /// 10 | /// A collection where adding and removing items causes a callback. 11 | /// It is valid for the onAdd callback to throw an exception - this will prevent the new item from 12 | /// being added to the collection. 13 | /// 14 | sealed class ObserveAddRemoveCollection : Collection 15 | { 16 | readonly Action onAdd, onRemove; 17 | 18 | public ObserveAddRemoveCollection(Action onAdd, Action onRemove) 19 | { 20 | this.onAdd = onAdd; 21 | this.onRemove = onRemove; 22 | } 23 | 24 | protected override void ClearItems() 25 | { 26 | if (onRemove != null) { 27 | foreach (T val in this) 28 | onRemove(val); 29 | } 30 | base.ClearItems(); 31 | } 32 | 33 | protected override void InsertItem(int index, T item) 34 | { 35 | if (onAdd != null) 36 | onAdd(item); 37 | base.InsertItem(index, item); 38 | } 39 | 40 | protected override void RemoveItem(int index) 41 | { 42 | if (onRemove != null) 43 | onRemove(this[index]); 44 | base.RemoveItem(index); 45 | } 46 | 47 | protected override void SetItem(int index, T item) 48 | { 49 | if (onRemove != null) 50 | onRemove(this[index]); 51 | try { 52 | if (onAdd != null) 53 | onAdd(item); 54 | } catch { 55 | // When adding the new item fails, just remove the old one 56 | // (we cannot keep the old item since we already successfully called onRemove for it) 57 | base.RemoveAt(index); 58 | throw; 59 | } 60 | base.SetItem(index, item); 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /GitUI/ICSharpCode.AvalonEdit/Utils/PropertyChangedWeakEventManager.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt) 2 | // This code is distributed under the GNU LGPL (for details please see \doc\license.txt) 3 | 4 | using System; 5 | using System.ComponentModel; 6 | 7 | namespace ICSharpCode.AvalonEdit.Utils 8 | { 9 | /// 10 | /// WeakEventManager for INotifyPropertyChanged.PropertyChanged. 11 | /// 12 | public sealed class PropertyChangedWeakEventManager : WeakEventManagerBase 13 | { 14 | /// 15 | protected override void StartListening(INotifyPropertyChanged source) 16 | { 17 | source.PropertyChanged += DeliverEvent; 18 | } 19 | 20 | /// 21 | protected override void StopListening(INotifyPropertyChanged source) 22 | { 23 | source.PropertyChanged -= DeliverEvent; 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /GitUI/ICSharpCode.AvalonEdit/Utils/ThrowUtil.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt) 2 | // This code is distributed under the GNU LGPL (for details please see \doc\license.txt) 3 | 4 | using System; 5 | using System.Globalization; 6 | 7 | namespace ICSharpCode.AvalonEdit.Utils 8 | { 9 | /// 10 | /// Contains exception-throwing helper methods. 11 | /// 12 | static class ThrowUtil 13 | { 14 | /// 15 | /// Throws an ArgumentNullException if is null; otherwise 16 | /// returns val. 17 | /// 18 | /// 19 | /// Use this method to throw an ArgumentNullException when using parameters for base 20 | /// constructor calls. 21 | /// 22 | /// public VisualLineText(string text) : base(ThrowUtil.CheckNotNull(text, "text").Length) 23 | /// 24 | /// 25 | public static T CheckNotNull(T val, string parameterName) where T : class 26 | { 27 | if (val == null) 28 | throw new ArgumentNullException(parameterName); 29 | return val; 30 | } 31 | 32 | public static int CheckNotNegative(int val, string parameterName) 33 | { 34 | if (val < 0) 35 | throw new ArgumentOutOfRangeException(parameterName, val, "value must not be negative"); 36 | return val; 37 | } 38 | 39 | public static int CheckInRangeInclusive(int val, string parameterName, int lower, int upper) 40 | { 41 | if (val < lower || val > upper) 42 | throw new ArgumentOutOfRangeException(parameterName, val, "Expected: " + lower.ToString(CultureInfo.InvariantCulture) + " <= " + parameterName + " <= " + upper.ToString(CultureInfo.InvariantCulture)); 43 | return val; 44 | } 45 | 46 | public static InvalidOperationException NoDocumentAssigned() 47 | { 48 | return new InvalidOperationException("Document is null"); 49 | } 50 | 51 | public static InvalidOperationException NoValidCaretPosition() 52 | { 53 | return new InvalidOperationException("Could not find a valid caret position in the line"); 54 | } 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /GitUI/ICSharpCode.AvalonEdit/Xml/AXmlObjectEventArgs.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt) 2 | // This code is distributed under the GNU LGPL (for details please see \doc\license.txt) 3 | 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Collections.ObjectModel; 7 | using System.Collections.Specialized; 8 | using System.Diagnostics; 9 | using System.Linq; 10 | 11 | using ICSharpCode.AvalonEdit.Document; 12 | 13 | namespace ICSharpCode.AvalonEdit.Xml 14 | { 15 | /// Holds event args for event caused by 16 | public class AXmlObjectEventArgs: EventArgs 17 | { 18 | /// The object that caused the event 19 | public AXmlObject Object { get; set; } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /GitUI/ICSharpCode.AvalonEdit/Xml/AbstractAXmlVisitor.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt) 2 | // This code is distributed under the GNU LGPL (for details please see \doc\license.txt) 3 | 4 | using System; 5 | using System.Text; 6 | 7 | namespace ICSharpCode.AvalonEdit.Xml 8 | { 9 | /// 10 | /// Derive from this class to create visitor for the XML tree 11 | /// 12 | public abstract class AbstractAXmlVisitor : IAXmlVisitor 13 | { 14 | /// Visit RawDocument 15 | public virtual void VisitDocument(AXmlDocument document) 16 | { 17 | foreach(AXmlObject child in document.Children) child.AcceptVisitor(this); 18 | } 19 | 20 | /// Visit RawElement 21 | public virtual void VisitElement(AXmlElement element) 22 | { 23 | foreach(AXmlObject child in element.Children) child.AcceptVisitor(this); 24 | } 25 | 26 | /// Visit RawTag 27 | public virtual void VisitTag(AXmlTag tag) 28 | { 29 | foreach(AXmlObject child in tag.Children) child.AcceptVisitor(this); 30 | } 31 | 32 | /// Visit RawAttribute 33 | public virtual void VisitAttribute(AXmlAttribute attribute) 34 | { 35 | 36 | } 37 | 38 | /// Visit RawText 39 | public virtual void VisitText(AXmlText text) 40 | { 41 | 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /GitUI/ICSharpCode.AvalonEdit/Xml/ExtensionMethods.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt) 2 | // This code is distributed under the GNU LGPL (for details please see \doc\license.txt) 3 | 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Collections.ObjectModel; 7 | using System.Collections.Specialized; 8 | using System.Diagnostics; 9 | using System.Linq; 10 | 11 | using ICSharpCode.AvalonEdit.Document; 12 | 13 | namespace ICSharpCode.AvalonEdit.Xml 14 | { 15 | static class ExtensionMethods 16 | { 17 | // Copied from ICSharpCode.SharpDevelop.Dom.ExtensionMethods 18 | /// 19 | /// Converts a recursive data structure into a flat list. 20 | /// 21 | /// The root elements of the recursive data structure. 22 | /// The function that gets the children of an element. 23 | /// Iterator that enumerates the tree structure in preorder. 24 | public static IEnumerable Flatten(this IEnumerable input, Func> recursion) 25 | { 26 | Stack> stack = new Stack>(); 27 | try { 28 | stack.Push(input.GetEnumerator()); 29 | while (stack.Count > 0) { 30 | while (stack.Peek().MoveNext()) { 31 | T element = stack.Peek().Current; 32 | yield return element; 33 | IEnumerable children = recursion(element); 34 | if (children != null) { 35 | stack.Push(children.GetEnumerator()); 36 | } 37 | } 38 | stack.Pop().Dispose(); 39 | } 40 | } finally { 41 | while (stack.Count > 0) { 42 | stack.Pop().Dispose(); 43 | } 44 | } 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /GitUI/ICSharpCode.AvalonEdit/Xml/IAXmlVisitor.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt) 2 | // This code is distributed under the GNU LGPL (for details please see \doc\license.txt) 3 | 4 | using System; 5 | using System.Text; 6 | 7 | namespace ICSharpCode.AvalonEdit.Xml 8 | { 9 | /// 10 | /// Visitor for the XML tree 11 | /// 12 | public interface IAXmlVisitor 13 | { 14 | /// Visit RawDocument 15 | void VisitDocument(AXmlDocument document); 16 | 17 | /// Visit RawElement 18 | void VisitElement(AXmlElement element); 19 | 20 | /// Visit RawTag 21 | void VisitTag(AXmlTag tag); 22 | 23 | /// Visit RawAttribute 24 | void VisitAttribute(AXmlAttribute attribute); 25 | 26 | /// Visit RawText 27 | void VisitText(AXmlText text); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /GitUI/ICSharpCode.AvalonEdit/Xml/InternalException.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt) 2 | // This code is distributed under the GNU LGPL (for details please see \doc\license.txt) 3 | 4 | using System; 5 | using System.Runtime.Serialization; 6 | 7 | namespace ICSharpCode.AvalonEdit.Xml 8 | { 9 | /// 10 | /// Exception used for internal errors in XML parser. 11 | /// This exception indicates a bug in AvalonEdit. 12 | /// 13 | [Serializable()] 14 | [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1064:ExceptionsShouldBePublic", Justification = "This exception is not public because it is not supposed to be caught by user code - it indicates a bug in AvalonEdit.")] 15 | class InternalException : Exception 16 | { 17 | /// 18 | /// Creates a new InternalException instance. 19 | /// 20 | public InternalException() : base() 21 | { 22 | } 23 | 24 | /// 25 | /// Creates a new InternalException instance. 26 | /// 27 | public InternalException(string message) : base(message) 28 | { 29 | } 30 | 31 | /// 32 | /// Creates a new InternalException instance. 33 | /// 34 | public InternalException(string message, Exception innerException) : base(message, innerException) 35 | { 36 | } 37 | 38 | /// 39 | /// Creates a new InternalException instance. 40 | /// 41 | protected InternalException(SerializationInfo info, StreamingContext context) : base(info, context) 42 | { 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /GitUI/ICSharpCode.AvalonEdit/Xml/PrettyPrintAXmlVisitor.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt) 2 | // This code is distributed under the GNU LGPL (for details please see \doc\license.txt) 3 | 4 | using System; 5 | using System.Text; 6 | 7 | namespace ICSharpCode.AvalonEdit.Xml 8 | { 9 | /// 10 | /// Converts the XML tree back to text. 11 | /// The text should exactly match the original. 12 | /// 13 | public class PrettyPrintAXmlVisitor: AbstractAXmlVisitor 14 | { 15 | StringBuilder sb = new StringBuilder(); 16 | 17 | /// 18 | /// Gets the pretty printed text 19 | /// 20 | public string Output { 21 | get { 22 | return sb.ToString(); 23 | } 24 | } 25 | 26 | /// Create XML text from a document 27 | public static string PrettyPrint(AXmlDocument doc) 28 | { 29 | PrettyPrintAXmlVisitor visitor = new PrettyPrintAXmlVisitor(); 30 | visitor.VisitDocument(doc); 31 | return visitor.Output; 32 | } 33 | 34 | /// Visit RawDocument 35 | public override void VisitDocument(AXmlDocument document) 36 | { 37 | base.VisitDocument(document); 38 | } 39 | 40 | /// Visit RawElement 41 | public override void VisitElement(AXmlElement element) 42 | { 43 | base.VisitElement(element); 44 | } 45 | 46 | /// Visit RawTag 47 | public override void VisitTag(AXmlTag tag) 48 | { 49 | sb.Append(tag.OpeningBracket); 50 | sb.Append(tag.Name); 51 | base.VisitTag(tag); 52 | sb.Append(tag.ClosingBracket); 53 | } 54 | 55 | /// Visit RawAttribute 56 | public override void VisitAttribute(AXmlAttribute attribute) 57 | { 58 | sb.Append(attribute.Name); 59 | sb.Append(attribute.EqualsSign); 60 | sb.Append(attribute.QuotedValue); 61 | } 62 | 63 | /// Visit RawText 64 | public override void VisitText(AXmlText text) 65 | { 66 | sb.Append(text.EscapedValue); 67 | } 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /GitUI/ICSharpCode.AvalonEdit/Xml/SyntaxError.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt) 2 | // This code is distributed under the GNU LGPL (for details please see \doc\license.txt) 3 | 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Collections.ObjectModel; 7 | using System.Collections.Specialized; 8 | using System.Diagnostics; 9 | using System.Linq; 10 | 11 | using ICSharpCode.AvalonEdit.Document; 12 | 13 | namespace ICSharpCode.AvalonEdit.Xml 14 | { 15 | /// Information about syntax error that occured during parsing 16 | public class SyntaxError: TextSegment 17 | { 18 | /// Object for which the error occured 19 | public AXmlObject Object { get; internal set; } 20 | /// Textual description of the error 21 | public string Message { get; internal set; } 22 | /// Any user data 23 | public object Tag { get; set; } 24 | 25 | internal SyntaxError Clone(AXmlObject newOwner) 26 | { 27 | return new SyntaxError { 28 | Object = newOwner, 29 | Message = Message, 30 | Tag = Tag, 31 | StartOffset = StartOffset, 32 | EndOffset = EndOffset, 33 | }; 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /GitUI/ICSharpCode.AvalonEdit/Xml/TextType.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt) 2 | // This code is distributed under the GNU LGPL (for details please see \doc\license.txt) 3 | 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Collections.ObjectModel; 7 | using System.Collections.Specialized; 8 | using System.Diagnostics; 9 | using System.Linq; 10 | 11 | using ICSharpCode.AvalonEdit.Document; 12 | 13 | namespace ICSharpCode.AvalonEdit.Xml 14 | { 15 | /// Identifies the context in which the text occured 16 | enum TextType 17 | { 18 | /// Ends with non-whitespace 19 | WhiteSpace, 20 | 21 | /// Ends with "<"; "]]>" is error 22 | CharacterData, 23 | 24 | /// Ends with "-->"; "--" is error 25 | Comment, 26 | 27 | /// Ends with "]]>" 28 | CData, 29 | 30 | /// Ends with "?>" 31 | ProcessingInstruction, 32 | 33 | /// Ends with "<" or ">" 34 | UnknownBang, 35 | 36 | /// Unknown 37 | Other 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /GitUI/ICSharpCode.AvalonEdit/themes/RightArrow.cur: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yysun/Git-Source-Control-Provider/dd8bd933482600f2caf5c2dd935327fbfde8b057/GitUI/ICSharpCode.AvalonEdit/themes/RightArrow.cur -------------------------------------------------------------------------------- /GitUI/ICSharpCode.AvalonEdit/themes/generic.xaml: -------------------------------------------------------------------------------- 1 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 15 | 16 | -------------------------------------------------------------------------------- /GitUI/Microsoft.Windows.Shell/JumpItem.cs: -------------------------------------------------------------------------------- 1 | /**************************************************************************\ 2 | Copyright Microsoft Corporation. All Rights Reserved. 3 | \**************************************************************************/ 4 | 5 | namespace Microsoft.Windows.Shell 6 | { 7 | public abstract class JumpItem 8 | { 9 | // This class is just provided to strongly type the JumpList's contents. 10 | // It's not externally extendable. 11 | internal JumpItem() 12 | { 13 | } 14 | 15 | public string CustomCategory { get; set; } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /GitUI/Microsoft.Windows.Shell/JumpPath.cs: -------------------------------------------------------------------------------- 1 | /**************************************************************************\ 2 | Copyright Microsoft Corporation. All Rights Reserved. 3 | \**************************************************************************/ 4 | 5 | namespace Microsoft.Windows.Shell 6 | { 7 | public class JumpPath : JumpItem 8 | { 9 | public JumpPath() 10 | {} 11 | 12 | public string Path { get; set; } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /GitUI/Microsoft.Windows.Shell/JumpTask.cs: -------------------------------------------------------------------------------- 1 | /**************************************************************************\ 2 | Copyright Microsoft Corporation. All Rights Reserved. 3 | \**************************************************************************/ 4 | 5 | namespace Microsoft.Windows.Shell 6 | { 7 | public class JumpTask : JumpItem 8 | { 9 | public JumpTask() 10 | {} 11 | 12 | public string Title { get; set; } 13 | 14 | public string Description { get; set; } 15 | 16 | public string ApplicationPath { get; set; } 17 | 18 | public string Arguments { get; set; } 19 | 20 | public string WorkingDirectory { get; set; } 21 | 22 | public string IconResourcePath { get; set; } 23 | 24 | public int IconResourceIndex { get; set; } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /GitUI/Microsoft.Windows.Shell/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | /**************************************************************************\ 2 | Copyright Microsoft Corporation. All Rights Reserved. 3 | \**************************************************************************/ 4 | 5 | using System; 6 | using System.Diagnostics.CodeAnalysis; 7 | using System.Reflection; 8 | using System.Runtime.InteropServices; 9 | using System.Windows.Markup; 10 | 11 | [assembly: AssemblyTitle("Microsoft.Windows.Shell")] 12 | [assembly: AssemblyDescription("Windows 7 shell integration library for WPF")] 13 | [assembly: AssemblyConfiguration("")] 14 | [assembly: AssemblyCompany("Microsoft")] 15 | [assembly: AssemblyProduct("Microsoft.Windows.Shell")] 16 | [assembly: AssemblyCopyright("Copyright © Microsoft 2010")] 17 | [assembly: AssemblyTrademark("")] 18 | [assembly: AssemblyCulture("")] 19 | 20 | [assembly: ComVisible(false)] 21 | [assembly: Guid("573618e1-4f3f-4395-a3bf-ffebfb342917")] 22 | [assembly: CLSCompliant(true)] 23 | 24 | [assembly: AssemblyVersion("3.0.1.0")] 25 | [assembly: AssemblyFileVersion("3.0.1.0")] 26 | 27 | [assembly: XmlnsDefinition("http://schemas.microsoft.com/winfx/2006/xaml/presentation/shell", "Microsoft.Windows.Shell")] 28 | 29 | // Code analysis suppressions: 30 | [assembly: SuppressMessage("Microsoft.Design", "CA1020:AvoidNamespacesWithFewTypes", Scope = "namespace", Target = "Standard", Justification="Internal-only namespace")] 31 | [assembly: SuppressMessage("Microsoft.Design", "CA2210:AssembliesShouldHaveValidStrongNames", Justification="Assembly has strong name when published")] 32 | -------------------------------------------------------------------------------- /GitUI/Microsoft.Windows.Shell/ThumbButtonInfoCollection.cs: -------------------------------------------------------------------------------- 1 | /**************************************************************************\ 2 | Copyright Microsoft Corporation. All Rights Reserved. 3 | \**************************************************************************/ 4 | 5 | namespace Microsoft.Windows.Shell 6 | { 7 | using System.Windows; 8 | 9 | public class ThumbButtonInfoCollection : FreezableCollection 10 | { 11 | protected override Freezable CreateInstanceCore() 12 | { 13 | return new ThumbButtonInfoCollection(); 14 | } 15 | 16 | /// 17 | /// A frozen empty ThumbButtonInfoCollection. 18 | /// 19 | internal static ThumbButtonInfoCollection Empty 20 | { 21 | get 22 | { 23 | if (s_empty == null) 24 | { 25 | var collection = new ThumbButtonInfoCollection(); 26 | collection.Freeze(); 27 | s_empty = collection; 28 | } 29 | 30 | return s_empty; 31 | } 32 | } 33 | 34 | private static ThumbButtonInfoCollection s_empty; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /GitUI/Microsoft.Windows.Shell/app.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /GitUI/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.17020 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace GitUI.Properties 12 | { 13 | 14 | 15 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 16 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] 17 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase 18 | { 19 | 20 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 21 | 22 | public static Settings Default 23 | { 24 | get 25 | { 26 | return defaultInstance; 27 | } 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /GitUI/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /GitUI/Resources/Loading.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yysun/Git-Source-Control-Provider/dd8bd933482600f2caf5c2dd935327fbfde8b057/GitUI/Resources/Loading.png -------------------------------------------------------------------------------- /GitUI/Resources/Microsoft.Windows.Shell.dll.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /GitUI/Resources/Microsoft.Windows.Shell.dll.lastcodeanalysissucceeded: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yysun/Git-Source-Control-Provider/dd8bd933482600f2caf5c2dd935327fbfde8b057/GitUI/Resources/Microsoft.Windows.Shell.dll.lastcodeanalysissucceeded -------------------------------------------------------------------------------- /GitUI/Resources/dragon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yysun/Git-Source-Control-Provider/dd8bd933482600f2caf5c2dd935327fbfde8b057/GitUI/Resources/dragon.png -------------------------------------------------------------------------------- /GitUI/UI/BottomToolBar.xaml: -------------------------------------------------------------------------------- 1 |  8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 |