当前位置: 首页>>代码示例>>C#>>正文


C# ITerminal.WriteLine方法代码示例

本文整理汇总了C#中ITerminal.WriteLine方法的典型用法代码示例。如果您正苦于以下问题:C# ITerminal.WriteLine方法的具体用法?C# ITerminal.WriteLine怎么用?C# ITerminal.WriteLine使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ITerminal的用法示例。


在下文中一共展示了ITerminal.WriteLine方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: DisplayTcpServerInfo

		private void DisplayTcpServerInfo(TcpServer server, ITerminal output)
		{
			this.DisplayListenerInfo(server, output);

			if(!server.IsListening)
				return;

			output.WriteLine();
			output.Write(TerminalColor.DarkMagenta, "ID\t");
			output.Write(TerminalColor.DarkMagenta, ResourceUtility.GetString("${LastReceivedTime}") + "\t\t");
			output.Write(TerminalColor.DarkMagenta, ResourceUtility.GetString("${LastSendTime}") + "\t\t");
			output.Write(TerminalColor.DarkMagenta, ResourceUtility.GetString("${LocalEndPoint}") + "\t\t");
			output.WriteLine(TerminalColor.DarkMagenta, ResourceUtility.GetString("${RemoteEndPoint}") + "\t");

			var channels = server.ChannelManager.GetActivedChannels();

			foreach(TcpServerChannel channel in channels)
			{
				if(channel == this.Channel)
					output.Write(TerminalColor.Magenta, "* ");

				output.WriteLine(
					"{0}\t{1:yyyy-MM-dd HH:mm:ss}\t{2:yyyy-MM-dd HH:mm:ss}\t{3}\t\t{4}",
					channel.ChannelId,
					channel.LastReceivedTime,
					channel.LastSendTime,
					channel.LocalEndPoint,
					channel.RemoteEndPoint);
			}

			output.WriteLine();
		}
开发者ID:Flagwind,项目名称:Zongsoft.Terminals,代码行数:32,代码来源:TcpServerStatusCommand.cs

示例2: WritePluginNode

		public static void WritePluginNode(ITerminal terminal, PluginTreeNode node, ObtainMode obtainMode, int maxDepth)
		{
			if(node == null)
				return;

			terminal.Write(TerminalColor.DarkYellow, "[{0}]", node.NodeType);
			terminal.WriteLine(node.FullPath);
			terminal.Write(TerminalColor.DarkYellow, "Plugin File: ");

			if(node.Plugin == null)
				terminal.WriteLine(TerminalColor.Red, "N/A");
			else
				terminal.WriteLine(node.Plugin.FilePath);

			terminal.Write(TerminalColor.DarkYellow, "Node Properties: ");
			terminal.WriteLine(node.Properties.Count);

			if(node.Properties.Count > 0)
			{
				terminal.WriteLine(TerminalColor.Gray, "{");

				foreach(PluginExtendedProperty property in node.Properties)
				{
					terminal.Write(TerminalColor.DarkYellow, "\t" + property.Name);
					terminal.Write(" = ");
					terminal.Write(property.RawValue);

					if(property.Value != null)
					{
						terminal.Write(TerminalColor.DarkGray, " [");
						terminal.Write(TerminalColor.Blue, property.Value.GetType().FullName);
						terminal.Write(TerminalColor.DarkGray, "]");
					}

					terminal.WriteLine();
				}

				terminal.WriteLine(TerminalColor.Gray, "}");
			}

			terminal.WriteLine(TerminalColor.DarkYellow, "Children: {0}", node.Children.Count);
			if(node.Children.Count > 0)
			{
				terminal.WriteLine();

				foreach(var child in node.Children)
				{
					terminal.WriteLine(child);
				}
			}

			object value = node.UnwrapValue(obtainMode, null);
			if(value != null)
			{
				terminal.WriteLine();
				Zongsoft.Runtime.Serialization.Serializer.Text.Serialize(terminal.OutputStream, value);
			}
		}
