-
Notifications
You must be signed in to change notification settings - Fork 0
/
Maker.ps1
42 lines (34 loc) · 1.19 KB
/
Maker.ps1
1
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
42
# include
. .\TeamNameTemplate.ps1
. .\continent.ps1
. .\PlaceAPIClass.ps1
# The PlaceAPIのログから地名を取得する
# main
$source = '.\extract.txt'
$result = '.\result.log'
$continent = ''
$Templates = New-Object TeamNameTemplateClass
$continents = New-Object ContinentClass
$places = New-Object PlaceAPIClass
$continent = $continents.getContinent()
Write-Host "[main]continent: $continent"
$Template = $Templates.getTemplate($continent)
Write-Host "[main]Template: $Template"
$contents = $places.getContentsFromSource($source)
$choices = $places.getChoices($contents)
$name = $places.setChoice($choices)
if($name -ne '' -or $null -ne $name){
$teamname = $Template.replace("<name>", "$name") # 最終的にこの処理でチーム名が作られる
Write-Host "[main]teamname: $teamname"
if((Get-Random) % 2 -eq 0){
$tmp = $Templates.addUnited($teamname)
$teamname = $tmp
}
if((Get-Random) % 2 -eq 0){
$tmp = $Templates.addSecondTeam($teamname)
$teamname = $tmp
}
$fixedName = $Templates.FixTeamName($teamname)
Write-Host "[main]fixedName: $fixedName"
Write-Output $fixedName | Out-File $result -Encoding utf8 -Append
}