Beispiel #1
0
        private void RenderSearchChanges(SearchHistory?searchHistory = null)
        {
            var totalItems  = !searchHistory.HasValue ? shell.History.Count : searchHistory.Value.SearchResults.Count;
            var currentItem = !searchHistory.HasValue ? 0 : searchHistory.Value.SelectedItem + 1;
            var match       = !searchHistory.HasValue || searchHistory.Value.SearchResults.Count == 0 ? string.Empty : searchHistory.Value.SearchResults[searchHistory.Value.SelectedItem];

            var minimalPrompt = "[" + currentItem + "/" + totalItems + "]: ";

            var matchedEntryMaxLength = implementation.WindowWidth - minimalPrompt.Length;

            if (match.Length > matchedEntryMaxLength)
            {
                match = match.Substring(0, matchedEntryMaxLength);
            }

            ColorString highlightedLine = string.Empty;

            if (searchHistory.HasValue && !string.IsNullOrWhiteSpace(match))
            {
                var notMatchedString  = new StringBuilder();
                var matchingPositions = FindAllIndexesOf(match.ToLowerInvariant(), searchHistory.Value.Term.ToLowerInvariant());
                for (int posInStr = 0; searchHistory != null && posInStr < match.Length; posInStr++)
                {
                    if (matchingPositions.Contains(posInStr))
                    {
                        highlightedLine += notMatchedString.ToString() + new ColorString(searchHistory.Value.Term, Color.Green);
                        notMatchedString.Clear();
                        posInStr += searchHistory.Value.Term.Length - 1;
                    }
                    else
                    {
                        notMatchedString.Append(match[posInStr]);
                    }
                }

                highlightedLine += notMatchedString.ToString();
            }

            // need to use the implementation functions as we are writing off the current line
            var pos = implementation.CursorLeft;

            implementation.CursorVisible = false;
            implementation.WriteLine();
            implementation.Write(new string(' ', implementation.WindowWidth - 1));
            implementation.CursorLeft = 0;

            implementation.Write(minimalPrompt);

            // our write function sets both implementation.CursorLeft and CursorPosition
            // we need to restore these to ensure we dont go out of sync
            var cpOld = ci.CursorPosition;

            ci.CursorPosition = minimalPrompt.Length;
            ci.Write(highlightedLine);
            ci.CursorPosition = cpOld;

            implementation.CursorTop--;
            implementation.CursorLeft    = pos;
            implementation.CursorVisible = true;
        }
 protected StringBuilder ObjectsToMarkedUpString(IEnumerable objects,
                                                 ColorString formatString,
                                                 StringBuilder sb,
                                                 bool dontGroupMultipleResults)
 {
     return(ObjectsToMarkedUpString(objects, formatString, sb, dontGroupMultipleResults, _FormatEnumerationLimit));
 } // end ObjectsToMarkedUpString
        } // end GenerateView()

        protected override void ApplyViewToInputObject()
        {
            for (int idx = 0; idx < m_view.ListItems.Count; idx++)
            {
                if (Stopping)
                {
                    break;
                }

                ColorString listItem = new ColorString(sm_labelColors);

                ListItem li = m_view.ListItems[idx];
                listItem.Append(PadAndAlign(li.Label,
                                            m_view.MaxLabelLength + 1,
                                            ColumnAlignment.Left) + ": ");

                listItem.Append(sm_pop.ToString(DbgProvider.HostSupportsColor));

                string val;
                if (li is PropertyListItem)
                {
                    var pli = (PropertyListItem)li;
                    val = RenderPropertyValue(InputObject,
                                              pli.PropertyName,
                                              pli.FormatString);
                }
                else
                {
                    var sli = (ScriptListItem)li;
                    val = RenderScriptValue(InputObject, sli.Script);
                    if (null == val)
                    {
                        val = String.Empty;
                    }
                }

                listItem.Append(_Indent(val));
                SafeWriteObject(listItem);
            }
            // N.B. Using String.Empty here used to cause 3 blank lines instead of one.
            // I don't understand precisely why, but the crux of the problem is that
            //
            //     a) System.String has a custom view definition (which is to get around
            //        PowerShell's reticence to properly display strings if they have
            //        other stuff in their TypeNames) (see commit 4bc7d1c76f97d0)
            //     b) When we write the string here, for some reason it causes a
            //        transition between steppable pipelines, and the PS default
            //        formatter wants to put in an extra newline at the format start and
            //        another at the format end.
            //
            // Fortunately, it seems easy enough to workaround by sending a different type
            // of object down the pipeline.
            //
            // (I wonder if it might have been specific to the particular commands I was
            // using to test, like "uf blah!blah | fl", or symbols | fl, because of how
            // their formatting was done.)
            //
            //SafeWriteObject( String.Empty ); // to get a blank line
            SafeWriteObject(ColorString.Empty);   // to get a blank line
        } // end ApplyViewToInputObject()
        public void Battle(BattleManager manager, Team playerTeam)
        {
            bool continuer = true;

            while (continuer)
            {
                Region region = _regionalMap.CurrentArea;

                ColorString introString = new ColorString($"You have entered the {region.AreaId} region");

                if (!string.IsNullOrWhiteSpace(region.RegionIntro?.GetFullString()))
                {
                    introString = region.RegionIntro;
                }

                _output.WriteLine(introString);

                BattleEndStatus battleEndStatus = BattleThroughRegion(region, manager, playerTeam);

                if (battleEndStatus != BattleEndStatus.Victory)
                {
                    continuer = false;
                }
                else
                {
                    region = _regionalMap.Advance(_decisionManager, playerTeam);

                    if (region == null)
                    {
                        continuer = false;
                    }
                }
            }
        }