开发者ID:jonfee,项目名称:Zongsoft.Terminals.Plugins,代码行数:58,代码来源:Utility.cs

示例3: DisplayListenerInfo

		private void DisplayListenerInfo(IListener listener, ITerminal output)
		{
			if(listener is Zongsoft.Communication.Net.TcpServer)
			{
				output.Write(TerminalColor.DarkYellow, ResourceUtility.GetString("${ListenAddress}") + ": ");
				output.Write("{0}", ((Zongsoft.Communication.Net.TcpServer)listener).Address);
			}

			output.Write(TerminalColor.DarkGray, " [");
			if(listener.IsListening)
				output.Write(TerminalColor.Green, ResourceUtility.GetString("${Listening}"));
			else
				output.Write(TerminalColor.Red, ResourceUtility.GetString("${Stopped}"));
			output.Write(TerminalColor.DarkGray, "]");

			if(listener is IWorker && ((IWorker)listener).Disabled)
				output.WriteLine(TerminalColor.DarkMagenta, "({0})", ResourceUtility.GetString("${Disabled}"));
			else
				output.WriteLine();
		}
开发者ID:Flagwind,项目名称:Zongsoft.Terminals,代码行数:20,代码来源:TcpServerStatusCommand.cs

示例4: Main

        public static void Main(string[] args)
        {
            // Set up logger depending on OS
            term = (Util.IsLinux() ? (ITerminal) new LinTerminal() : new WinTerminal());
            term.Init();

            term.WriteLine(@"+---------------------------------------+");
            term.WriteLine(@"| Revolutionize web development with C# |");
            term.WriteLine(@"+---------------------------------------+");
            term.WriteLine(@"|  _   _      _     _   _  _____ _____  |");
            term.WriteLine(@"| | \ | |    | |   | \ | ||  ___|_   _| |");
            term.WriteLine(@"| |  \| | ___| |_  |  \| || |__   | |   |");
            term.WriteLine(@"| | . ` |/ _ \ __| | . ` ||  __|  | |   |");
            term.WriteLine(@"| | |\  |  __/ |_ _| |\  || |___  | |   |");
            term.WriteLine(@"| \_| \_/\___|\__(_)_| \_/\____/  \_/   |");
            term.WriteLine(@"+---------------------------------------+");
            term.WriteLine(@"|   An open source  project by Inskey   |");
            term.WriteLine(@"+---------------------------------------+");

            Logger.SetTerminal(term);
            Logger.Log("Terminal set up for " + (Util.IsLinux() ? "Linux" : "Windows") + ".");

            // Load all the pages
            Logger.Log("Loading pages...");
            short amount = LoadPages();
            Logger.Log("Loaded " + amount + " pages.");

            // Load all the resources
            Logger.Log("Loading resources...");
            amount = LoadResources();
            Logger.Log("Loaded " + amount + " resources.");

            // Load special pages, or copy them to the filesystem if they don't exist
            //Logger.Log("Loading special pages...");
            //LoadSpecials();
            //Logger.Log("All specials loaded.");

            // Start listening for HTTP connections
            listener = new Listener();
            listener.Open();

            // Main thread becomes the command line thread
            ConsoleLoop();
        }
开发者ID:Inskey,项目名称:NetDotNet,代码行数:44,代码来源:EntryPoint.cs

