一个自定义的console输出类(test)

为了显示工作流的运行情况,写了一个test类,该类就简单的实现了console.write的字串排版功能,可以改写他将内容存入数据库或磁盘文件.很多例子中用了该类,就将他贴出来了
None.gif ' ■△▲↑↓◆◇◎●○☆★□┌┐│└┘─∧∧∧∨∨∨⊙【】
ExpandedBlockStart.gifContractedBlock.gif
Public   Class test Class test
InBlock.gif
InBlock.gif    
Shared line As Integer = 0
ExpandedSubBlockStart.gifContractedSubBlock.gif    
Shared Sub New()Sub New()
InBlock.gif        Console.BufferWidth 
= 140
InBlock.gif        Console.Title 
= "工作流调试器[引擎运行结果输出窗口]"
ExpandedSubBlockEnd.gif    
End Sub

InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif    
Public Shared Sub 实例输出()Sub 实例输出(ByVal 结点 As StringByVal 事件 As StringByVal 内容 As String)
InBlock.gif        自定义(
"工作流(结点)""结点" + 结点 + "" + "事件" + 事件, 内容, ConsoleColor.Red)
ExpandedSubBlockEnd.gif    
End Sub

InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif    
Public Shared Sub 实例输出()Sub 实例输出(ByVal 结点 As StringByVal 事件 As StringByVal 内容 As Collections.ArrayList)
InBlock.gif        自定义(
"工作流(结点)""结点" + 结点 + "" + "事件" + 事件, 内容, ConsoleColor.Red)
ExpandedSubBlockEnd.gif    
End Sub

InBlock.gif
InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif    
Public Shared Sub 实例完成()Sub 实例完成(ByVal guid As String)
InBlock.gif        自定义(
"工作流(结点)""实例已完成", guid, ConsoleColor.Red)
ExpandedSubBlockEnd.gif    
End Sub

ExpandedSubBlockStart.gifContractedSubBlock.gif    
Public Shared Sub 实例完成()Sub 实例完成(ByVal guid As StringByVal 内容 As Collections.ArrayList)
InBlock.gif        自定义(
"工作流(结点)""实例已完成" + vbCrLf + "" + guid, 内容, ConsoleColor.Red)
ExpandedSubBlockEnd.gif    
End Sub

InBlock.gif
InBlock.gif
InBlock.gif
InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif    
Public Shared Sub 宿主()Sub 宿主(ByVal 源 As StringByVal 内容 As String)
InBlock.gif        自定义(
"宿主", 源, 内容, ConsoleColor.Cyan)
ExpandedSubBlockEnd.gif    
End Sub

ExpandedSubBlockStart.gifContractedSubBlock.gif    
Public Shared Sub 宿主()Sub 宿主(ByVal 源 As StringByVal 内容 As Collections.ArrayList)
InBlock.gif        自定义(
"宿主", 源, 内容, ConsoleColor.Cyan)
ExpandedSubBlockEnd.gif    
End Sub

InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif    
Public Shared Sub 跟踪()Sub 跟踪(ByVal 源 As StringByVal 内容 As String)
InBlock.gif
InBlock.gif        自定义(
"跟踪", 源, 内容, ConsoleColor.Yellow)
ExpandedSubBlockEnd.gif    
End Sub

InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif    
Public Shared Sub 跟踪()Sub 跟踪(ByVal 源 As StringByVal 内容 As Collections.ArrayList)
InBlock.gif
InBlock.gif        自定义(
"跟踪", 源, 内容, ConsoleColor.Yellow)
ExpandedSubBlockEnd.gif    
End Sub

InBlock.gif
InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif    
Public Shared Sub 持久化()Sub 持久化(ByVal 源 As StringByVal 内容 As String)
InBlock.gif        自定义(
"持久化", 源, 内容, ConsoleColor.Green)
ExpandedSubBlockEnd.gif    
End Sub

ExpandedSubBlockStart.gifContractedSubBlock.gif    
Public Shared Sub 持久化()Sub 持久化(ByVal 源 As StringByVal 内容 As Collections.ArrayList)
InBlock.gif        自定义(
"持久化", 源, 内容, ConsoleColor.Green)
ExpandedSubBlockEnd.gif    
End Sub

InBlock.gif
InBlock.gif
InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif    
Public Shared Sub 自定义()Sub 自定义(ByVal 头 As StringByVal 源 As StringByVal 内容 As StringByVal 颜色 As ConsoleColor)
InBlock.gif        Console.ForegroundColor 
= 颜色
InBlock.gif        test.头(头)
InBlock.gif        test.身(源)
InBlock.gif        test.身(内容)
InBlock.gif        test.尾()
ExpandedSubBlockEnd.gif    
End Sub

InBlock.gif
InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif    
Public Shared Sub 自定义()Sub 自定义(ByVal 头 As StringByVal 源 As StringByVal 内容 As Collections.ArrayList, ByVal 颜色 As ConsoleColor)
InBlock.gif        Console.ForegroundColor 
= 颜色
InBlock.gif        test.头(头)
InBlock.gif        test.身(源)
InBlock.gif
InBlock.gif        
If 内容 IsNot Nothing Then
InBlock.gif
InBlock.gif            
For Each temp As Object In 内容
InBlock.gif                test.身(temp.ToString())
InBlock.gif            
Next
InBlock.gif        
Else
InBlock.gif            test.身(
"内容为空")
InBlock.gif        
End If
InBlock.gif
InBlock.gif        test.尾()
ExpandedSubBlockEnd.gif    
End Sub

InBlock.gif
InBlock.gif
InBlock.gif
InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif    
Shared Sub 头()Sub 头(ByVal v As String)
InBlock.gif        line 
= line + 1
InBlock.gif        Console.WriteLine(line)
InBlock.gif        Console.WriteLine(
"┌───────────────────────────────────────────────────────────────┐")
InBlock.gif        Console.WriteLine(
"│【" + v + "" + DateTime.Now.ToString)
InBlock.gif        test.换行()
ExpandedSubBlockEnd.gif    
End Sub

InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif    
Shared Sub 尾()Sub 尾()
InBlock.gif        Console.WriteLine(
"└───────────────────────────────────────────────────────────────┘")
InBlock.gif        Console.WriteLine()
InBlock.gif        Console.ForegroundColor 
= ConsoleColor.White
ExpandedSubBlockEnd.gif    
End Sub

InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif    
Shared Sub 身()Sub 身(ByVal v As String)
InBlock.gif        Console.WriteLine(
"" + v)
ExpandedSubBlockEnd.gif    
End Sub

InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif    
Shared Sub 换行()Sub 换行()
InBlock.gif        Console.WriteLine(
"")
ExpandedSubBlockEnd.gif    
End Sub

InBlock.gif
ExpandedSubBlockStart.gifContractedSubBlock.gif    
Public Shared Sub 清屏()Sub 清屏()
InBlock.gif        Console.Clear()
InBlock.gif        line 
= 0
ExpandedSubBlockEnd.gif    
End Sub

InBlock.gif
ExpandedBlockEnd.gif
End Class

None.gif
None.gif
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值