Beispiel #5
0
        public void WriteLine(ColorString colorString)
        {
            List <ColorString> subStrings = colorString.SubStrings;
            int subStringLength           = subStrings.Count;

            if (subStringLength == 0)
            {
                Push(colorString.Value + "\n", MockOutputMessageType.Normal, colorString.Color);
            }
            else
            {
                for (var i = 0; i < subStringLength; ++i)
                {
                    ColorString subString = subStrings[i];

                    if (i == subStringLength - 1)
                    {
                        WriteLine(subString);
                    }
                    else
                    {
                        Write(subString);
                    }
                }
            }
        }
Beispiel #6
0
        } // end InterceptCtrlC()

        protected override void ProcessRecord()
        {
            if (!DbgProvider.IsInGuestMode)
            {
                throw new InvalidOperationException("This command is only intended to be used by the !dbgshell implementation.");
            }

            LogManager.Trace("WaitForBangDbgShellCommandCommand.ProcessRecord: DbgShell is going dormant.");

            using (var disposer = new ExceptionGuard())
            {
                disposer.Protect(SetDebuggerAndContextAndUpdateCallbacks());
                disposer.Protect(InterceptCtrlC());
                disposer.Protect(Debugger.SuspendEventOutput());   // don't want our "modload" output etc. spewing while we are dormant

                base.ProcessRecord();
                // We need to perform the wait on another thread, because we need to "pump"
                // on this thread, so that debug event callbacks can queue WriteObject calls
                // to this thread.
                _RegisterWaitForGuestModeEvent(disposer);

                // Give the user a hint about what's going on.
                var s = new ColorString(ConsoleColor.DarkGray,
                                        "(DbgShell will remain running in the background until you run !dbgshell again)").ToString(true);
                Host.UI.WriteLine(s);

                MsgLoop.Prepare();

                // This will allow the extension command to return (it tells the dbgeng
                // thread that it can return).
                DbgProvider.GuestModePassivate();

                MsgLoop.Run(); // This will complete when the guest mode event gets signaled.
            } // end using( disposer )
        } // end ProcessRecord()