示例5: DisplayCommandInfo

		internal static void DisplayCommandInfo(ITerminal terminal, ICommand command)
		{
			if(terminal == null || command == null)
				return;

			DisplayNameAttribute displayName = (DisplayNameAttribute)TypeDescriptor.GetAttributes(command)[typeof(DisplayNameAttribute)];
			DescriptionAttribute description = (DescriptionAttribute)TypeDescriptor.GetAttributes(command)[typeof(DescriptionAttribute)];

			terminal.Write(TerminalColor.Blue, command.Name + " ");

			if(!command.Enabled)
				terminal.Write(TerminalColor.DarkGray, "({0})", ResourceUtility.GetString("${Disabled}"));

			if(displayName == null || string.IsNullOrWhiteSpace(displayName.DisplayName))
				terminal.Write(ResourceUtility.GetString("${Command}"));
			else
				terminal.Write(ResourceUtility.GetString(displayName.DisplayName, command.GetType().Assembly));

			CommandOptionAttribute[] optionAttributes = (CommandOptionAttribute[])command.GetType().GetCustomAttributes(typeof(CommandOptionAttribute), true);

			if(optionAttributes != null && optionAttributes.Length > 0)
			{
				terminal.WriteLine("," + ResourceUtility.GetString("${CommandUsages}"), optionAttributes.Length);
				terminal.WriteLine();

				string commandName = command.Name;

				terminal.Write(TerminalColor.Blue, commandName + " ");

				foreach(var optionAttribute in optionAttributes)
				{
					if(optionAttribute.Required)
					{
						terminal.Write("<-");
						terminal.Write(TerminalColor.DarkYellow, optionAttribute.Name);
						terminal.Write("> ");
					}
					else
					{
						terminal.Write("[-");
						terminal.Write(TerminalColor.DarkYellow, optionAttribute.Name);
						terminal.Write("] ");
					}
				}

				terminal.WriteLine();

				int maxOptionLength = GetMaxOptionLength(optionAttributes) + 2;

				foreach(var optionAttribute in optionAttributes)
				{
					int optionPadding = maxOptionLength - optionAttribute.Name.Length;

					terminal.Write("\t-");
					terminal.Write(TerminalColor.DarkYellow, optionAttribute.Name);

					if(optionAttribute.Type != null)
					{
						terminal.Write(":");
						terminal.Write(TerminalColor.Magenta, GetSimpleTypeName(optionAttribute.Type));
						optionPadding -= (GetSimpleTypeName(optionAttribute.Type).Length + 1);
					}

					terminal.Write(" (".PadLeft(optionPadding));

					if(optionAttribute.Required)
						terminal.Write(TerminalColor.DarkRed, ResourceUtility.GetString("${Required}"));
					else
						terminal.Write(TerminalColor.DarkGreen, ResourceUtility.GetString("${Optional}"));

					terminal.Write(") ");

					if(!string.IsNullOrWhiteSpace(optionAttribute.Description))
						terminal.Write(ResourceUtility.GetString(optionAttribute.Description, command.GetType().Assembly));

					if(optionAttribute.Type != null && optionAttribute.Type.IsEnum)
					{
						var entries = Zongsoft.Common.EnumUtility.GetEnumEntries(optionAttribute.Type, false);
						var maxEnumLength = entries.Max(entry => string.IsNullOrWhiteSpace(entry.Alias) ? entry.Name.Length : entry.Name.Length + entry.Alias.Length + 2);

						foreach(var entry in entries)
						{
							var enumPadding = maxEnumLength - entry.Name.Length;

							terminal.WriteLine();
							terminal.Write("\t".PadRight(optionAttribute.Name.Length + 3));
							terminal.Write(TerminalColor.DarkMagenta, entry.Name.ToLowerInvariant());

							if(!string.IsNullOrWhiteSpace(entry.Alias))
							{
								terminal.Write(TerminalColor.DarkGray, "(");
								terminal.Write(TerminalColor.DarkMagenta, entry.Alias);
								terminal.Write(TerminalColor.DarkGray, ")");

								enumPadding -= entry.Alias.Length + 2;
							}

							if(!string.IsNullOrWhiteSpace(entry.Description))
								terminal.Write(new string(' ', enumPadding + 1) + entry.Description);
						}
//.........这里部分代码省略.........
开发者ID:Flagwind,项目名称:Zongsoft.CoreLibrary,代码行数:101,代码来源:CommandHelper.cs


注:本文中的ITerminal.WriteLine方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。