Skip to content

Commit

Permalink
split style
Browse files Browse the repository at this point in the history
  • Loading branch information
Tynab committed Oct 14, 2022
1 parent befa545 commit 622e016
Show file tree
Hide file tree
Showing 2 changed files with 93 additions and 32 deletions.
4 changes: 1 addition & 3 deletions Mitsubishi Block/ModuleMain.vb
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
Imports System.Console
Imports System.ConsoleColor
Imports System.Text.Encoding

Public Module ModuleMain
Expand All @@ -13,8 +12,7 @@ Public Module ModuleMain
UpdVldLic()
FstRunApp()
Else
ForegroundColor = Red
Write("ライセンスが間違っています。 終了するには、任意のキーを押してください...")
ErrSty("ライセンスが間違っています。 終了するには、任意のキーを押してください...")
ReadKey()
End If
Else
Expand Down
121 changes: 92 additions & 29 deletions Mitsubishi Block/Script/Common.vb
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@ Friend Module Common
''' Check update.
''' </summary>
Private Sub ChkUpd()
ForegroundColor = DarkYellow
Write("アップデートの確認...")
HdrSty("アップデートの確認...")
If IsNetAvail() AndAlso Not (New WebClient).DownloadString(My.Resources.link_ver).Contains(My.Resources.app_ver) Then
Show($"「{My.Resources.app_true_name}」新しいバージョンが利用可能!", "更新", OK, Information)
Run(New FrmUpdate)
Expand Down Expand Up @@ -100,8 +99,7 @@ Friend Module Common
For i = 0 To Integer.MaxValue
Intro()
If i > 0 Then
ForegroundColor = Gray
WriteLine(sW)
HxSty(sW & vbCrLf)
Dim wi = InpG(vbCrLf & vbTab & $"w{i + 1} = ")
If wi > 0 Then
w += wi
Expand All @@ -124,8 +122,7 @@ Friend Module Common
Dim sH = "H = "
For i = 0 To Integer.MaxValue
Intro()
ForegroundColor = Gray
WriteLine(sW)
HxSty(sW & vbCrLf)
If i > 0 Then
WriteLine(sH)
Dim hi = InpG(vbCrLf & vbTab & $"h{i + 1} = ")
Expand Down Expand Up @@ -158,13 +155,11 @@ Friend Module Common
' Output
Dim fmt = FmtNo(w, h, c, s, block)
Intro()
ForegroundColor = Gray
WriteLine(vbTab & "W (mm)" & vbTab & vbTab & ": " + String.Format(fmt, w))
WriteLine(vbTab & "H (mm)" & vbTab & vbTab & ": " + String.Format(fmt, h))
ForegroundColor = DarkCyan
WriteLine(vbTab & "C (m)" & vbTab & vbTab & ": " + String.Format(fmt, c))
WriteLine(vbTab & "S (m²)" & vbTab & vbTab & ": " + String.Format(fmt, s))
WriteLine(vbTab & "ブロック (個)" & vbTab & ": " + String.Format(fmt, block))
HxSty(vbTab & "W (mm)" & vbTab & vbTab & ": " + String.Format(fmt, w) & vbCrLf)
HxSty(vbTab & "H (mm)" & vbTab & vbTab & ": " + String.Format(fmt, h) & vbCrLf)
RsltSty(vbTab & "C (m)" & vbTab & vbTab & ": " + String.Format(fmt, c) & vbCrLf)
RsltSty(vbTab & "S (m²)" & vbTab & vbTab & ": " + String.Format(fmt, s) & vbCrLf)
RsltSty(vbTab & "ブロック (個)" & vbTab & ": " + String.Format(fmt, block) & vbCrLf)
Credit()
End Sub

Expand Down Expand Up @@ -251,39 +246,107 @@ Friend Module Common

#Region "Actor"
''' <summary>
''' Intro.
''' Header style.
''' </summary>
Private Sub Intro()
Clear()
''' <param name="caption">Caption.</param>
Private Sub HdrSty(caption As String)
ForegroundColor = DarkYellow
Write(caption)
End Sub

''' <summary>
''' Intro style.
''' </summary>
''' <param name="caption">Caption.</param>
Private Sub IntroSty(caption As String)
ForegroundColor = Blue
WriteLine(My.Resources.gr_name)
WriteLine(My.Resources.cc_text)
ForegroundColor = Green
WriteLine(vbCrLf & My.Resources.app_true_name & vbCrLf)
Write(caption)
End Sub

''' <summary>
''' Credit.
''' Credit style.
''' </summary>
Private Sub Credit()
''' <param name="caption">Caption.</param>
Private Sub CreditSty(caption As String)
ForegroundColor = DarkGray
Write(vbCrLf & "続行するには、任意のキーを押してください...")
ReadKey()
If Show("続けたいですか?", "質問", YesNo, Question, Button2) = DialogResult.Yes Then
RunApp()
End If
Write(caption)
End Sub

''' <summary>
''' Prefix input.
''' Title style.
''' </summary>
''' <param name="caption">Caption.</param>
Private Sub PrefInp(caption As String)
Private Sub TitSty(caption As String)
ForegroundColor = Green
Write(caption)
End Sub

''' <summary>
''' Input style.
''' </summary>
''' <param name="caption">Caption.</param>
Private Sub InpSty(caption As String)
ForegroundColor = Cyan
Write(caption)
End Sub

''' <summary>
''' History style.
''' </summary>
''' <param name="caption">Caption.</param>
Private Sub HxSty(caption As String)
ForegroundColor = Gray
Write(caption)
End Sub

''' <summary>
''' Result style.
''' </summary>
''' <param name="caption">Caption.</param>
Private Sub RsltSty(caption As String)
ForegroundColor = DarkCyan
Write(caption)
End Sub

''' <summary>
''' Error style.
''' </summary>
''' <param name="caption">Caption.</param>
Friend Sub ErrSty(caption As String)
ForegroundColor = Red
Write(caption)
End Sub

''' <summary>
''' Prefix input.
''' </summary>
''' <param name="caption">Caption.</param>
Private Sub PrefInp(caption As String)
InpSty(caption)
ForegroundColor = White
End Sub

''' <summary>
''' Intro.
''' </summary>
Private Sub Intro()
Clear()
IntroSty(My.Resources.gr_name & vbCrLf)
IntroSty(My.Resources.cc_text & vbCrLf)
TitSty(vbCrLf & My.Resources.app_true_name & vbCrLf & vbCrLf)
End Sub

''' <summary>
''' Credit.
''' </summary>
Private Sub Credit()
CreditSty(vbCrLf & "続行するには、任意のキーを押してください...")
ReadKey()
If Show("続けたいですか?", "質問", YesNo, Question, Button2) = DialogResult.Yes Then
RunApp()
End If
End Sub

''' <summary>
''' Input G.
''' </summary>
Expand Down

0 comments on commit 622e016

Please sign in to comment.