Beispiel #7
0
        private void MouseInfoProvider_OnMouseDown(object sender, System.Drawing.Point p)
        {
            if (ColorString != null)
            {
                // nasty hack - sometimes clipboard can be in use and it will raise and exception
                for (int i = 0; i < 10; i++)
                {
                    try
                    {
                        Clipboard.SetText(ColorString.ToLowerInvariant());
                        break;
                    }
                    catch (COMException ex)
                    {
                        const uint CLIPBRD_E_CANT_OPEN = 0x800401D0;
                        if ((uint)ex.ErrorCode != CLIPBRD_E_CANT_OPEN)
                        {
                            Logger.LogError("Failed to set text into clipboard", ex);
                        }
                    }
                    System.Threading.Thread.Sleep(10);
                }
            }

            _appStateHandler.HideColorPicker();
        }
 protected HeapRegionBase(ulong heapBase, ColorString heapName, ulong baseAddress, ulong size, HeapTypeCache typeCache, DbgEngDebugger debugger)
     : base(baseAddress, size, debugger)
 {
     TypeCache  = typeCache;
     HeapBase   = new Address(heapBase, debugger.TargetIs32Bit);
     m_heapName = heapName ?? new ColorString("Heap ").Append(HeapBase);
 }
Beispiel #9
0
        public void CorrectlyOutputsColorString_RecursiveSubStrings([Values(1, 2)] int whichStringIsRecursive)
        {
            const string firstOutput  = "what if ";
            const string secondOutput = "there were ";
            const string thirdOutput  = "no rules?";

            const string expectedOutput = firstOutput + secondOutput + thirdOutput;

            ColorString firstSubString  = new ColorString(firstOutput, ConsoleColor.White);
            ColorString secondSubString = new ColorString(secondOutput, ConsoleColor.Green);
            ColorString thirdSubString  = new ColorString(thirdOutput, ConsoleColor.Blue);

            ColorString subString;
            ColorString colorString;

            if (whichStringIsRecursive == 1)
            {
                //1 and 2 comprise the subString
                subString   = new ColorString(firstSubString, secondSubString);
                colorString = new ColorString(subString, thirdSubString);
            }
            else
            {
                //2 and 3 comprise the subString
                subString   = new ColorString(secondSubString, thirdSubString);
                colorString = new ColorString(firstSubString, subString);
            }

            _output.WriteLine(colorString);

            StringBuilder outputStringBuilder = _textWriter.GetStringBuilder();
            string        output = outputStringBuilder.ToString();

            Assert.AreEqual(expectedOutput + "\r\n", output);
        }
 public PropertyColumn(string propertyName,
                       ColorString formatString,
                       ColumnAlignment alignment,
                       int width)
     : this(propertyName, formatString, null, alignment, width)
 {
 }
Beispiel #11
0
        public void GetFullStringMethod_RecursiveSubStrings()
        {
            //arrange
            const string firstSubString       = "this";
            ColorString  firstColorSubString  = new ColorString(firstSubString, ConsoleColor.Red);
            const string secondSubString      = "is";
            ColorString  secondColorSubString = new ColorString(secondSubString, ConsoleColor.Blue);

            ColorString firstCompositeSubString = new ColorString(firstColorSubString, secondColorSubString);

            const string thirdSubString       = "a";
            ColorString  thirdColorSubString  = new ColorString(thirdSubString, ConsoleColor.Green);
            const string fourthSubString      = "test";
            ColorString  fourthColorSubString = new ColorString(fourthSubString, ConsoleColor.Yellow);
            const string fifthSubString       = "!";
            ColorString  fifthColorSubString  = new ColorString(fifthSubString, ConsoleColor.White);

            ColorString secondCompositeSubString = new ColorString(thirdColorSubString, fourthColorSubString, fifthColorSubString);

            const string expectedFullString = firstSubString + secondSubString + thirdSubString + fourthSubString + fifthSubString;
            ColorString  colorString        = new ColorString(firstCompositeSubString, secondCompositeSubString);

            //act
            string actualString = colorString.GetFullString();

            //assert
            Assert.AreEqual(expectedFullString, actualString);
        }
