Esempio n. 1
0
        public void no_customers_found()
        {
            var customers = new List <Customer>
            {
                new("doe", new List <IPreference>
                {
                    new DayOfTheMonthPreference(new[] { 4 })
                }),
                new("rod", new List <IPreference>
                {
                    new DayOfTheWeekPreference(DaysOfTheWeek.Thursday)
                })
            };

            var output =
                new OutputBuilder(
                    _dateToTest,
                    customers,
                    2)
                .Build();

            Assert.Equal(3, output.Count);
            Assert.Equal("Monday, 03 May 2021: There are no customers to contact on this day", output[0]);
            Assert.Equal("Tuesday, 04 May 2021: doe", output[1]);
            Assert.Equal("Wednesday, 05 May 2021: There are no customers to contact on this day", output[2]);
        }
Esempio n. 2
0
        public void TestFixedWidthFormatter()
        {
            var elems = new List <ChemicalElement>()
            {
                new ChemicalElement {
                    Name = "Hydrogen", AtomicNumber = 1, DiscoveryDate = new DateTime(1766, 5, 16), Symbol = "H"
                },
                new ChemicalElement {
                    Name = "Phosporous", AtomicNumber = 15, DiscoveryDate = new DateTime(1669, 7, 17), Symbol = "P"
                },
                new ChemicalElement {
                    Name = "Cobalt", AtomicNumber = 27, DiscoveryDate = new DateTime(1732, 10, 11), Symbol = "Co"
                }
            };


            var serializer = new FixedWidthSerializer();

            var outputBuilder = new OutputBuilder()
                                .SetSerializer(new FixedWidthSerializer());

            File.Delete("chemistry.txt");

            var transport = new LocalFileTransport()
            {
                FilePath = @"chemistry.txt"
            };

            var integ = new Integrator();

            integ.SendData(outputBuilder, transport);


            return;
        }
        public void OutputBuilderTests_BuildProductLines_NullProductValue_ThrowsException()
        {
            //arrange
            var     sut   = new OutputBuilder();
            IMinMax range = GetMinMaxMock(1, 5, 3); // Irrelevant to this test

            IAccumulatedProduct[] mockData =
            {
                GetAccumulatedProductMock("a", new double[0]),
                GetAccumulatedProductMock("b", null),
                GetAccumulatedProductMock("c", new double[0]),
            };
            IAccumulatedProducts mockDatas = GetAccumulatedProductsMock(range, mockData);
            bool   exceptionThrown         = false;
            string exceptionMessage        = "";

            //act
            try
            {
                sut.BuildProductLines(mockDatas);
            }
            catch (InvalidOperationException e)
            {
                exceptionThrown  = true;
                exceptionMessage = e.Message;
            }
            //assert
            Assert.IsTrue(exceptionThrown);
            Assert.AreEqual("Accumulated product 1 value: not allowed to be null", exceptionMessage);
        }
Esempio n. 4
0
        private void ViewRaceDescription(string race)
        {
            var raceToView = race.Replace("view ", string.Empty);

            var cultureInfo = Thread.CurrentThread.CurrentCulture;
            var textInfo    = cultureInfo.TextInfo;

            var properCaseRace = textInfo.ToTitleCase(raceToView);

            var foundRace = (from r in gameRaces
                             where r.Name == properCaseRace
                             select r).FirstOrDefault();

            if (foundRace != null)
            {
                var output = new OutputBuilder();
                output.AppendSeparator('=', "yellow", true);
                output.AppendLine($"Description for {foundRace.Name}");
                output.AppendSeparator('-', "yellow");
                output.AppendLine($"<%b%><%white%>{foundRace.Description}<%n%>");
                output.AppendSeparator('=', "yellow", true);
                Session.Write(output);
            }
            else
            {
                WrmChargenCommon.SendErrorMessage(Session, "That race does not exist.");
            }
        }
