Skip to content

Commit a6b27d3

Browse files
committed
ready
1 parent 93c329b commit a6b27d3

File tree

4 files changed

+37
-39
lines changed

4 files changed

+37
-39
lines changed

Mitsubishi Block/Mitsubishi Block.vbproj

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,9 @@
6262
<PropertyGroup>
6363
<OptionInfer>On</OptionInfer>
6464
</PropertyGroup>
65+
<PropertyGroup>
66+
<ApplicationIcon>ic.ico</ApplicationIcon>
67+
</PropertyGroup>
6568
<ItemGroup>
6669
<Reference Include="System" />
6770
<Reference Include="System.Data" />
@@ -134,7 +137,9 @@
134137
</None>
135138
<None Include="App.config" />
136139
</ItemGroup>
137-
<ItemGroup />
140+
<ItemGroup>
141+
<Content Include="ic.ico" />
142+
</ItemGroup>
138143
<ItemGroup>
139144
<BootstrapperPackage Include=".NETFramework,Version=v4.8.1">
140145
<Visible>False</Visible>

Mitsubishi Block/Script/Common.vb

Lines changed: 31 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ Imports System.ConsoleColor
33
Imports System.Diagnostics.Process
44
Imports System.IO
55
Imports System.IO.Directory
6+
Imports System.Math
67
Imports System.Net
78
Imports System.Runtime.CompilerServices
89
Imports System.Threading.Thread
@@ -11,8 +12,6 @@ Imports System.Windows.Forms.Application
1112
Imports System.Windows.Forms.MessageBox
1213
Imports System.Windows.Forms.MessageBoxButtons
1314
Imports System.Windows.Forms.MessageBoxIcon
14-
Imports System.Math
15-
Imports System.Drawing
1615

1716
Friend Module Common
1817
#Region "Helper"
@@ -124,19 +123,23 @@ Friend Module Common
124123
Dim c = Ceiling((w + h) * 2 / Pow(10, 3))
125124
Dim s = Ceiling(w * h / Pow(10, 6))
126125
Dim block = c + s
127-
For i = 10 To Integer.MinValue
126+
For i = 10 To Integer.MaxValue
128127
If (block + i) Mod 30 = 0 Then
129128
block += i
130129
Exit For
131130
End If
132131
Next
132+
' Print
133133
Intro()
134-
ForegroundColor = ConsoleColor.DarkGreen
135-
WriteLine(vbTab & "C" & vbTab & vbTab & $": {c}")
136-
WriteLine(vbTab & "S" & vbTab & vbTab & $": {s}")
137-
WriteLine(vbTab & "ブロック" & vbTab & $": {block}")
138-
' TODO
139-
ReadLine()
134+
ForegroundColor = DarkCyan
135+
Dim fmt = FmtNo(c, s, block)
136+
WriteLine(vbTab & "C (m)" & vbTab & vbTab & ": " + String.Format(fmt, c))
137+
WriteLine(vbTab & "S (m²)" & vbTab & vbTab & ": " + String.Format(fmt, s))
138+
WriteLine(vbTab & "ブロック (個)" & vbTab & ": " + String.Format(fmt, block))
139+
' Credit
140+
If Show("続けたいですか?", "質問", YesNo, Question) = DialogResult.Yes Then
141+
RunApp()
142+
End If
140143
End Sub
141144
#End Region
142145

@@ -169,6 +172,21 @@ Friend Module Common
169172
Private Function ConvertToG(num As Double)
170173
Return If(num < 30, num * 910, num)
171174
End Function
175+
176+
''' <summary>
177+
''' Format number.
178+
''' </summary>
179+
''' <param name="c">Circuit.</param>
180+
''' <param name="s">Spread.</param>
181+
''' <param name="block">Block.</param>
182+
''' <returns>Format.</returns>
183+
Private Function FmtNo(c As Double, s As Double, block As Double)
184+
Dim cSize = c.ToString().Length
185+
Dim sSize = s.ToString().Length
186+
Dim blockSize = block.ToString().Length
187+
Dim maxSize = Max(blockSize, Max(cSize, sSize))
188+
Return "{0," + maxSize.ToString() + ":####.#}"
189+
End Function
172190
#End Region
173191

174192
#Region "Timer"
@@ -206,42 +224,17 @@ Friend Module Common
206224
WriteLine(vbCrLf & My.Resources.app_true_name & vbCrLf)
207225
End Sub
208226

209-
''' <summary>
210-
''' Title info.
211-
''' </summary>
212-
''' <param name="caption">Caption.</param>
213-
Private Sub TitInfo(caption As String)
214-
ForegroundColor = Cyan
215-
Write(caption)
216-
End Sub
217-
218-
''' <summary>
219-
''' Title info expansion.
220-
''' </summary>
221-
''' <param name="caption">Caption.</param>
222-
Private Sub TitInfoExp(caption As String)
223-
TitInfo(caption)
224-
ForegroundColor = White
225-
End Sub
226-
227-
''' <summary>
228-
''' Detail double input.
229-
''' </summary>
230-
''' <param name="caption">Caption.</param>
231-
''' <returns>Input value.</returns>
232-
Friend Function DtlDInp(caption As String)
233-
TitInfoExp(caption)
234-
Return Val(ReadLine)
235-
End Function
236-
237227
''' <summary>
238228
''' Header double input.
239229
''' </summary>
240230
''' <param name="caption">Caption.</param>
241231
''' <returns>Input value.</returns>
242232
Friend Function HdrDInp(caption As String)
243233
Intro()
244-
Return DtlDInp(caption)
234+
ForegroundColor = Cyan
235+
Write(caption)
236+
ForegroundColor = White
237+
Return Val(ReadLine)
245238
End Function
246239
#End Region
247240
End Module

Mitsubishi Block/ic.ico

124 KB
Binary file not shown.

res/ic.ico

124 KB
Binary file not shown.

0 commit comments

Comments
 (0)