Beispiel #12
0
        public void CorrectlyOutputsColors_RecursiveSubStrings()
        {
            const string firstOutput  = "what if ";
            const string secondOutput = "there were ";
            const string thirdOutput  = "no rules?";

            const ConsoleColor firstColor  = ConsoleColor.White;
            const ConsoleColor secondColor = ConsoleColor.Green;
            const ConsoleColor thirdColor  = ConsoleColor.Blue;

            ColorString subString   = new ColorString(new ColorString(secondOutput, secondColor), new ColorString(thirdOutput, thirdColor));
            ColorString colorString = new ColorString(new ColorString(firstOutput, firstColor), subString);

            _mockOutput.WriteLine(colorString);

            MockOutputMessage[] outputs = _mockOutput.GetOutputs();

            Assert.AreEqual(3, outputs.Length);

            MockOutputMessage output = outputs[0];

            Assert.AreEqual(firstOutput, output.Message);
            Assert.AreEqual(firstColor, output.Color);

            output = outputs[1];

            Assert.AreEqual(secondOutput, output.Message);
            Assert.AreEqual(secondColor, output.Color);

            output = outputs[2];

            Assert.AreEqual(thirdOutput + "\n", output.Message);
            Assert.AreEqual(thirdColor, output.Color);
        }
Beispiel #13
0
        public void CorrectlyOutputsColors_MultipleSubStrings()
        {
            const string firstOutput  = "Hello ";
            const string secondOutput = "World!";

            const ConsoleColor firstColor  = ConsoleColor.White;
            const ConsoleColor secondColor = ConsoleColor.Red;

            ColorString colorString = new ColorString(new ColorString(firstOutput, firstColor), new ColorString(secondOutput, secondColor));

            _mockOutput.WriteLine(colorString);

            MockOutputMessage[] outputs = _mockOutput.GetOutputs();

            Assert.AreEqual(2, outputs.Length);

            MockOutputMessage output = outputs[0];

            Assert.AreEqual(firstOutput, output.Message);
            Assert.AreEqual(firstColor, output.Color);

            output = outputs[1];

            Assert.AreEqual(secondOutput + "\n", output.Message);
            Assert.AreEqual(secondColor, output.Color);
        }
Beispiel #14
0
        protected override void HandleGit(Repository repo, string directory, string relativeDir, string repoUrl)
        {
            ConsoleEx.PrintLine(relativeDir);
            List <Branch> localBranches = repo.Branches
                                          .Where(b => !b.IsRemote)
                                          .OrderByDescending(b => b.IsCurrentRepositoryHead)
                                          .ThenBy(b => b.FriendlyName, StringComparer.OrdinalIgnoreCase)
                                          .ToList();

            foreach (var b in localBranches)
            {
                var branchDisplay = new ColorString("  ");
                if (b.IsCurrentRepositoryHead)
                {
                    branchDisplay.Text("* ");
                }
                else
                {
                    branchDisplay.Text("  ");
                }
                branchDisplay.Green(b.FriendlyName);
                if (b.IsTracking)
                {
                    branchDisplay.Reset("...")
                    .Red(b.TrackedBranch.FriendlyName);
                }
                ConsoleEx.PrintLine(branchDisplay);
            }
        }
Beispiel #15
0
 public FrameInfo(TextFrameType frameType, float paddingX, float paddingY, float strokeWidth, ColorString colorString)
 {
     _frameType   = frameType;
     _paddingX    = paddingX;
     _paddingY    = paddingY;
     _strokeWidth = strokeWidth;
     _colorString = colorString;
 }