Esempio n. 5
0
        public override CommandResult Execute(CommandEventArgs commandEventArgs)
        {
            // TODO: Update once command dictionary is created to iterate Keys and output valid commands.
            // TODO: Create help file for each command.
            try
            {
                base.Execute(commandEventArgs);
            }
            catch (CommandException ex)
            {
                return(ex.CommandResult);
            }

            var output = new OutputBuilder();

            output.Append("Valid commands are:");

            output.Append(
                Formatter.NewTableFromList(
                    CommandService.AvailableCommands(
                        commandEventArgs.PrivilegeOverride == null
                                                        ? commandEventArgs.Entity.PrivilegeLevel
                                                        : (PrivilegeLevel)commandEventArgs.PrivilegeOverride),
                    6, 5, Formatter.DefaultIndent));

            return(CommandResult.Success(output.Output));
        }
        private void updateOutput()
        {
            var newOutput    = new OutputBuilder();
            var outPutString = newOutput.BuildFullOutput(this.taskCollection);

            this.outputTextBox.Text = outPutString;
        }
Esempio n. 7
0
        public unsafe string render()
        {
            OutputBuilder ob = new OutputBuilder();

            cs_render(csp, null, new CSOUTFUNC(ob.handleOutput));
            return(ob.result());
        }
Esempio n. 8
0
        public override OutputBuilder Render()
        {
            var topics = HelpManager.Instance.GetHelpTopics().Where(topic => topic.Aliases.Count > 0);

            var output = new OutputBuilder();

            if (!topics.Any())
            {
                output.AppendLine("There are no help topics written yet.");
                return(output);
            }

            // Format the first column to the number of characters to fit the longest topic, then have the description to the right of that.
            var lineFormat = "{0," + -1 * HelpManager.Instance.MaxPrimaryAliasLength + "} {1}";

            output.AppendLine("Available help topics:");
            output.AppendSeparator(color: "yellow");
            foreach (var topic in topics)
            {
                var primaryAlias = topic.Aliases.FirstOrDefault();
                output.AppendLine(string.Format(lineFormat, primaryAlias, "TODO: Topic Short Description Support Here"));
            }
            output.AppendSeparator(color: "yellow");

            output.AppendLine();
            output.AppendLine("<%yellow%>NOTE:<%n%> You can also use the \"<%green%>commands<%n%>\" command to list out commands, and you can get help for a specific command with \"<%green%>help <command name><%n%>\".");
            return(output);
        }
Esempio n. 9
0
        public override CommandResult Execute(CommandEventArgs commandEventArgs)
        {
            try
            {
                base.Execute(commandEventArgs);
            }
            catch (CommandException ex)
            {
                return(ex.CommandResult);
            }

            var room = commandEventArgs.Entity.GetInstanceParentRoom();

            if (room == null)
            {
                return(CommandResult.Failure("You must be in a shop first."));
            }

            if (!room.IsShop)
            {
                return(CommandResult.Failure("There is no shop available here."));
            }

            var output     = new OutputBuilder();
            var nameToSell = CommandService.ParseFirstArgument(commandEventArgs.Argument).ToUpper();

            if (nameToSell == "")
            {
                return(CommandResult.InvalidSyntax(nameof(Sell), new List <string> {
                    "item name"
                }));
            }

            // Search inventory for a match
            var inventoryEntities = commandEventArgs.Entity.GetInventoryItems();

            if (inventoryEntities.Count == 0)
            {
                return(new CommandResult(ResultCode.FAIL, "You don't have anything to sell!"));
            }

            var itemMatched = Parse.MatchOnEntityNameByOrder(nameToSell, inventoryEntities.Cast <IEntity>().ToList());

            if (itemMatched == null)
            {
                return(CommandResult.Failure("You can't seem to find it."));
            }

            var item = (EntityInanimate)itemMatched;

            output.Append($"You sell {item.ShortDescription} for {item.Value}!");

            // Remove item and give currency
            commandEventArgs.Entity.RemoveInventoryItem(item.Instance);
            commandEventArgs.Entity.Currency += item.Value;

            DataAccess.Remove <EntityInanimate>(item.Instance, CacheType.Instance);

            return(CommandResult.Success(output.Output));
        }
