Last change
on this file since 4945 was
4909,
checked in by epitzer, 14 years ago
|
Several GUI improvements (#47)
- add icons and tool tips
- add support for suspending the operator trace view
- faster skipping of stack-only operations
- remove log view and execution time view
|
File size:
1006 bytes
|
Rev | Line | |
---|
[4871] | 1 | using System;
|
---|
| 2 | using System.Text;
|
---|
[4909] | 3 | using System.Text.RegularExpressions;
|
---|
[4871] | 4 | using HeuristicLab.Persistence.Auxiliary;
|
---|
| 5 |
|
---|
| 6 | namespace HeuristicLab.DebugEngine {
|
---|
| 7 | public static class Utils {
|
---|
| 8 | public static string TypeName(object obj) {
|
---|
| 9 | if (obj == null)
|
---|
| 10 | return "null";
|
---|
| 11 | return TypeNameParser.Parse(obj.GetType().ToString()).GetTypeNameInCode(true);
|
---|
| 12 | }
|
---|
[4909] | 13 | public static string Wrap(string text, int columns) {
|
---|
| 14 | StringBuilder sb = new StringBuilder();
|
---|
| 15 | Regex whitespace = new Regex("\\s");
|
---|
| 16 | int lineLength = 0;
|
---|
| 17 | foreach (var word in whitespace.Split(text)) {
|
---|
| 18 | if (lineLength + word.Length < columns) {
|
---|
| 19 | if (lineLength > 0) {
|
---|
| 20 | sb.Append(' ');
|
---|
| 21 | lineLength++;
|
---|
| 22 | }
|
---|
| 23 | sb.Append(word);
|
---|
| 24 | lineLength += word.Length;
|
---|
| 25 | } else {
|
---|
| 26 | sb.Append(Environment.NewLine).Append(word);
|
---|
| 27 | lineLength = word.Length;
|
---|
| 28 | }
|
---|
| 29 | }
|
---|
| 30 | return sb.ToString();
|
---|
| 31 | }
|
---|
[4871] | 32 | }
|
---|
| 33 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.