Beispiel #16
0
            public List <List <ColorString> > GetLines()
            {
                if (activeTab == null)
                {
                    return(null);
                }

                var fullLineStrings = new List <ColorString>();
                var channelColor1   = line.Channel.FontColorRef;
                var channelColor2   = line.Channel.OutlineColorRef;
                var tab             = activeTab;

                if (tab.Timestamps && line.IncludePrefix)
                {
                    fullLineStrings.AddRange(ColorString.FromString(line.TimeStr, config.TimeColorRef, config.TimeColorShadowRef));
                }
                if (tab.ShowChannelTagAll && tab.ShowChannelTag[line.Channel.Name] && line.IncludePrefix)
                {
                    fullLineStrings.AddRange(ColorString.FromString(line.Channel.ShortName, channelColor1, channelColor2));
                }
                if (line.Sender != null && line.IncludePrefix)
                {
                    if (line.Sender.Payload.Type == PayloadType.Player)
                    {
                        fullLineStrings.AddRange(ColorString.PlayerName(line.Sender.Text, channelColor1, channelColor2, (PlayerPayload)line.Sender.Payload, line.Sender));
                    }
                    else
                    {
                        fullLineStrings.AddRange(ColorString.PlayerName(line.Sender.Text, channelColor1, channelColor2, null, line.Sender));
                    }
                }

                fullLineStrings.AddRange(line.Text.SelectMany(x =>
                {
                    switch (x.Type)
                    {
                    case PayloadType.RawText:
                        return(ColorString.FromString(x.Text, channelColor1, channelColor2));

                    case PayloadType.Player:
                        return(ColorString.PlayerName(x.Text, channelColor1, channelColor2, (PlayerPayload)x.Payload, x));

                    case PayloadType.MapLink:
                        return(ColorString.FromMapLink(x.Text, channelColor1, channelColor2, (MapLinkPayload)x.Payload, x));

                    case PayloadType.Status:
                        return(ColorString.FromStatus(x.Text, channelColor1, channelColor2, (StatusPayload)x.Payload, x));

                    case PayloadType.Item:
                        return(ColorString.FromItem(x.Text, (ItemPayload)x.Payload, x));

                    default:
                        return(new List <ColorString>());
                    }
                }));

                return(ComputeWrapLines(fullLineStrings, windowSize.X - 50));
            }
 /// <summary>
 /// Initializes a new instance of the <see cref="Furre"/> class.
 /// </summary>
 public Furre()
 {
     colorString  = new ColorString();
     location     = new FurrePosition();
     LastPosition = new FurrePosition();
     lastStat     = -1;
     name         = "Unknown";
     iD           = -1;
 }
 public PropertyColumn(string propertyName,
                       ColorString formatString,
                       string label,
                       ColumnAlignment alignment,
                       int width,
                       string tag)
     : this(propertyName, formatString, label, alignment, width, tag, TrimLocation.Right)
 {
 }
        public void TryParse_ParsesValidColorString()
        {
            const string colorString = @"ConsoleFx [Red.BgWhite]Suite";

            bool parseSuccessful = ColorString.TryParse(colorString, out ColorString cstr);

            parseSuccessful.ShouldBeTrue();
            cstr.ShouldNotBeNull();
        }
Beispiel #20
0
 protected string RenderPropertyValue(PSObject inputObject,
                                      string propertyName,
                                      ColorString formatString)
 {
     return(RenderPropertyValue(inputObject,
                                propertyName,
                                formatString,
                                dontGroupMultipleResults: false));
 }
Beispiel #21
0
 public ColorString(ColorString copy, string newText)
 {
     this.Text                   = newText;
     this.Color                  = copy.Color;
     this.ShadowColor            = copy.ShadowColor;
     this.ReferenceColor         = copy.ReferenceColor;
     this.ReferenceShadowColor   = copy.ReferenceShadowColor;
     this.UseChannelColors       = copy.UseChannelColors;
     this.SourcePayloadContainer = copy.SourcePayloadContainer;
 }