Esempio n. 10
0
        private void RefreshScreen()
        {
            var output = new OutputBuilder();

            output.AppendLine();
            output.AppendLine("You may pick three starting skills for your character.");
            int n = 1;

            foreach (var skill in selectedSkills)
            {
                output.AppendLine($"Skill #{n} : {skill.Name}");
                n++;
            }
            output.AppendLine();
            output.AppendLine("<%green%>Please select 3 from the list below:<%n%>");
            FormatSkillText(output);
            output.AppendLine($"<%green%>You have {3 - selectedSkills.Count} skills left.<%n%>");
            output.AppendSeparator('=', "yellow", true);
            output.AppendLine("To pick a skill, type the skill's name. Example: unarmed");
            output.AppendLine("To view a skill's description use the view command. Example: view unarmed");
            output.AppendLine("To see this screen again type list.");
            output.AppendLine("When you are done picking your three skills, type done.");
            output.AppendSeparator('=', "yellow", true);

            Session.Write(output);
        }
Esempio n. 11
0
        /// <summary>
        /// Lists known skills
        /// </summary>
        public override CommandResult Execute(CommandEventArgs commandEventArgs)
        {
            try
            {
                base.Execute(commandEventArgs);
            }
            catch (CommandException ex)
            {
                return(ex.CommandResult);
            }

            EntityAnimate entity = commandEventArgs.Entity;

            List <ISkill> skills = new List <ISkill>();

            foreach (var s in entity.Skills)
            {
                skills.Add(s);
            }

            OutputBuilder result = new OutputBuilder();

            foreach (var s in skills)
            {
                result.Append($"{SkillMap.SkillToFriendlyName(s.GetType())} [{(int)s.SkillLevel}]\n");
            }

            return(CommandResult.Success(result.Output));
        }
Esempio n. 12
0
        public override CommandResult Execute(CommandEventArgs commandEventArgs)
        {
            try
            {
                base.Execute(commandEventArgs);
            }
            catch (CommandException ex)
            {
                return(ex.CommandResult);
            }

            var output   = new OutputBuilder("Inventory: ");
            var entities = commandEventArgs.Entity.GetInventoryItems();

            if (entities.Count == 0)
            {
                output.Append("You aren't carrying anything.");
            }
            else
            {
                var itemDescriptions = EntityQuantityMapper.ParseEntityQuantitiesAsStrings(entities, EntityQuantityMapper.MapStringTypes.ShortDescription);
                output.Append(Formatter.NewTableFromList(itemDescriptions, 1, 4, 0));
            }

            return(CommandResult.Success(output.Output));
        }
Esempio n. 13
0
        /// <summary>Executes the command.</summary>
        /// <param name="actionInput">The full input specified for executing the command.</param>
        public override void Execute(ActionInput actionInput)
        {
            var session = actionInput.Session;

            if (session == null)
            {
                return;                  // This action only makes sense for player sessions.
            }
            var parameters = actionInput.Params;

            // Ensure two 'credits' commands at the same time do not race for shared cache, etc.
            lock (cacheLockObject)
            {
                if (cachedContents == null || parameters.Length > 0 && parameters[0].ToLower() == "reload")
                {
                    using var reader = new StreamReader(Path.Combine(GameConfiguration.DataStoragePath, "Credits.txt"));
                    var    output = new OutputBuilder();
                    string s;
                    while ((s = reader.ReadLine()) != null)
                    {
                        if (!s.StartsWith(";"))
                        {
                            output.AppendLine(s);
                        }
                    }

                    cachedContents = output;
                }

                session.Write(cachedContents);
            }
        }
Esempio n. 14
0
        private void AddFriend(IController sender, Thing targetFriend)
        {
            var output = new OutputBuilder();

            if (targetFriend == null)
            {
                output.AppendLine("Doesn't appear to be online at the moment.");
                sender.Write(output);
                return;
            }

            if (targetFriend == player)
            {
                output.AppendLine("You cannot add yourself as a friend.");
                sender.Write(output);
                return;
            }

            if (playerBehavior.Friends.Contains(targetFriend.Name))
            {
                output.AppendLine($"{player.Name} is already on your friends list.");
                sender.Write(output);
                return;
            }

            playerBehavior.AddFriend(player.Name);

            output.AppendLine($"You have added {targetFriend.Name} to your friends list.");
            sender.Write(output);
        }
