| 1 |
#Region "Microsoft.VisualBasic::96152bd9a4e2478911dd455ba82b3d8b, Microsoft.VisualBasic.Core\Language\Language\UnixBash\Cowsay.vb"
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
|
| 38 |
|
| 39 |
|
| 40 |
|
| 41 |
#End Region
|
| 42 |
|
| 43 |
Imports System.Text
|
| 44 |
Imports Microsoft.VisualBasic.CommandLine.Reflection
|
| 45 |
Imports Microsoft.VisualBasic.Scripting.MetaData
|
| 46 |
|
| 47 |
Namespace Language.UnixBash
|
| 48 |
|
| 49 |
|
| 50 |
|
| 51 |
|
| 52 |
<Package("Cowsay",
|
| 53 |
Description:="cowsay is a program which generates ASCII pictures of a cow with a message.[2]
|
| 54 |
It can also generate pictures using pre-made images of other animals, such as Tux the Penguin, the Linux mascot.
|
| 55 |
It is written in Perl. There is also a related program called cowthink, with cows with thought bubbles rather than speech bubbles. .
|
| 56 |
cow files for cowsay exist which are able to produce different variants of ""cows"", with different kinds of ""eyes"",
|
| 57 |
and so forth.[3] It is sometimes used on IRC, desktop screenshots, and in software documentation.
|
| 58 |
It is more or less a joke within hacker culture, but has been around long enough that its use is rather widespread.
|
| 59 |
In 2007 it was highlighted as a Debian package of the day.
|
| 60 |
Cowsay tricks for showing your message more friendly. https://en.wikipedia.org/wiki/Cowsay",
|
| 61 |
Revision:=21,
|
| 62 |
Publisher:="<a href=""mailto://xie.guigang@live.com"">xie.guigang@live.com</a>",
|
| 63 |
Url:="http://gcmodeller.org",
|
| 64 |
Category:=APICategories.UtilityTools)>
|
| 65 |
Public Module CowsayTricks
|
| 66 |
|
| 67 |
|
| 68 |
|
| 69 |
|
| 70 |
Public Const NormalCow As String =
|
| 71 |
" |
|
| 72 |
| ^__^
|
| 73 |
-- (oo)\_______
|
| 74 |
(__)\ )\\
|
| 75 |
||----W |
|
| 76 |
|| ||
|
| 77 |
"
|
| 78 |
|
| 79 |
|
| 80 |
|
| 81 |
|
| 82 |
Public Const DeadCow As String =
|
| 83 |
" |
|
| 84 |
| ^__^
|
| 85 |
-- (XX)\_______
|
| 86 |
(__)\ )\\
|
| 87 |
||----W |
|
| 88 |
|| ||
|
| 89 |
"
|
| 90 |
|
| 91 |
Public Const tux As String = " __________________
|
| 92 |
< This is my text. >
|
| 93 |
------------------
|
| 94 |
\
|
| 95 |
\
|
| 96 |
.--.
|
| 97 |
|o_o |
|
| 98 |
|:_/ |
|
| 99 |
// \ \
|
| 100 |
(| | )
|
| 101 |
/
|
| 102 |
\___)=(___/"
|
| 103 |
|
| 104 |
Const HelloWorld As String =
|
| 105 |
"
|
| 106 |
H H EEEEE L L OOO W W OOO RRRR L DDDD !!
|
| 107 |
H H E L L O O W W W O O R R L D D !!
|
| 108 |
HHHHH EEEEE L L O O W W W O O RRRR L D D !!
|
| 109 |
H H E L L O O ,, W W O O R R L D D
|
| 110 |
H H EEEEE LLLLL LLLLL OOO ,, W W OOO R R LLLLL DDDD !!
|
| 111 |
"
|
| 112 |
|
| 113 |
|
| 114 |
|
| 115 |
|
| 116 |
|
| 117 |
|
| 118 |
|
| 119 |
<ExportAPI("Cowsay",
|
| 120 |
Info:="Show cowsay with a specific input message on your console screen. you can using /dead to change its face.")>
|
| 121 |
Public Function RunCowsay(msg As String, Optional isDead As Boolean = False) As String
|
| 122 |
If isDead Then
|
| 123 |
msg = __msgbox(msg) & DeadCow
|
| 124 |
Else
|
| 125 |
msg = __msgbox(msg) & NormalCow
|
| 126 |
End If
|
| 127 |
|
| 128 |
Call Console.WriteLine(msg)
|
| 129 |
|
| 130 |
Return msg
|
| 131 |
End Function
|
| 132 |
|
| 133 |
|
| 134 |
Creates the message box to display the message for the cow on the console.
|
| 135 |
|
| 136 |
|
| 137 |
|
| 138 |
Private Function __msgbox(msg As String) As String
|
| 139 |
Dim l = Len(msg)
|
| 140 |
Dim offset As String = New String(" ", 8)
|
| 141 |
Dim sBuilder As StringBuilder = New StringBuilder(vbCrLf, 1024)
|
| 142 |
Call sBuilder.AppendLine(offset & " " & New String("_", l + 4) & " ")
|
| 143 |
Call sBuilder.AppendLine(offset & String.Format("< {0} >", msg))
|
| 144 |
Call sBuilder.AppendLine(offset & " " & New String("-", l + 4) & " ")
|
| 145 |
|
| 146 |
Return sBuilder.ToString
|
| 147 |
End Function
|
| 148 |
End Module
|
| 149 |
End Namespace
|