Beispiel #22
0
        private BattleEndStatus BattleThroughRegion(Region region, BattleManager manager, Team playerTeam)
        {
            bool            continuer       = true;
            BattleEndStatus battleEndStatus = BattleEndStatus.None;

            foreach (HumanFighter fighter in playerTeam.Fighters.OfType <HumanFighter>())
            {
                foreach (BattleMove regionMove in region.MovesUnlockedUponEnteringRegion)
                {
                    fighter.AddMove(regionMove);
                }
            }

            AreaMap <SubRegion, WorldSubRegion> subRegionalMap = _mapManager.GetSubRegionalMap(region.AreaId, region.SubRegions);

            while (continuer)
            {
                SubRegion subRegion = subRegionalMap.CurrentArea;
                subRegion.Fooed += PleaseDeleteMeIAmTerribleCode;
                _playerTeam      = playerTeam;

                ColorString introString = new ColorString($"You have entered the {subRegion.AreaId} sub region");

                if (!string.IsNullOrWhiteSpace(subRegion.RegionIntro?.GetFullString()))
                {
                    introString = subRegion.RegionIntro;
                }

                _output.WriteLine(introString);

                battleEndStatus = BattleThroughSubRegion(subRegion, manager, playerTeam);

                if (battleEndStatus != BattleEndStatus.Victory)
                {
                    continuer        = false;
                    subRegion.Fooed += PleaseDeleteMeIAmTerribleCode;
                }
                else
                {
                    List <HumanFighter> fighters = playerTeam.GetHumanFighters().ToList();
                    subRegion.ExecuteCutscene(_input, _output, fighters[0], fighters[1]);

                    subRegion.Fooed += PleaseDeleteMeIAmTerribleCode;

                    subRegion = subRegionalMap.Advance(_decisionManager, playerTeam);

                    if (subRegion == null)
                    {
                        continuer = false;
                    }
                }
            }

            return(battleEndStatus);
        }
 public NativeHeapSegmentRegion(ulong heapBase,
                                ColorString heapName,
                                PSObject heapSegment,
                                ulong heapEncoding,
                                HeapTypeCache typeCache,
                                DbgEngDebugger debugger)
     : base(heapBase, heapName, SegmentBase(heapSegment), SegmentSize(heapSegment), typeCache, debugger)
 {
     m_heapSegment  = heapSegment;
     m_heapEncoding = heapEncoding;
 }
Beispiel #24
0
        public PropertyListItem(string propertyName, ColorString formatString, string label)
        {
            if (String.IsNullOrEmpty(propertyName))
            {
                throw new ArgumentException("You must supply a property name.", "propertyName");
            }

            PropertyName = propertyName;
            FormatString = formatString;
            m_label      = label;
        } // end constructor
Beispiel #25
0
        public void GetFullStringMethod_NoSubstrings()
        {
            //arrange
            const string expectedFullString = "you've got to fight, for your right, to party!";
            ColorString  colorString        = new ColorString(expectedFullString);

            //act
            string actualString = colorString.GetFullString();

            //assert
            Assert.AreEqual(expectedFullString, actualString);
        }
Beispiel #26
0
        public void CorrectlyOutputsColorString_NoSubStrings()
        {
            const string expectedOutput = "Hello World!";
            ColorString  colorString    = new ColorString(expectedOutput, ConsoleColor.Red);

            _output.WriteLine(colorString);

            StringBuilder outputStringBuilder = _textWriter.GetStringBuilder();
            string        output = outputStringBuilder.ToString();

            Assert.AreEqual(expectedOutput + "\r\n", output);
        }