Esempio n. 15
0
        public override void RunBody(OutputBuilder builder)
        {
            GlobalMinorShear = 0;
            GlobalMajorShear = 0;
            GlobalAxial      = 0;

            //Componenets of Major Shear
            GlobalMajorShear = LocalMajorShear;

            //Componenets of Minor Shear
            if (Bearing >= 0)
            {
                GlobalMinorShear += Math.Cos(Bearing * Math.PI / 180) * LocalMinorShear;
            }
            else
            {
                GlobalMinorShear -= Math.Cos(Bearing * Math.PI / 180) * LocalMinorShear;
            }

            GlobalAxial += -Math.Sin(Bearing * Math.PI / 180) * LocalMinorShear;

            //Componenets of Axial
            GlobalAxial      += Math.Cos(Bearing * Math.PI / 180) * LocalAxial;
            GlobalMinorShear += Math.Sin(Bearing * Math.PI / 180) * LocalAxial;
        }
Esempio n. 16
0
        private bool InstallUsePnPUtil(string fileName)
        {
            try
            {
                var startInfo = new ProcessStartInfo("pnputil", $"-i -a {fileName}")
                {
                    Verb                   = "runas",
                    CreateNoWindow         = true,
                    UseShellExecute        = false,
                    RedirectStandardOutput = true,
                    RedirectStandardError  = true,
                };
                var outputBuilder = new OutputBuilder();
                int exitCode      = 0;
                using (var proc = Process.Start(startInfo))
                {
                    proc.OutputDataReceived += (s, e) => { outputBuilder.AppendOut(e.Data); };
                    proc.ErrorDataReceived  += (s, e) => { outputBuilder.AppendError(e.Data); };
                    proc.Start();
                    proc.BeginOutputReadLine();
                    proc.BeginErrorReadLine();
                    proc.WaitForExit();
                    exitCode = proc.ExitCode;
                    proc.Dispose();
                    return(exitCode == 0);
                }
            }
            catch (Exception ex)
            {
                SLogger <OSImpl> .Warn("failed", ex);

                return(false);
            }
        }
Esempio n. 17
0
        public void TestAppendLine()
        {
            var output = new OutputBuilder().AppendLine(shortMessage);

            // Should build line with \r\n (per Telnet spec) regardless of the environment running this test; Do not apply Environment.NewLine to code here.
            Assert.AreEqual(shortMessage + "\r\n", output.Parse(terminalOptions));
        }
Esempio n. 18
0
        /// <summary>Shows who is currently following the player, and who the player is following.</summary>
        /// <remarks>TODO: Replace the sender.Write() calls with something more general, e.g. an event.</remarks>
        /// <param name="actionInput">The action input.</param>
        private void ShowStatus(ActionInput actionInput)
        {
            var senderBehaviors   = actionInput.Actor.Behaviors;
            var followingBehavior = senderBehaviors.FindFirst <FollowingBehavior>();
            var followedBehavior  = senderBehaviors.FindFirst <FollowedBehavior>();

            var output = new OutputBuilder().Append("You are following: ");

            output.AppendLine(followingBehavior == null ? "(nobody)" : followingBehavior.Target.Name);

            output.Append("You are being followed by: ");

            if (followedBehavior == null)
            {
                output.AppendLine("(nobody)");
            }
            else
            {
                lock (followedBehavior.Followers)
                {
                    var followers = followedBehavior.Followers.Select(f => f.Name).BuildPrettyList();
                    output.AppendLine(followers);
                }
            }

            actionInput.Session?.Write(output);
        }
