mirror of https://github.com/icsharpcode/ILSpy.git
13 changed files with 377 additions and 51 deletions
After Width: | Height: | Size: 501 B |
After Width: | Height: | Size: 275 B |
@ -0,0 +1,46 @@
@@ -0,0 +1,46 @@
|
||||
// Copyright (c) 2011 AlphaSierraPapa for the SharpDevelop Team
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy of this
|
||||
// software and associated documentation files (the "Software"), to deal in the Software
|
||||
// without restriction, including without limitation the rights to use, copy, modify, merge,
|
||||
// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
|
||||
// to whom the Software is furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all copies or
|
||||
// substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
||||
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
|
||||
// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
using System; |
||||
using System.Runtime.Serialization; |
||||
|
||||
namespace ICSharpCode.ILSpy.TextView |
||||
{ |
||||
/// <summary>
|
||||
/// This exception gets used when the text output is longer than the specified limit.
|
||||
/// </summary>
|
||||
class OutputLengthExceededException : Exception, ISerializable |
||||
{ |
||||
public OutputLengthExceededException() |
||||
{ |
||||
} |
||||
|
||||
public OutputLengthExceededException(string message) : base(message) |
||||
{ |
||||
} |
||||
|
||||
public OutputLengthExceededException(string message, Exception innerException) : base(message, innerException) |
||||
{ |
||||
} |
||||
|
||||
// This constructor is needed for serialization.
|
||||
protected OutputLengthExceededException(SerializationInfo info, StreamingContext context) : base(info, context) |
||||
{ |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,65 @@
@@ -0,0 +1,65 @@
|
||||
// Copyright (c) 2011 AlphaSierraPapa for the SharpDevelop Team
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining a copy of this
|
||||
// software and associated documentation files (the "Software"), to deal in the Software
|
||||
// without restriction, including without limitation the rights to use, copy, modify, merge,
|
||||
// publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
|
||||
// to whom the Software is furnished to do so, subject to the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be included in all copies or
|
||||
// substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
||||
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
|
||||
// FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
||||
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
// DEALINGS IN THE SOFTWARE.
|
||||
|
||||
using System; |
||||
using System.Collections.Generic; |
||||
using System.Windows; |
||||
|
||||
using ICSharpCode.AvalonEdit.Rendering; |
||||
|
||||
namespace ICSharpCode.ILSpy.TextView |
||||
{ |
||||
using Pair = KeyValuePair<int, Lazy<UIElement>>; |
||||
|
||||
/// <summary>
|
||||
/// Embeds UIElements in the text output.
|
||||
/// </summary>
|
||||
public class UIElementGenerator : VisualLineElementGenerator, IComparer<Pair> |
||||
{ |
||||
public List<Pair> UIElements; |
||||
|
||||
public override int GetFirstInterestedOffset(int startOffset) |
||||
{ |
||||
if (this.UIElements == null) |
||||
return -1; |
||||
int r = this.UIElements.BinarySearch(new Pair(startOffset, null), this); |
||||
if (r < 0) |
||||
r = ~r; |
||||
if (r < this.UIElements.Count) |
||||
return this.UIElements[r].Key; |
||||
else |
||||
return -1; |
||||
} |
||||
|
||||
public override VisualLineElement ConstructElement(int offset) |
||||
{ |
||||
if (this.UIElements == null) |
||||
return null; |
||||
int r = UIElements.BinarySearch(new Pair(offset, null), this); |
||||
if (r >= 0) |
||||
return new InlineObjectElement(0, this.UIElements[r].Value.Value); |
||||
else |
||||
return null; |
||||
} |
||||
|
||||
int IComparer<Pair>.Compare(Pair x, Pair y) |
||||
{ |
||||
return x.Key.CompareTo(y.Key); |
||||
} |
||||
} |
||||
} |
Loading…
Reference in new issue