Beispiel #27
0
        protected string RenderPropertyValue(PSObject inputObject,
                                             string propertyName,
                                             ColorString formatString,
                                             bool dontGroupMultipleResults,
                                             bool allowMultipleLines)
        {
            PSPropertyInfo pi = inputObject.Properties[propertyName];

            if (null == pi)
            {
                var val = sm_PropNotFoundFmt.ToString(DbgProvider.HostSupportsColor);
                val = Util.Sprintf(val, propertyName);
                var e = new PropertyNotFoundException(Util.Sprintf("Property not found: {0}", propertyName));
                try { throw e; } catch (Exception) { };  // give it a stack
                ErrorRecord er = new ErrorRecord(e, "MissingProperty", ErrorCategory.InvalidData, inputObject);
                AddToError(er);
                return(val);
            }

            try
            {
                var         obj        = pi.Value;
                IEnumerable enumerable = obj as IEnumerable;
                if ((null != enumerable) && _ShouldUnroll(enumerable))
                {
                    return(ObjectsToMarkedUpString(enumerable,
                                                   formatString,
                                                   null,
                                                   dontGroupMultipleResults).ToString());
                }

                // If a formatString was specified, let /it/ control the display, instead of FormatSingleLine.
                if (null == formatString)
                {
                    return(ObjectToMarkedUpString(FormatSingleLine(pi.Value, allowMultipleLines),
                                                  formatString).ToString());
                }
                else
                {
                    return(ObjectToMarkedUpString(pi.Value, formatString).ToString());
                }
            }
            catch (RuntimeException rte)
            {
                AddToError(Util.FixErrorRecord(rte.ErrorRecord, rte));

                return(new ColorString(ConsoleColor.Red,
                                       Util.Sprintf("<Error: {0}>",
                                                    Util.GetExceptionMessages(rte)))
                       .ToString(DbgProvider.HostSupportsColor));
            }
        } // end RenderPropertyValue()
Beispiel #28
0
 internal StaticText(FunctionOrColorString message)
     : base(message)
 {
     _askerFn = (q, ans) =>
     {
         ColorString staticText = q.Message.Resolve(ans);
         if (staticText != null)
         {
             ConsoleEx.PrintLine(staticText);
         }
         return(null);
     };
 }
