本文整理汇总了C#中TextBuffer类的典型用法代码示例。如果您正苦于以下问题:C# TextBuffer类的具体用法?C# TextBuffer怎么用?C# TextBuffer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TextBuffer类属于命名空间,在下文中一共展示了TextBuffer类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: DrawMenu
public void DrawMenu(TextBuffer GUIText)
{
ValidateSelected();
Widget[] Entries = MenuEntries.ToArray();
// Separator
int Width = MenuTitle.Length + 5;
int Height = 3;
for (int i = 0; i < Entries.Length; i++) {
Width = Math.Max(Width, Entries[i].Width + 3);
Height += Entries[i].Height;
}
int X = GUIText.BufferWidth / 2 - Width / 2 - 1;
int Y = GUIText.BufferHeight / 2 - Height / 2 - 1;
//DrawBox(GUIText, Width, 0, 0, GUIText.BufferHeight - 1);
// Outline
for (int x = 0; x < Width; x++)
for (int y = 0; y < Height; y++)
GUIText[X + x, Y + y] = 0;
GUIText.DrawBox(X, Y, Width, Height);
GUIText.Print(X + 2, Y, "[" + MenuTitle + "]");
// Entries
int YOff = 0;
for (int i = 0; i < Entries.Length; i++) {
Entries[i].Draw(GUIText, X + 2, Y + 2 + YOff, i == Selected);
YOff += Entries[i].Height;
}
/*GUIText.Print(X + 2, Y + i + 2, Entries[i],
i == Selected ? Color.Black : ConsoleColor.Gray.ToColor(), i == Selected ? Color.White : Color.Black);*/
}
开发者ID:cartman300,项目名称:Tetraquark,代码行数:35,代码来源:MenuEntry.cs
示例2: Setup
public void Setup()
{
textBuffer = new TextBuffer(
" var a = 12.34;\n" +
" var b = 56.78;\n" +
" var c = 90.11;\n" +
" var d = 12345;\n" +
" var e = 67890;\n");
}
开发者ID:samuto,项目名称:designscript,代码行数:9,代码来源:TextBufferMultilineTests.cs
示例3: ClassificationSpan
/// <summary>
/// Initializes a new instance of the <see cref="ClassificationSpan"/> class.
/// </summary>
/// <exception cref="ArgumentNullException"><para><paramref name="classification"/> is <see langword="null"/>.</para></exception>
public ClassificationSpan(TextBuffer buffer, Int32 start, Int32 length, String classification)
: base(buffer, start, length)
{
if (classification == null)
{
throw new ArgumentNullException("classification");
}
_classification = classification;
}
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:13,代码来源:ClassificationSpan.cs
示例4: TestFindAllOccurences03
public void TestFindAllOccurences03()
{
string initialContent = "First line\nSecond line\nThird line\nFourth line";
TextBuffer localBuffer = new TextBuffer(initialContent);
Assert.AreEqual(4, localBuffer.GetLineCount());
localBuffer.FindReplace("design", null, FindOptions.ReplaceOnce);
List<FindPosition> findResults = new List<FindPosition>();
localBuffer.GetSearchResults(ref findResults);
Assert.AreEqual(0, findResults.Count);
}
开发者ID:samuto,项目名称:designscript,代码行数:11,代码来源:TextBufferTests.cs
示例5: ReplaceFirst
public static int ReplaceFirst(Matcher m,Substitution substitution,TextBuffer dest)
{
int c=0;
if(m.Find()) {
if(m.Start>0) m.Group(Matcher.PREFIX,dest);
substitution.AppendSubstitution(m,dest);
c++;
m.SetTarget(m,Matcher.SUFFIX);
}
m.Group(Matcher.TARGET,dest);
return c;
}
开发者ID:olabini,项目名称:nregex,代码行数:12,代码来源:Replacer.cs
示例6: TextWithGroupRuby
public void TextWithGroupRuby(UString baseText, UString rubyText)
{
var baseBuffer = new TextBuffer(_zwSize, _wordWrap, _advancing, _latinMetric, 64);
var rubyBuffer = new TextBuffer(_rubyZwSize, _wordWrap, _advancing, _latinMetric, 128);
_buffer.MoveLastLetterStateTo(baseBuffer);
baseBuffer.Append(baseText);
rubyBuffer.Append(rubyText);
_buffer.AppendObject(new GroupRuby(baseBuffer.ToArray(), rubyBuffer.ToArray()));
baseBuffer.MoveLastLetterStateTo(_buffer);
baseBuffer.Clear();
rubyBuffer.Clear();
}
开发者ID:karak,项目名称:Geovanni,代码行数:12,代码来源:ParagraphBuilder.cs
示例7: VersionedTextSpan
/// <summary>
/// Initializes a new instance of the <see cref="VersionedTextSpan"/> class.
/// </summary>
/// <exception cref="ArgumentNullException">
/// <para><paramref name="buffer"/> is <see langword="null"/>.</para>
/// -or-
/// <para><paramref name="span"/> is <see langword="null"/>.</para>
/// </exception>
public VersionedTextSpan(TextBuffer buffer, Span span)
{
if (buffer == null)
{
throw new ArgumentNullException("buffer");
}
if (span == null)
{
throw new ArgumentNullException("span");
}
this.Construct(buffer, buffer.Version, span.Start, span.Length, SpanTrackingMode.EdgeExclusive);
}
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:20,代码来源:VersionedTextSpan.cs
示例8: Draw
public override void Draw(TextBuffer TBuffer, int X, int Y, bool IsSelected)
{
Color Fg = ConsoleColor.Gray.ToColor();
Color Bg = Color.Black;
if (IsSelected) {
Fg = Color.Black;
if (Enabled)
Bg = Color.White;
else
Bg = ConsoleColor.DarkGray.ToColor();
}
TBuffer.Print(X, Y, Txt, Fg, Bg);
}
开发者ID:cartman300,项目名称:Tetraquark,代码行数:13,代码来源:Widgets.cs
示例9: GetView
public override Widget GetView ()
{
if (scrolled_window != null)
return scrolled_window;
buffer = new TextBuffer (new TextTagTable ());
buffer.Text = Text;
view = new TextView (buffer);
scrolled_window = new ScrolledWindow ();
scrolled_window.Add (view);
return scrolled_window;
}
开发者ID:dfr0,项目名称:moon,代码行数:14,代码来源:View.cs
示例10: Replace
public static int Replace(Matcher m,Substitution substitution,TextBuffer dest)
{
bool firstPass=true;
int c=0;
while(m.Find()) {
if(m.End==0 && !firstPass) continue; //allow to Replace at "^"
if(m.Start>0) m.Group(Matcher.PREFIX,dest);
substitution.AppendSubstitution(m,dest);
c++;
m.SetTarget(m,Matcher.SUFFIX);
firstPass=false;
}
m.Group(Matcher.TARGET,dest);
return c;
}
开发者ID:olabini,项目名称:nregex,代码行数:15,代码来源:Replacer.cs
示例11: Format
/// <summary>Formats the input BPL object into the output XML document.</summary>
public override bool Format(BplObject input) {
if (!PrepareFormatter(input)) return false;
_output = new TextBuffer(this);
try {
_serializeObject(null, Input);
_injectMapping(NSMapping);
Output = _output.ToString();
} catch (Exception e) {
AddException(e);
}
_output = null;
return Success;
}
开发者ID:borkaborka,项目名称:gmit,代码行数:16,代码来源:BplJsonFormatter.cs
示例12: MenuState
public MenuState()
{
GUIText = new TextBuffer(80, 30);
GUIText.SetFontTexture(ResourceMgr.Get<Texture>("font"));
GUIText.Sprite.Scale = Renderer.Screen.Size.ToVec2f().Divide(GUIText.Sprite.Texture.Size.ToVec2f());
GUIText.Sprite.Position = Renderer.Screen.Texture.Size.ToVec2f() / 2;
GUIText.Sprite.Origin = GUIText.Sprite.Texture.Size.ToVec2f() / 2;
AAA = new RenderSprite(Renderer.Screen.Size);
BBB = new RenderSprite(Renderer.Screen.Size);
CRT = new RenderSprite(Renderer.Screen.Size);
MainMenu = new MenuEntry("Main Menu");
if (Renderer.CountStates() > 0)
MainMenu.Add(new WidgetButton("Continue Universe", () => Renderer.PopState()));
MainMenu
.Add(new WidgetButton("Create Universe", () => Renderer.PushState(new GameState())))
.Add(new WidgetButton("Load Universe", () => CurrentMenu = LoadUniverse).Disable())
.Add(new WidgetButton("Universal Constants", () => CurrentMenu = Constants))
.Add(new WidgetButton("Terminate", () => Program.Running = false));
Action BackToMainMenu = () => {
GUIText.Clear();
CurrentMenu = MainMenu;
};
LoadUniverse = new MenuEntry("Load Universe")
.Add(new WidgetButton("Back", BackToMainMenu));
Constants = new MenuEntry("Universal Constants")
.Add(new WidgetTextbox("Resolution X", Program.ResX.ToString(), 6, (S) => {
if (S.Length > 0)
Program.ResX = int.Parse(S);
GUIText.Print(0, 0, "Restart required for changes to take effect");
}, char.IsNumber))
.Add(new WidgetTextbox("Resolution Y", Program.ResY.ToString(), 6, (S) => {
if (S.Length > 0)
Program.ResY = int.Parse(S);
GUIText.Print(0, 0, "Restart required for changes to take effect");
}, char.IsNumber))
.Add(new WidgetCheckbox("Debug", Program.Debug, (B) => Program.Debug = B))
.Add(new WidgetCheckbox("Border", Program.Border, (B) => Program.Border = B))
.Add(new WidgetButton("Back", BackToMainMenu));
CurrentMenu = MainMenu;
CurrentMenu.DrawMenu(GUIText);
}
开发者ID:cartman300,项目名称:Tetraquark,代码行数:48,代码来源:MenuState.cs
示例13: TestFindAllOccurences02
public void TestFindAllOccurences02()
{
string initialContent = "First line design\nSecond line\nThird line\nFourth design design";
TextBuffer localBuffer = new TextBuffer(initialContent);
Assert.AreEqual(4, localBuffer.GetLineCount());
localBuffer.FindReplace("design", null, FindOptions.ReplaceOnce);
List<FindPosition> findResults = new List<FindPosition>();
localBuffer.GetSearchResults(ref findResults);
Assert.AreEqual(new Point(11, 0), findResults[0].startPoint);
Assert.AreEqual(new Point(16, 0), findResults[0].endPoint);
Assert.AreEqual(new Point(7, 3), findResults[1].startPoint);
Assert.AreEqual(new Point(12, 3), findResults[1].endPoint);
Assert.AreEqual(new Point(14, 3), findResults[2].startPoint);
Assert.AreEqual(new Point(19, 3), findResults[2].endPoint);
}
开发者ID:samuto,项目名称:designscript,代码行数:16,代码来源:TextBufferTests.cs
示例14: TextFormattingSource
public TextFormattingSource(
TextBuffer textBuffer
, IClassificationFormatMap classificationFormatMap
, Int32 startIndex
, Int32 length
, IList<ClassificationSpan> classificationSpans
, IList<SpaceNegotiation> spaceNegotiations
)
{
List<SpaceNegotiation> list = null;
if (spaceNegotiations != null)
{
list = new List<SpaceNegotiation>(spaceNegotiations);
list.Sort(new Comparison<SpaceNegotiation>(this.Comparison));
}
String text = textBuffer.GetText(startIndex, length);
_normalizedSpanManager = new NormalizedSpanManager(text, startIndex, classificationSpans, list, classificationFormatMap);
}
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:18,代码来源:TextFormattingSource.cs
示例15: BasicTest
public void BasicTest()
{
var str = "Test1Test2Test3";
var text = new TextBuffer();
var reader = text.GetReader();
var evt = new AutoResetEvent(false);
Action a = () =>
{
evt.WaitOne();
text.Write(str);
evt.WaitOne();
text.Write(str);
};
var t = new Thread(new ThreadStart(a));
t.Start();
char[] buffer = new char[0x1000];
var task = reader.ReadAsync(buffer, 0, 1000);
evt.Set();
task.Wait();
var s = task.Result;
log.WriteLine(s.ToString());
task = reader.ReadAsync(buffer, 0, 1000);
var reader2 = text.GetReader();
evt.Set();
var task2 = reader2.ReadToEndAsync();
task.Wait();
task2.Wait();
s = task.Result;
var s2 = task2.Result;
Assert.True(!string.IsNullOrEmpty(s2));
log.WriteLine(s.ToString());
log.WriteLine(s2.ToString());
t.Join();
}
开发者ID:MarkPflug,项目名称:AspNetScriptConsole,代码行数:43,代码来源:TextBufferTests.cs
示例16: GetParameters
public override bool GetParameters(TextBuffer textBuffer)
{
return true;
}
开发者ID:JGTM2016,项目名称:discutils,代码行数:4,代码来源:NullAuthenticator.cs
示例17: RepairRunIntervalWindow
RepairRunIntervalWindow(Gtk.Window parent, RunInterval myRun, int pDN)
{
Glade.XML gladeXML;
gladeXML = Glade.XML.FromAssembly (Util.GetGladePath() + "repair_sub_event.glade", "repair_sub_event", null);
gladeXML.Autoconnect(this);
repair_sub_event.Parent = parent;
//put an icon to window
UtilGtk.IconWindow(repair_sub_event);
this.runInterval = myRun;
repair_sub_event.Title = Catalog.GetString("Repair intervallic race");
System.Globalization.NumberFormatInfo localeInfo = new System.Globalization.NumberFormatInfo();
localeInfo = System.Globalization.NumberFormatInfo.CurrentInfo;
label_header.Text = string.Format(Catalog.GetString("Use this window to repair this test.\nDouble clic any cell to edit it (decimal separator: '{0}')"), localeInfo.NumberDecimalSeparator);
type = SqliteRunIntervalType.SelectAndReturnRunIntervalType(myRun.Type, false);
TextBuffer tb = new TextBuffer (new TextTagTable());
tb.Text = createTextForTextView(type);
textview1.Buffer = tb;
createTreeView(treeview_subevents);
//count, time
store = new TreeStore(typeof (string), typeof (string));
treeview_subevents.Model = store;
fillTreeView (treeview_subevents, store, myRun, pDN);
button_add_before.Sensitive = false;
button_add_after.Sensitive = false;
button_delete.Sensitive = false;
label_totaltime_value.Text = getTotalTime().ToString() + " " + Catalog.GetString("seconds");
treeview_subevents.Selection.Changed += onSelectionEntry;
}
开发者ID:GNOME,项目名称:chronojump,代码行数:38,代码来源:run.cs
示例18: LineWidthCache
/// <summary>
/// Initializes a new instance of the <see cref="LineWidthCache"/> class.
/// </summary>
public LineWidthCache(TextBuffer textBuffer)
{
_textBuffer = textBuffer;
}
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:7,代码来源:EditorView.LineWidthCache.cs
示例19: PrintTitle
private void PrintTitle(TextBuffer buffer,
ref TextIter iter)
{
if (game == null)
return;
string title = String.Format ("{0} vs {1}",
game.White,
game.Black);
buffer.CreateMark ("-1", iter, true);
buffer.InsertWithTagsByName (ref iter, title,
HEADING_TAG);
buffer.Insert (ref iter, "\n");
Widget tagdetails = GetTagDetailsWidget ();
TextChildAnchor anchor =
buffer.CreateChildAnchor (ref iter);
view.AddChildAtAnchor (tagdetails, anchor);
buffer.Insert (ref iter, "\n\n");
}
开发者ID:BackupTheBerlios,项目名称:csboard-svn,代码行数:20,代码来源:ChessGameView.cs
示例20: UpdateGameDetails
private void UpdateGameDetails(TextBuffer buffer,
ref TextIter iter)
{
PrintTitle (buffer, ref iter);
if (game == null)
return;
if (game.Comment != null)
{
buffer.InsertWithTags (ref
iter,
game.Comment,
commentTag);
buffer.Insert (ref iter, "\n");
}
int i = 0;
int moveno = 1;
foreach (PGNChessMove move in game.Moves)
{
if (i % 2 == 0)
{
buffer.InsertWithTags (ref
iter,
moveno.
ToString
(),
movenumberTag);
moveno++;
buffer.Insert (ref iter,
". ");
}
string markstr = i.ToString ();
string text = move.DetailedMove;
buffer.CreateMark (markstr, iter, true); // left gravity
TextTag link_tag = new TextTag (null);
tag_links[link_tag] = i;
taglinks.Add (link_tag);
buffer.TagTable.Add (link_tag);
buffer.InsertWithTags (ref iter, text,
moveTag,
link_tag);
marks[markstr] = text.Length;
buffer.Insert (ref iter, " ");
if (move.comment != null)
{
buffer.Insert (ref iter,
"\n");
buffer.InsertWithTags (ref
iter,
FormatComment
(move.
comment),
commentTag);
buffer.Insert (ref iter,
"\n");
}
i++;
}
}
开发者ID:BackupTheBerlios,项目名称:csboard-svn,代码行数:62,代码来源:ChessGameView.cs
注:本文中的TextBuffer类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论