Esempio n. 19
0
        /// <summary>
        /// 主方法
        /// </summary>
        /// <param name="toolKit"></param>
        /// <returns></returns>
        protected override Output MainMethod(ToolKit <ApkInstallerArgs> toolKit)
        {
            Logger.Info(this, $"Install starts....have {toolKit.Args.Files.Count} Apks");
            OutputBuilder result = new OutputBuilder();

            result.Register(toolKit.Executer);
            foreach (FileInfo apkFileInfo in toolKit.Args.Files)
            {
                Command command =
                    Command.MakeForCmd(
                        $"{AdbConstants.FullAdbFileName} {toolKit.Args.Serial.ToFullSerial()} install -r \"{apkFileInfo.FullName}\"");

                var  installResult     = toolKit.Executer.Execute(command);
                bool currentSuccessful = !installResult.Contains("failure");
                if (!currentSuccessful)
                {
                    errorCount++;
                }
                var args = new AApkInstalltionCompleteArgs()
                {
                    ApkFileInfo = apkFileInfo,
                    IsSuccess   = currentSuccessful,
                    Output      = installResult,
                };
                if (AApkIstanlltionCompleted?.Invoke(this, args) != true)
                {
                    break;
                }
            }
            return(result.ToOutput());
        }
        public override OutputBuilder Render(TerminalOptions terminalOptions, HelpTopic helpTopic)
        {
            var output = new OutputBuilder();

            // TODO: What was this !element doing? Does it still work? Test with zMUD or something and re-read MXP specs?
            if (terminalOptions.UseMXP)
            {
                output.AppendLine($"{AnsiSequences.MxpSecureLine}<!element see '<send href=\"help &cref;\">' att='cref' open>");
            }

            output.AppendSeparator(color: "yellow", design: '=');
            output.AppendLine($"HELP TOPIC: {helpTopic.Aliases.First()}");
            output.AppendSeparator(color: "yellow");

            if (terminalOptions.UseMXP)
            {
                var lines = helpTopic.Contents.Split(new string[] { AnsiSequences.NewLine }, StringSplitOptions.None);
                foreach (var line in lines)
                {
                    output.AppendLine($"{AnsiSequences.MxpOpenLine}{line}<%n%>");
                }
            }
            else
            {
                output.AppendLine($"{helpTopic.Contents}");
            }

            output.AppendSeparator(color: "yellow", design: '=');
            return(output);
        }
Esempio n. 21
0
        public void TestAppendLine()
        {
            var output         = new OutputBuilder().AppendLine(originalMessage);
            var actualMesssage = output.Parse(terminalOptions);

            Assert.AreEqual(originalMessage + "\r\n", actualMesssage);
        }
Esempio n. 22
0
        /// <summary>Executes the command.</summary>
        /// <param name="actionInput">The full input specified for executing the command.</param>
        public override void Execute(ActionInput actionInput)
        {
            var session = actionInput.Session;

            if (session == null)
            {
                return;                  // This action only makes sense for player sessions.
            }
            var output = new OutputBuilder();

            foreach (var kvp in actionInput.Actor.Stats)
            {
                output.Append(kvp.Value.Name.PadRight(20));
                output.Append(kvp.Value.Value);
                output.AppendLine();
            }

            foreach (var kvp in actionInput.Actor.Attributes)
            {
                output.Append(kvp.Value.Name.PadRight(20));
                output.Append(kvp.Value.Value);
                output.AppendLine();
            }

            session.Write(output);
        }