Beispiel #29
0
        public void ConvertANSI()
        {
            byte[] ansiStrBytes = new byte[] {
                0x1B, 0x5B, 0x30, 0x3B, 0x33, 0x38, 0x3B, 0x35,
                0x3B, 0x32, 0x33, 0x31, 0x3B, 0x34, 0x38, 0x3B,
                0x35, 0x3B, 0x33, 0x31, 0x3B, 0x31, 0x6D, 0xC2,
                0xA0, 0x75, 0x73, 0x65, 0x72, 0xC2, 0xA0, 0x1B,
                0x5B, 0x30, 0x3B, 0x33, 0x38, 0x3B, 0x35, 0x3B,
                0x33, 0x31, 0x3B, 0x34, 0x38, 0x3B, 0x35, 0x3B,
                0x32, 0x34, 0x30, 0x3B, 0x32, 0x32, 0x6D, 0xEE,
                0x82, 0xB0, 0xC2, 0xA0, 0x1B, 0x5B, 0x30, 0x3B,
                0x33, 0x38, 0x3B, 0x35, 0x3B, 0x32, 0x35, 0x30,
                0x3B, 0x34, 0x38, 0x3B, 0x35, 0x3B, 0x32, 0x34,
                0x30, 0x6D, 0xE2, 0x80, 0xA6, 0xC2, 0xA0, 0x1B,
                0x5B, 0x30, 0x3B, 0x33, 0x38, 0x3B, 0x35, 0x3B,
                0x32, 0x34, 0x35, 0x3B, 0x34, 0x38, 0x3B, 0x35,
                0x3B, 0x32, 0x34, 0x30, 0x3B, 0x32, 0x32, 0x6D,
                0xEE, 0x82, 0xB1, 0xC2, 0xA0, 0x1B, 0x5B, 0x30,
                0x3B, 0x33, 0x38, 0x3B, 0x35, 0x3B, 0x32, 0x35,
                0x30, 0x3B, 0x34, 0x38, 0x3B, 0x35, 0x3B, 0x32,
                0x34, 0x30, 0x6D, 0x62, 0x69, 0x6E, 0xC2, 0xA0,
                0x1B, 0x5B, 0x30, 0x3B, 0x33, 0x38, 0x3B, 0x35,
                0x3B, 0x32, 0x34, 0x35, 0x3B, 0x34, 0x38, 0x3B,
                0x35, 0x3B, 0x32, 0x34, 0x30, 0x3B, 0x32, 0x32,
                0x6D, 0xEE, 0x82, 0xB1, 0xC2, 0xA0, 0x1B, 0x5B,
                0x30, 0x3B, 0x33, 0x38, 0x3B, 0x35, 0x3B, 0x32,
                0x35, 0x30, 0x3B, 0x34, 0x38, 0x3B, 0x35, 0x3B,
                0x32, 0x34, 0x30, 0x6D, 0x44, 0x65, 0x62, 0x75,
                0x67, 0xC2, 0xA0, 0x1B, 0x5B, 0x30, 0x3B, 0x33,
                0x38, 0x3B, 0x35, 0x3B, 0x32, 0x34, 0x35, 0x3B,
                0x34, 0x38, 0x3B, 0x35, 0x3B, 0x32, 0x34, 0x30,
                0x3B, 0x32, 0x32, 0x6D, 0xEE, 0x82, 0xB1, 0xC2,
                0xA0, 0x1B, 0x5B, 0x30, 0x3B, 0x33, 0x38, 0x3B,
                0x35, 0x3B, 0x32, 0x35, 0x32, 0x3B, 0x34, 0x38,
                0x3B, 0x35, 0x3B, 0x32, 0x34, 0x30, 0x3B, 0x31,
                0x6D, 0x6E, 0x65, 0x74, 0x63, 0x6F, 0x72, 0x65,
                0x61, 0x70, 0x70, 0x33, 0x2E, 0x31, 0xC2, 0xA0,
                0x1B, 0x5B, 0x30, 0x3B, 0x33, 0x38, 0x3B, 0x35,
                0x3B, 0x32, 0x34, 0x30, 0x3B, 0x34, 0x39, 0x3B,
                0x32, 0x32, 0x6D, 0xEE, 0x82, 0xB0, 0xC2, 0xA0,
                0x1B, 0x5B, 0x30, 0x6D, 0x0A
            };

            var strData = Encoding.UTF8.GetString(ansiStrBytes);

            var cString = ColorString.FromRawANSI(strData);

            Assert.AreEqual(43, cString.Length);
            Assert.AreEqual(43, cString.Text.Length);
            Assert.AreNotEqual(43, cString.TextWithFormattingCharacters.Length);
        }
Beispiel #30
0
        public void Write(ColorString colorString)
        {
            List <ColorString> subStrings = colorString.SubStrings;
            int subStringLength           = subStrings.Count;

            if (subStringLength == 0)
            {
                Push(colorString.Value, MockOutputMessageType.Normal, colorString.Color);
            }
            else
            {
                subStrings.ForEach(Write);
            }
        }
Beispiel #31
0
        public IrcMessageChatViewEntry(IrcMessage ircMessage)
        {
            IrcMessage = ircMessage;
            Mode = true;

            int AccentColor = 202;

            Prefix = new ColorString(string.Format("{0} {1}\x0000255  ", DecorateTime(AccentColor), DecorateNick(AccentColor, ' ')));

            var str = (IrcMessage.Contents == null ? "EMPTY" : IrcMessage.Contents);
            Message = new ColorString(str);
        }
Beispiel #32
0
 public virtual void DrawStatusBar(ColorString text)
 {
     text.Fill(this);
     Curses.attron(ColorPair.From(-1, -1).Attribute);
 }
Beispiel #33
0
 public JoinChatViewEntry(IrcMessage message)
     : base(message)
 {
     Prefix = new ColorString(DecorateTime(202));
     Message = new ColorString(string.Format(" \x0000255 {0} joined {1}", Nick, Channel));
 }