Esempio n. 23
0
        private void FormatTalentText(OutputBuilder outputBuilder)
        {
            var talentQueue = new Queue <Talent>();

            foreach (var gameTalent in talents)
            {
                // Find out what talent name is the longest
                if (gameTalent.Name.Length > longestTalentName)
                {
                    longestTalentName = gameTalent.Name.Length;
                }

                talentQueue.Enqueue(gameTalent);
            }

            var rows = talents.Count / 4;

            try
            {
                for (var i = 0; i < rows; i++)
                {
                    var talent1 = WrmChargenCommon.FormatToColumn(longestTalentName, talentQueue.Dequeue().Name);
                    var talent2 = WrmChargenCommon.FormatToColumn(longestTalentName, talentQueue.Dequeue().Name);
                    var talent3 = WrmChargenCommon.FormatToColumn(longestTalentName, talentQueue.Dequeue().Name);
                    var talent4 = WrmChargenCommon.FormatToColumn(longestTalentName, talentQueue.Dequeue().Name);
                    outputBuilder.AppendLine($"{talent1}  {talent2}  {talent3}  {talent4}");
                }

                if ((rows % 4) > 0)
                {
                    var columns = rows - (rows * 4);

                    switch (columns)
                    {
                    case 1:
                        var talentcolumn1 = WrmChargenCommon.FormatToColumn(longestTalentName, talentQueue.Dequeue().Name);
                        outputBuilder.AppendLine($"{talentcolumn1}");
                        break;

                    case 2:
                        var tk1 = WrmChargenCommon.FormatToColumn(longestTalentName, talentQueue.Dequeue().Name);
                        var tk2 = WrmChargenCommon.FormatToColumn(longestTalentName, talentQueue.Dequeue().Name);
                        outputBuilder.AppendLine($"{tk1}  {tk2}");
                        break;

                    case 3:
                        var tkl1 = WrmChargenCommon.FormatToColumn(longestTalentName, talentQueue.Dequeue().Name);
                        var tkl2 = WrmChargenCommon.FormatToColumn(longestTalentName, talentQueue.Dequeue().Name);
                        var tkl3 = WrmChargenCommon.FormatToColumn(longestTalentName, talentQueue.Dequeue().Name);
                        outputBuilder.AppendLine($"{tkl1}  {tkl2}  {tkl3}");
                        break;
                    }
                }
            }
            catch
            {
                // ignored
            }
        }
Esempio n. 24
0
        public override void Begin()
        {
            var output = new OutputBuilder();

            output.AppendLine("You will now pick your character's starting talent.");
            Session.Write(output, false);
            RefreshScreen();
        }
Esempio n. 25
0
        public void TestClear()
        {
            var output = new OutputBuilder().Append(shortMessage);

            Assert.AreNotEqual(output.Parse(terminalOptions), "");
            output.Clear();
            Assert.AreEqual(output.Parse(terminalOptions), "");
        }
Esempio n. 26
0
        private void FormatRaceText(OutputBuilder outputBuilder)
        {
            var raceQueue = new Queue <GameRace>();
            var rows      = gameRaces.Count / 4;

            foreach (var gameRace in gameRaces)
            {
                // Find out what skill name is the longest
                if (gameRace.Name.Length > longestRaceName)
                {
                    longestRaceName = gameRace.Name.Length;
                }

                raceQueue.Enqueue(gameRace);
            }

            try
            {
                for (var i = 0; i < rows; i++)
                {
                    var race1 = WrmChargenCommon.FormatToColumn(longestRaceName, raceQueue.Dequeue().Name);
                    var race2 = WrmChargenCommon.FormatToColumn(longestRaceName, raceQueue.Dequeue().Name);
                    var race3 = WrmChargenCommon.FormatToColumn(longestRaceName, raceQueue.Dequeue().Name);
                    var race4 = WrmChargenCommon.FormatToColumn(longestRaceName, raceQueue.Dequeue().Name);
                    outputBuilder.AppendLine($"{race1}  {race2}  {race3}  {race4}");
                }

                if (gameRaces.Count % 4 > 0)
                {
                    var columns = gameRaces.Count - (rows * 4);

                    switch (columns)
                    {
                    case 1:
                        var racecolumn1 = WrmChargenCommon.FormatToColumn(longestRaceName, raceQueue.Dequeue().Name);
                        outputBuilder.AppendLine($"{racecolumn1}");
                        break;

                    case 2:
                        var rc   = WrmChargenCommon.FormatToColumn(longestRaceName, raceQueue.Dequeue().Name);
                        var rcc1 = WrmChargenCommon.FormatToColumn(longestRaceName, raceQueue.Dequeue().Name);
                        outputBuilder.AppendLine($"{rc}  {rcc1}");
                        break;

                    case 3:
                        var rc1 = WrmChargenCommon.FormatToColumn(longestRaceName, raceQueue.Dequeue().Name);
                        var rc2 = WrmChargenCommon.FormatToColumn(longestRaceName, raceQueue.Dequeue().Name);
                        var rc3 = WrmChargenCommon.FormatToColumn(longestRaceName, raceQueue.Dequeue().Name);
                        outputBuilder.AppendLine($"{rc1}  {rc2}  {rc3}");
                        break;
                    }
                }
            }
            catch (Exception)
            {
                // ignored
            }
        }
Esempio n. 27
0
        /// <summary>Executes the command.</summary>
        /// <param name="actionInput">The full input specified for executing the command.</param>
        /// <remarks>
        /// TODO: will not work players offline at present ? where as tell should do this ?
        /// </remarks>
        public override void Execute(ActionInput actionInput)
        {
            var session = actionInput.Session;

            if (session == null)
            {
                return;                  // This action only makes sense for player sessions.
            }
            var output = new OutputBuilder();

            var    isOnline  = false;
            string addressIP = null;

            var playerBehavior = target.FindBehavior <PlayerBehavior>();

            output.AppendLine($"<%yellow%><%b%>Name: {target.Name} Title: {target.Title}<%n%>");
            output.AppendLine($"Description: {target.Description}");
            output.AppendLine($"Full Name: {target.FullName}");
            output.AppendLine($"ID: {target.Id}");
            output.AppendLine($"Type: {target.GetType().Name}"); // identify npc ?
            output.AppendLine("Race: TBA      Guild: TBA     Class: TBA");
            output.AppendLine("Religion: TBA");
            output.AppendLine("Gender: TBA");
            output.AppendLine("Email: TBA         Messenger Id: TBA");
            output.AppendLine("Home Page: TBA");
            output.AppendLine("Spouse: TBA");
            output.AppendLine("Creation Date: TBA");
            output.AppendLine("Age: TBA");

            if (playerBehavior != null)
            {
                // TODO: Mine this data in a less invasive/dangerous way; maybe the PlayerBehavior
                //     gets properties assigned for their last IP address upon connecting, etc..
                ////string sessionId = playerBehavior.SessionId;
                ////IConnection connection = bridge.ServerManager.GetConnection(sessionId);
                ////if (connection != null)
                ////{
                ////    isOnline = true;
                ////    addressIP = connection.CurrentIPAddress;
                ////}

                var statusString = isOnline ? "<%green%>Online<%n%>" : "<%red%>Offline<%n%>";

                output.AppendLine($"Status: {statusString}"); // need way to report both offline and online
                output.AppendLine($"Location: {target.Parent.Name}");
                output.AppendLine($"Last Login: {playerBehavior.PlayerData.LastLogin}");

                if (isOnline)
                {
                    output.AppendLine($"Current IP Address: {addressIP}");
                }

                output.AppendLine("Plan: TBA");
                output.AppendLine("MXP: TBA");
            }

            session.Write(output);
        }
        public void OneElementTree()
        {
            const String expected =
                "<orders>" +
                "</orders>";

            builder = createOutputBuilder("orders");
            assertXMLEquals(expected, builder.ToString(), "one element tree");
        }
Esempio n. 29
0
        public void TestReplaceWithNullOldStr()
        {
            var output = new OutputBuilder().Append(shortMessage);

            output.Replace(null, null);
            var parsedMessage = output.Parse(terminalOptions);

            Assert.AreEqual(shortMessage, parsedMessage);
        }
Esempio n. 30
0
        /// <summary>
        /// 主方法
        /// </summary>
        /// <param name="toolKit"></param>
        /// <returns></returns>
        protected override Output MainMethod(ToolKit <RecoveryFlasherArgs> toolKit)
        {
            var builder = new OutputBuilder();

            builder.Register(toolKit.Executer);
            toolKit.Fe($"flash recovery \"{toolKit.Args.RecoveryFilePath}\"");
            toolKit.Fe($"boot \"{toolKit.Args.RecoveryFilePath}\"");
            return(builder.Result);
        }
Esempio n. 31
0
 public unsafe string render() {
   OutputBuilder ob = new OutputBuilder();
   cs_render(csp,null,new CSOUTFUNC(ob.handleOutput));
   return ob.result();
 }