;
5 | }
6 | @section Head {
7 |
12 |
17 |
44 | }
45 | @ViewData["Title"]
46 |
47 | @using (Html.BeginForm("SystemSetting", "Home", FormMethod.Post))
48 | {
49 | @Html.LabelFor(model => model.InstallPath, "インストールディレクトリ (再起動するまで変更は反映されません)");
50 | @Html.TextBoxFor(model => model.InstallPath, Model.InstallPath, new { placeholder = SystemSettingModel.DefaultInstallPath });
51 |
52 | @Html.LabelFor(model => model.VoiceroidEditorExe, "VOICEROID2エディタの実行ファイル");
53 | @Html.TextBoxFor(model => model.VoiceroidEditorExe, Model.VoiceroidEditorExe, new { placeholder = SystemSettingModel.DefaultVoiceroidEditorExe });
54 |
55 | @Html.LabelFor(model => model.AuthCodeSeed, "認証コードのシード値");
56 | @Html.TextBoxFor(model => model.AuthCodeSeed, Model.AuthCodeSeed)
57 |
58 |
59 | @Html.LabelFor(model => model.LanguageName, "言語");
60 | @Html.DropDownListFor(model => model.LanguageName, language_items);
61 |
62 | @Html.LabelFor(model => model.PhraseDictionaryPath, "フレーズ辞書のファイルパス");
63 | @Html.TextBoxFor(model => model.PhraseDictionaryPath, Model.PhraseDictionaryPath)
64 |
65 | @Html.LabelFor(model => model.WordDictionaryPath, "単語辞書のファイルパス");
66 | @Html.TextBoxFor(model => model.WordDictionaryPath, Model.WordDictionaryPath)
67 |
68 | @Html.LabelFor(model => model.SymbolDictionaryPath, "記号ポーズ辞書のファイルパス");
69 | @Html.TextBoxFor(model => model.SymbolDictionaryPath, Model.SymbolDictionaryPath)
70 |
71 | @Html.LabelFor(model => model.KanaTimeout, "読み仮名変換のタイムアウト [ms] (0のとき無制限に待つ)");
72 | @Html.TextBoxFor(model => model.KanaTimeout, new { value = Model.KanaTimeout, type = "number", min = "0", max = "10000" })
73 |
74 | @Html.LabelFor(model => model.SpeechTimeout, "音声変換のタイムアウト [ms] (0のとき無制限に待つ)");
75 | @Html.TextBoxFor(model => model.SpeechTimeout, new { value = Model.SpeechTimeout, type = "number", min = "0", max = "10000" })
76 |
77 | @Html.LabelFor(model => model.ListeningAddress, "待ち受けアドレス");
78 | @Html.TextBoxFor(model => model.ListeningAddress, Model.ListeningAddress, new { placeholder = SystemSettingModel.DefaultListeningAddress })
79 |
80 |
81 | }
82 |
--------------------------------------------------------------------------------
/VoiceroidDaemon/Views/Shared/Error.cshtml:
--------------------------------------------------------------------------------
1 | @model ErrorViewModel
2 | @{
3 | ViewData["Title"] = "Error";
4 | }
5 |
6 | Error.
7 | An error occurred while processing your request.
8 |
9 | @if (Model.ShowRequestId)
10 | {
11 |
12 | Request ID: @Model.RequestId
13 |
14 | }
15 |
16 | Development Mode
17 |
18 | Swapping to Development environment will display more detailed information about the error that occurred.
19 |
20 |
21 | Development environment should not be enabled in deployed applications, as it can result in sensitive information from exceptions being displayed to end users. For local debugging, development environment can be enabled by setting the ASPNETCORE_ENVIRONMENT environment variable to Development, and restarting the application.
22 |
23 |
--------------------------------------------------------------------------------
/VoiceroidDaemon/Views/Shared/_CookieConsentPartial.cshtml:
--------------------------------------------------------------------------------
1 | @using Microsoft.AspNetCore.Http.Features
2 |
3 | @{
4 | var consentFeature = Context.Features.Get();
5 | var showBanner = !consentFeature?.CanTrack ?? false;
6 | var cookieString = consentFeature?.CreateConsentCookie();
7 | }
8 |
9 | @if (showBanner)
10 | {
11 |
33 |
41 | }
--------------------------------------------------------------------------------
/VoiceroidDaemon/Views/Shared/_Layout.cshtml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | @ViewData["Title"] - VoiceroidDaemon
7 |
8 |
9 |
10 | @RenderSection("Head", required: false)
11 |
12 |
13 |
33 |
34 |
35 | @RenderBody()
36 |
37 |
38 | @RenderSection("Scripts", required: false)
39 |
40 |
41 |
--------------------------------------------------------------------------------
/VoiceroidDaemon/Views/Shared/_ValidationScriptsPartial.cshtml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
12 |
18 |
19 |
--------------------------------------------------------------------------------
/VoiceroidDaemon/Views/_ViewImports.cshtml:
--------------------------------------------------------------------------------
1 | @using VoiceroidDaemon
2 | @using VoiceroidDaemon.Models
3 | @addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
4 |
--------------------------------------------------------------------------------
/VoiceroidDaemon/Views/_ViewStart.cshtml:
--------------------------------------------------------------------------------
1 | @{
2 | Layout = "_Layout";
3 | }
4 |
--------------------------------------------------------------------------------
/VoiceroidDaemon/VoiceroidDaemon.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | netcoreapp2.1
5 | AnyCPU
6 | 2.0.1
7 |
8 |
9 |
10 | false
11 | AnyCPU
12 |
13 |
14 |
15 | false
16 | AnyCPU
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 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
--------------------------------------------------------------------------------
/VoiceroidDaemon/appsettings.Development.json:
--------------------------------------------------------------------------------
1 | {
2 | "Logging": {
3 | "LogLevel": {
4 | "Default": "Debug",
5 | "System": "Information",
6 | "Microsoft": "Information"
7 | }
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/VoiceroidDaemon/appsettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "Logging": {
3 | "LogLevel": {
4 | "Default": "Warning"
5 | }
6 | },
7 | "AllowedHosts": "*"
8 | }
9 |
--------------------------------------------------------------------------------
/VoiceroidDaemon/wwwroot/css/bootstrap-theme.min.css:
--------------------------------------------------------------------------------
1 | /*!
2 | * Bootstrap v3.3.7 (http://getbootstrap.com)
3 | * Copyright 2011-2016 Twitter, Inc.
4 | * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
5 | */.btn-danger,.btn-default,.btn-info,.btn-primary,.btn-success,.btn-warning{text-shadow:0 -1px 0 rgba(0,0,0,.2);-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.15),0 1px 1px rgba(0,0,0,.075);box-shadow:inset 0 1px 0 rgba(255,255,255,.15),0 1px 1px rgba(0,0,0,.075)}.btn-danger.active,.btn-danger:active,.btn-default.active,.btn-default:active,.btn-info.active,.btn-info:active,.btn-primary.active,.btn-primary:active,.btn-success.active,.btn-success:active,.btn-warning.active,.btn-warning:active{-webkit-box-shadow:inset 0 3px 5px rgba(0,0,0,.125);box-shadow:inset 0 3px 5px rgba(0,0,0,.125)}.btn-danger.disabled,.btn-danger[disabled],.btn-default.disabled,.btn-default[disabled],.btn-info.disabled,.btn-info[disabled],.btn-primary.disabled,.btn-primary[disabled],.btn-success.disabled,.btn-success[disabled],.btn-warning.disabled,.btn-warning[disabled],fieldset[disabled] .btn-danger,fieldset[disabled] .btn-default,fieldset[disabled] .btn-info,fieldset[disabled] .btn-primary,fieldset[disabled] .btn-success,fieldset[disabled] .btn-warning{-webkit-box-shadow:none;box-shadow:none}.btn-danger .badge,.btn-default .badge,.btn-info .badge,.btn-primary .badge,.btn-success .badge,.btn-warning .badge{text-shadow:none}.btn.active,.btn:active{background-image:none}.btn-default{text-shadow:0 1px 0 #fff;background-image:-webkit-linear-gradient(top,#fff 0,#e0e0e0 100%);background-image:-o-linear-gradient(top,#fff 0,#e0e0e0 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#fff),to(#e0e0e0));background-image:linear-gradient(to bottom,#fff 0,#e0e0e0 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff', endColorstr='#ffe0e0e0', GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);background-repeat:repeat-x;border-color:#dbdbdb;border-color:#ccc}.btn-default:focus,.btn-default:hover{background-color:#e0e0e0;background-position:0 -15px}.btn-default.active,.btn-default:active{background-color:#e0e0e0;border-color:#dbdbdb}.btn-default.disabled,.btn-default.disabled.active,.btn-default.disabled.focus,.btn-default.disabled:active,.btn-default.disabled:focus,.btn-default.disabled:hover,.btn-default[disabled],.btn-default[disabled].active,.btn-default[disabled].focus,.btn-default[disabled]:active,.btn-default[disabled]:focus,.btn-default[disabled]:hover,fieldset[disabled] .btn-default,fieldset[disabled] .btn-default.active,fieldset[disabled] .btn-default.focus,fieldset[disabled] .btn-default:active,fieldset[disabled] .btn-default:focus,fieldset[disabled] .btn-default:hover{background-color:#e0e0e0;background-image:none}.btn-primary{background-image:-webkit-linear-gradient(top,#337ab7 0,#265a88 100%);background-image:-o-linear-gradient(top,#337ab7 0,#265a88 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#337ab7),to(#265a88));background-image:linear-gradient(to bottom,#337ab7 0,#265a88 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff337ab7', endColorstr='#ff265a88', GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);background-repeat:repeat-x;border-color:#245580}.btn-primary:focus,.btn-primary:hover{background-color:#265a88;background-position:0 -15px}.btn-primary.active,.btn-primary:active{background-color:#265a88;border-color:#245580}.btn-primary.disabled,.btn-primary.disabled.active,.btn-primary.disabled.focus,.btn-primary.disabled:active,.btn-primary.disabled:focus,.btn-primary.disabled:hover,.btn-primary[disabled],.btn-primary[disabled].active,.btn-primary[disabled].focus,.btn-primary[disabled]:active,.btn-primary[disabled]:focus,.btn-primary[disabled]:hover,fieldset[disabled] .btn-primary,fieldset[disabled] .btn-primary.active,fieldset[disabled] .btn-primary.focus,fieldset[disabled] .btn-primary:active,fieldset[disabled] .btn-primary:focus,fieldset[disabled] .btn-primary:hover{background-color:#265a88;background-image:none}.btn-success{background-image:-webkit-linear-gradient(top,#5cb85c 0,#419641 100%);background-image:-o-linear-gradient(top,#5cb85c 0,#419641 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#5cb85c),to(#419641));background-image:linear-gradient(to bottom,#5cb85c 0,#419641 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5cb85c', endColorstr='#ff419641', GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);background-repeat:repeat-x;border-color:#3e8f3e}.btn-success:focus,.btn-success:hover{background-color:#419641;background-position:0 -15px}.btn-success.active,.btn-success:active{background-color:#419641;border-color:#3e8f3e}.btn-success.disabled,.btn-success.disabled.active,.btn-success.disabled.focus,.btn-success.disabled:active,.btn-success.disabled:focus,.btn-success.disabled:hover,.btn-success[disabled],.btn-success[disabled].active,.btn-success[disabled].focus,.btn-success[disabled]:active,.btn-success[disabled]:focus,.btn-success[disabled]:hover,fieldset[disabled] .btn-success,fieldset[disabled] .btn-success.active,fieldset[disabled] .btn-success.focus,fieldset[disabled] .btn-success:active,fieldset[disabled] .btn-success:focus,fieldset[disabled] .btn-success:hover{background-color:#419641;background-image:none}.btn-info{background-image:-webkit-linear-gradient(top,#5bc0de 0,#2aabd2 100%);background-image:-o-linear-gradient(top,#5bc0de 0,#2aabd2 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#5bc0de),to(#2aabd2));background-image:linear-gradient(to bottom,#5bc0de 0,#2aabd2 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5bc0de', endColorstr='#ff2aabd2', GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);background-repeat:repeat-x;border-color:#28a4c9}.btn-info:focus,.btn-info:hover{background-color:#2aabd2;background-position:0 -15px}.btn-info.active,.btn-info:active{background-color:#2aabd2;border-color:#28a4c9}.btn-info.disabled,.btn-info.disabled.active,.btn-info.disabled.focus,.btn-info.disabled:active,.btn-info.disabled:focus,.btn-info.disabled:hover,.btn-info[disabled],.btn-info[disabled].active,.btn-info[disabled].focus,.btn-info[disabled]:active,.btn-info[disabled]:focus,.btn-info[disabled]:hover,fieldset[disabled] .btn-info,fieldset[disabled] .btn-info.active,fieldset[disabled] .btn-info.focus,fieldset[disabled] .btn-info:active,fieldset[disabled] .btn-info:focus,fieldset[disabled] .btn-info:hover{background-color:#2aabd2;background-image:none}.btn-warning{background-image:-webkit-linear-gradient(top,#f0ad4e 0,#eb9316 100%);background-image:-o-linear-gradient(top,#f0ad4e 0,#eb9316 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#f0ad4e),to(#eb9316));background-image:linear-gradient(to bottom,#f0ad4e 0,#eb9316 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff0ad4e', endColorstr='#ffeb9316', GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);background-repeat:repeat-x;border-color:#e38d13}.btn-warning:focus,.btn-warning:hover{background-color:#eb9316;background-position:0 -15px}.btn-warning.active,.btn-warning:active{background-color:#eb9316;border-color:#e38d13}.btn-warning.disabled,.btn-warning.disabled.active,.btn-warning.disabled.focus,.btn-warning.disabled:active,.btn-warning.disabled:focus,.btn-warning.disabled:hover,.btn-warning[disabled],.btn-warning[disabled].active,.btn-warning[disabled].focus,.btn-warning[disabled]:active,.btn-warning[disabled]:focus,.btn-warning[disabled]:hover,fieldset[disabled] .btn-warning,fieldset[disabled] .btn-warning.active,fieldset[disabled] .btn-warning.focus,fieldset[disabled] .btn-warning:active,fieldset[disabled] .btn-warning:focus,fieldset[disabled] .btn-warning:hover{background-color:#eb9316;background-image:none}.btn-danger{background-image:-webkit-linear-gradient(top,#d9534f 0,#c12e2a 100%);background-image:-o-linear-gradient(top,#d9534f 0,#c12e2a 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#d9534f),to(#c12e2a));background-image:linear-gradient(to bottom,#d9534f 0,#c12e2a 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9534f', endColorstr='#ffc12e2a', GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);background-repeat:repeat-x;border-color:#b92c28}.btn-danger:focus,.btn-danger:hover{background-color:#c12e2a;background-position:0 -15px}.btn-danger.active,.btn-danger:active{background-color:#c12e2a;border-color:#b92c28}.btn-danger.disabled,.btn-danger.disabled.active,.btn-danger.disabled.focus,.btn-danger.disabled:active,.btn-danger.disabled:focus,.btn-danger.disabled:hover,.btn-danger[disabled],.btn-danger[disabled].active,.btn-danger[disabled].focus,.btn-danger[disabled]:active,.btn-danger[disabled]:focus,.btn-danger[disabled]:hover,fieldset[disabled] .btn-danger,fieldset[disabled] .btn-danger.active,fieldset[disabled] .btn-danger.focus,fieldset[disabled] .btn-danger:active,fieldset[disabled] .btn-danger:focus,fieldset[disabled] .btn-danger:hover{background-color:#c12e2a;background-image:none}.img-thumbnail,.thumbnail{-webkit-box-shadow:0 1px 2px rgba(0,0,0,.075);box-shadow:0 1px 2px rgba(0,0,0,.075)}.dropdown-menu>li>a:focus,.dropdown-menu>li>a:hover{background-color:#e8e8e8;background-image:-webkit-linear-gradient(top,#f5f5f5 0,#e8e8e8 100%);background-image:-o-linear-gradient(top,#f5f5f5 0,#e8e8e8 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#f5f5f5),to(#e8e8e8));background-image:linear-gradient(to bottom,#f5f5f5 0,#e8e8e8 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff5f5f5', endColorstr='#ffe8e8e8', GradientType=0);background-repeat:repeat-x}.dropdown-menu>.active>a,.dropdown-menu>.active>a:focus,.dropdown-menu>.active>a:hover{background-color:#2e6da4;background-image:-webkit-linear-gradient(top,#337ab7 0,#2e6da4 100%);background-image:-o-linear-gradient(top,#337ab7 0,#2e6da4 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#337ab7),to(#2e6da4));background-image:linear-gradient(to bottom,#337ab7 0,#2e6da4 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff337ab7', endColorstr='#ff2e6da4', GradientType=0);background-repeat:repeat-x}.navbar-default{background-image:-webkit-linear-gradient(top,#fff 0,#f8f8f8 100%);background-image:-o-linear-gradient(top,#fff 0,#f8f8f8 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#fff),to(#f8f8f8));background-image:linear-gradient(to bottom,#fff 0,#f8f8f8 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff', endColorstr='#fff8f8f8', GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);background-repeat:repeat-x;border-radius:4px;-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.15),0 1px 5px rgba(0,0,0,.075);box-shadow:inset 0 1px 0 rgba(255,255,255,.15),0 1px 5px rgba(0,0,0,.075)}.navbar-default .navbar-nav>.active>a,.navbar-default .navbar-nav>.open>a{background-image:-webkit-linear-gradient(top,#dbdbdb 0,#e2e2e2 100%);background-image:-o-linear-gradient(top,#dbdbdb 0,#e2e2e2 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#dbdbdb),to(#e2e2e2));background-image:linear-gradient(to bottom,#dbdbdb 0,#e2e2e2 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffdbdbdb', endColorstr='#ffe2e2e2', GradientType=0);background-repeat:repeat-x;-webkit-box-shadow:inset 0 3px 9px rgba(0,0,0,.075);box-shadow:inset 0 3px 9px rgba(0,0,0,.075)}.navbar-brand,.navbar-nav>li>a{text-shadow:0 1px 0 rgba(255,255,255,.25)}.navbar-inverse{background-image:-webkit-linear-gradient(top,#3c3c3c 0,#222 100%);background-image:-o-linear-gradient(top,#3c3c3c 0,#222 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#3c3c3c),to(#222));background-image:linear-gradient(to bottom,#3c3c3c 0,#222 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff3c3c3c', endColorstr='#ff222222', GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);background-repeat:repeat-x;border-radius:4px}.navbar-inverse .navbar-nav>.active>a,.navbar-inverse .navbar-nav>.open>a{background-image:-webkit-linear-gradient(top,#080808 0,#0f0f0f 100%);background-image:-o-linear-gradient(top,#080808 0,#0f0f0f 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#080808),to(#0f0f0f));background-image:linear-gradient(to bottom,#080808 0,#0f0f0f 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff080808', endColorstr='#ff0f0f0f', GradientType=0);background-repeat:repeat-x;-webkit-box-shadow:inset 0 3px 9px rgba(0,0,0,.25);box-shadow:inset 0 3px 9px rgba(0,0,0,.25)}.navbar-inverse .navbar-brand,.navbar-inverse .navbar-nav>li>a{text-shadow:0 -1px 0 rgba(0,0,0,.25)}.navbar-fixed-bottom,.navbar-fixed-top,.navbar-static-top{border-radius:0}@media (max-width:767px){.navbar .navbar-nav .open .dropdown-menu>.active>a,.navbar .navbar-nav .open .dropdown-menu>.active>a:focus,.navbar .navbar-nav .open .dropdown-menu>.active>a:hover{color:#fff;background-image:-webkit-linear-gradient(top,#337ab7 0,#2e6da4 100%);background-image:-o-linear-gradient(top,#337ab7 0,#2e6da4 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#337ab7),to(#2e6da4));background-image:linear-gradient(to bottom,#337ab7 0,#2e6da4 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff337ab7', endColorstr='#ff2e6da4', GradientType=0);background-repeat:repeat-x}}.alert{text-shadow:0 1px 0 rgba(255,255,255,.2);-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,.25),0 1px 2px rgba(0,0,0,.05);box-shadow:inset 0 1px 0 rgba(255,255,255,.25),0 1px 2px rgba(0,0,0,.05)}.alert-success{background-image:-webkit-linear-gradient(top,#dff0d8 0,#c8e5bc 100%);background-image:-o-linear-gradient(top,#dff0d8 0,#c8e5bc 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#dff0d8),to(#c8e5bc));background-image:linear-gradient(to bottom,#dff0d8 0,#c8e5bc 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffdff0d8', endColorstr='#ffc8e5bc', GradientType=0);background-repeat:repeat-x;border-color:#b2dba1}.alert-info{background-image:-webkit-linear-gradient(top,#d9edf7 0,#b9def0 100%);background-image:-o-linear-gradient(top,#d9edf7 0,#b9def0 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#d9edf7),to(#b9def0));background-image:linear-gradient(to bottom,#d9edf7 0,#b9def0 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9edf7', endColorstr='#ffb9def0', GradientType=0);background-repeat:repeat-x;border-color:#9acfea}.alert-warning{background-image:-webkit-linear-gradient(top,#fcf8e3 0,#f8efc0 100%);background-image:-o-linear-gradient(top,#fcf8e3 0,#f8efc0 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#fcf8e3),to(#f8efc0));background-image:linear-gradient(to bottom,#fcf8e3 0,#f8efc0 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fffcf8e3', endColorstr='#fff8efc0', GradientType=0);background-repeat:repeat-x;border-color:#f5e79e}.alert-danger{background-image:-webkit-linear-gradient(top,#f2dede 0,#e7c3c3 100%);background-image:-o-linear-gradient(top,#f2dede 0,#e7c3c3 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#f2dede),to(#e7c3c3));background-image:linear-gradient(to bottom,#f2dede 0,#e7c3c3 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff2dede', endColorstr='#ffe7c3c3', GradientType=0);background-repeat:repeat-x;border-color:#dca7a7}.progress{background-image:-webkit-linear-gradient(top,#ebebeb 0,#f5f5f5 100%);background-image:-o-linear-gradient(top,#ebebeb 0,#f5f5f5 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#ebebeb),to(#f5f5f5));background-image:linear-gradient(to bottom,#ebebeb 0,#f5f5f5 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffebebeb', endColorstr='#fff5f5f5', GradientType=0);background-repeat:repeat-x}.progress-bar{background-image:-webkit-linear-gradient(top,#337ab7 0,#286090 100%);background-image:-o-linear-gradient(top,#337ab7 0,#286090 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#337ab7),to(#286090));background-image:linear-gradient(to bottom,#337ab7 0,#286090 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff337ab7', endColorstr='#ff286090', GradientType=0);background-repeat:repeat-x}.progress-bar-success{background-image:-webkit-linear-gradient(top,#5cb85c 0,#449d44 100%);background-image:-o-linear-gradient(top,#5cb85c 0,#449d44 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#5cb85c),to(#449d44));background-image:linear-gradient(to bottom,#5cb85c 0,#449d44 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5cb85c', endColorstr='#ff449d44', GradientType=0);background-repeat:repeat-x}.progress-bar-info{background-image:-webkit-linear-gradient(top,#5bc0de 0,#31b0d5 100%);background-image:-o-linear-gradient(top,#5bc0de 0,#31b0d5 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#5bc0de),to(#31b0d5));background-image:linear-gradient(to bottom,#5bc0de 0,#31b0d5 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5bc0de', endColorstr='#ff31b0d5', GradientType=0);background-repeat:repeat-x}.progress-bar-warning{background-image:-webkit-linear-gradient(top,#f0ad4e 0,#ec971f 100%);background-image:-o-linear-gradient(top,#f0ad4e 0,#ec971f 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#f0ad4e),to(#ec971f));background-image:linear-gradient(to bottom,#f0ad4e 0,#ec971f 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff0ad4e', endColorstr='#ffec971f', GradientType=0);background-repeat:repeat-x}.progress-bar-danger{background-image:-webkit-linear-gradient(top,#d9534f 0,#c9302c 100%);background-image:-o-linear-gradient(top,#d9534f 0,#c9302c 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#d9534f),to(#c9302c));background-image:linear-gradient(to bottom,#d9534f 0,#c9302c 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9534f', endColorstr='#ffc9302c', GradientType=0);background-repeat:repeat-x}.progress-bar-striped{background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:-o-linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,.15) 50%,rgba(255,255,255,.15) 75%,transparent 75%,transparent)}.list-group{border-radius:4px;-webkit-box-shadow:0 1px 2px rgba(0,0,0,.075);box-shadow:0 1px 2px rgba(0,0,0,.075)}.list-group-item.active,.list-group-item.active:focus,.list-group-item.active:hover{text-shadow:0 -1px 0 #286090;background-image:-webkit-linear-gradient(top,#337ab7 0,#2b669a 100%);background-image:-o-linear-gradient(top,#337ab7 0,#2b669a 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#337ab7),to(#2b669a));background-image:linear-gradient(to bottom,#337ab7 0,#2b669a 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff337ab7', endColorstr='#ff2b669a', GradientType=0);background-repeat:repeat-x;border-color:#2b669a}.list-group-item.active .badge,.list-group-item.active:focus .badge,.list-group-item.active:hover .badge{text-shadow:none}.panel{-webkit-box-shadow:0 1px 2px rgba(0,0,0,.05);box-shadow:0 1px 2px rgba(0,0,0,.05)}.panel-default>.panel-heading{background-image:-webkit-linear-gradient(top,#f5f5f5 0,#e8e8e8 100%);background-image:-o-linear-gradient(top,#f5f5f5 0,#e8e8e8 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#f5f5f5),to(#e8e8e8));background-image:linear-gradient(to bottom,#f5f5f5 0,#e8e8e8 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff5f5f5', endColorstr='#ffe8e8e8', GradientType=0);background-repeat:repeat-x}.panel-primary>.panel-heading{background-image:-webkit-linear-gradient(top,#337ab7 0,#2e6da4 100%);background-image:-o-linear-gradient(top,#337ab7 0,#2e6da4 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#337ab7),to(#2e6da4));background-image:linear-gradient(to bottom,#337ab7 0,#2e6da4 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff337ab7', endColorstr='#ff2e6da4', GradientType=0);background-repeat:repeat-x}.panel-success>.panel-heading{background-image:-webkit-linear-gradient(top,#dff0d8 0,#d0e9c6 100%);background-image:-o-linear-gradient(top,#dff0d8 0,#d0e9c6 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#dff0d8),to(#d0e9c6));background-image:linear-gradient(to bottom,#dff0d8 0,#d0e9c6 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffdff0d8', endColorstr='#ffd0e9c6', GradientType=0);background-repeat:repeat-x}.panel-info>.panel-heading{background-image:-webkit-linear-gradient(top,#d9edf7 0,#c4e3f3 100%);background-image:-o-linear-gradient(top,#d9edf7 0,#c4e3f3 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#d9edf7),to(#c4e3f3));background-image:linear-gradient(to bottom,#d9edf7 0,#c4e3f3 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffd9edf7', endColorstr='#ffc4e3f3', GradientType=0);background-repeat:repeat-x}.panel-warning>.panel-heading{background-image:-webkit-linear-gradient(top,#fcf8e3 0,#faf2cc 100%);background-image:-o-linear-gradient(top,#fcf8e3 0,#faf2cc 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#fcf8e3),to(#faf2cc));background-image:linear-gradient(to bottom,#fcf8e3 0,#faf2cc 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fffcf8e3', endColorstr='#fffaf2cc', GradientType=0);background-repeat:repeat-x}.panel-danger>.panel-heading{background-image:-webkit-linear-gradient(top,#f2dede 0,#ebcccc 100%);background-image:-o-linear-gradient(top,#f2dede 0,#ebcccc 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#f2dede),to(#ebcccc));background-image:linear-gradient(to bottom,#f2dede 0,#ebcccc 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff2dede', endColorstr='#ffebcccc', GradientType=0);background-repeat:repeat-x}.well{background-image:-webkit-linear-gradient(top,#e8e8e8 0,#f5f5f5 100%);background-image:-o-linear-gradient(top,#e8e8e8 0,#f5f5f5 100%);background-image:-webkit-gradient(linear,left top,left bottom,from(#e8e8e8),to(#f5f5f5));background-image:linear-gradient(to bottom,#e8e8e8 0,#f5f5f5 100%);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffe8e8e8', endColorstr='#fff5f5f5', GradientType=0);background-repeat:repeat-x;border-color:#dcdcdc;-webkit-box-shadow:inset 0 1px 3px rgba(0,0,0,.05),0 1px 0 rgba(255,255,255,.1);box-shadow:inset 0 1px 3px rgba(0,0,0,.05),0 1px 0 rgba(255,255,255,.1)}
6 | /*# sourceMappingURL=bootstrap-theme.min.css.map */
--------------------------------------------------------------------------------
/VoiceroidDaemon/wwwroot/css/site.min.css:
--------------------------------------------------------------------------------
1 | body{padding-top:50px;padding-bottom:20px}.body-content{padding-left:15px;padding-right:15px}.carousel-caption p{font-size:20px;line-height:1.4}.carousel-inner .item img[src$=".svg"]{width:100%}#qrCode{margin:15px}@media screen and (max-width:767px){.carousel-caption{display:none}}
--------------------------------------------------------------------------------
/voiceroid_daemon.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 15
4 | VisualStudioVersion = 15.0.28307.168
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "voiceroidd", "voiceroidd\voiceroidd.csproj", "{59726917-207F-4788-A149-6147E725CB85}"
7 | EndProject
8 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Aitalk", "Aitalk\Aitalk.csproj", "{B78D299F-CBB0-486F-A333-4013854480A7}"
9 | EndProject
10 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "VoiceroidDaemon", "VoiceroidDaemon\VoiceroidDaemon.csproj", "{AF74AC19-E106-426B-B784-3EEF41EA3B29}"
11 | ProjectSection(ProjectDependencies) = postProject
12 | {4841FCA9-E2DF-4412-8043-F73937D7C2F3} = {4841FCA9-E2DF-4412-8043-F73937D7C2F3}
13 | EndProjectSection
14 | EndProject
15 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Injecter", "Injecter\Injecter.csproj", "{4841FCA9-E2DF-4412-8043-F73937D7C2F3}"
16 | EndProject
17 | Global
18 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
19 | Debug|Any CPU = Debug|Any CPU
20 | Release|Any CPU = Release|Any CPU
21 | EndGlobalSection
22 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
23 | {59726917-207F-4788-A149-6147E725CB85}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
24 | {59726917-207F-4788-A149-6147E725CB85}.Debug|Any CPU.Build.0 = Debug|Any CPU
25 | {59726917-207F-4788-A149-6147E725CB85}.Release|Any CPU.ActiveCfg = Release|Any CPU
26 | {59726917-207F-4788-A149-6147E725CB85}.Release|Any CPU.Build.0 = Release|Any CPU
27 | {B78D299F-CBB0-486F-A333-4013854480A7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
28 | {B78D299F-CBB0-486F-A333-4013854480A7}.Debug|Any CPU.Build.0 = Debug|Any CPU
29 | {B78D299F-CBB0-486F-A333-4013854480A7}.Release|Any CPU.ActiveCfg = Release|Any CPU
30 | {B78D299F-CBB0-486F-A333-4013854480A7}.Release|Any CPU.Build.0 = Release|Any CPU
31 | {AF74AC19-E106-426B-B784-3EEF41EA3B29}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
32 | {AF74AC19-E106-426B-B784-3EEF41EA3B29}.Debug|Any CPU.Build.0 = Debug|Any CPU
33 | {AF74AC19-E106-426B-B784-3EEF41EA3B29}.Release|Any CPU.ActiveCfg = Release|Any CPU
34 | {AF74AC19-E106-426B-B784-3EEF41EA3B29}.Release|Any CPU.Build.0 = Release|Any CPU
35 | {4841FCA9-E2DF-4412-8043-F73937D7C2F3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
36 | {4841FCA9-E2DF-4412-8043-F73937D7C2F3}.Debug|Any CPU.Build.0 = Debug|Any CPU
37 | {4841FCA9-E2DF-4412-8043-F73937D7C2F3}.Release|Any CPU.ActiveCfg = Release|Any CPU
38 | {4841FCA9-E2DF-4412-8043-F73937D7C2F3}.Release|Any CPU.Build.0 = Release|Any CPU
39 | EndGlobalSection
40 | GlobalSection(SolutionProperties) = preSolution
41 | HideSolutionNode = FALSE
42 | EndGlobalSection
43 | GlobalSection(ExtensibilityGlobals) = postSolution
44 | SolutionGuid = {290AF929-DF9E-4D42-BE30-E4EA4676695B}
45 | EndGlobalSection
46 | EndGlobal
47 |
--------------------------------------------------------------------------------
/voiceroidd/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/voiceroidd/Config.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Text;
3 | using System.IO;
4 | using System.Runtime.InteropServices;
5 | using System.Runtime.Serialization;
6 | using System.Runtime.Serialization.Json;
7 |
8 | namespace VoiceroidDaemon
9 | {
10 | [DataContract]
11 | internal class Configuration
12 | {
13 | ///
14 | /// VOICEROID2エディタの実行ファイル名
15 | ///
16 | [DataMember]
17 | public string VoiceroidEditorExe;
18 |
19 | ///
20 | /// インストールディレクトリのパス
21 | ///
22 | [DataMember]
23 | public string InstallPath;
24 |
25 | ///
26 | /// 認証コードのシード値
27 | ///
28 | [DataMember]
29 | public string AuthCodeSeed = "";
30 |
31 | ///
32 | /// 言語名
33 | ///
34 | [DataMember]
35 | public string LanguageName;
36 |
37 | ///
38 | /// フレーズ辞書のファイルパス
39 | ///
40 | [DataMember]
41 | public string PhraseDictionaryPath = "";
42 |
43 | ///
44 | /// 単語辞書のファイルパス
45 | ///
46 | [DataMember]
47 | public string WordDictionaryPath = "";
48 |
49 | ///
50 | /// 記号ポーズ辞書のファイルパス
51 | ///
52 | [DataMember]
53 | public string SymbolDictionaryPath = "";
54 |
55 | ///
56 | /// ボイスライブラリ名
57 | ///
58 | [DataMember]
59 | public string VoiceDbName = "";
60 |
61 | ///
62 | /// 話者名。単一話者のライブラリならボイスライブラリ名と同じだと思われる。
63 | ///
64 | [DataMember]
65 | public string VoiceName = "";
66 |
67 | ///
68 | /// 読み仮名変換のタイムアウト[ms]
69 | ///
70 | [DataMember]
71 | public int KanaTimeout = 0;
72 |
73 | ///
74 | /// 音声変換のタイムアウト[ms]
75 | ///
76 | [DataMember]
77 | public int SpeechTimeout = 0;
78 |
79 | ///
80 | /// 待ち受けアドレス
81 | ///
82 | [DataMember]
83 | public string ListeningAddress;
84 |
85 | ///
86 | /// デシリアライズ前に呼ばれる。
87 | /// 初期値を代入する。
88 | ///
89 | ///
90 | [OnDeserializing]
91 | internal void OnDeserializing(StreamingContext context)
92 | {
93 | LoadInitialValues();
94 | }
95 |
96 | ///
97 | /// コンストラクタ
98 | ///
99 | private Configuration() { }
100 |
101 | ///
102 | /// 既定の初期値でないメンバーに初期値を代入する
103 | ///
104 | private void LoadInitialValues()
105 | {
106 | VoiceroidEditorExe = "VoiceroidEditor.exe";
107 | InstallPath = System.Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86) + "\\AHS\\VOICEROID2";
108 | LanguageName = "standard";
109 | ListeningAddress = "http://127.0.0.1:8080/";
110 | }
111 |
112 | ///
113 | /// 設定ファイルを読み込む
114 | ///
115 | /// 設定ファイルのパス
116 | /// 読み込まれた設定
117 | public static Configuration Load(string file_path, out bool not_exists)
118 | {
119 | not_exists = !File.Exists(file_path);
120 | try
121 | {
122 | using (Stream stream = new FileStream(file_path, FileMode.Open, FileAccess.Read))
123 | {
124 | var serializer = new DataContractJsonSerializer(typeof(Configuration));
125 | return (Configuration)serializer.ReadObject(stream);
126 | }
127 | }
128 | catch (Exception)
129 | {
130 | // 初期値を返す
131 | var config = new Configuration();
132 | config.LoadInitialValues();
133 | return config;
134 | }
135 | }
136 |
137 | ///
138 | /// 設定ファイルを保存する
139 | ///
140 | /// 設定ファイルのパス
141 | /// 保存できたらtrueを返す
142 | public bool Save(string file_path)
143 | {
144 | try
145 | {
146 | using (Stream stream = new FileStream(file_path, FileMode.Create, FileAccess.Write))
147 | {
148 | using (var writer = JsonReaderWriterFactory.CreateJsonWriter(stream, Encoding.UTF8, true, true, " "))
149 | {
150 | var serializer = new DataContractJsonSerializer(typeof(Configuration));
151 | serializer.WriteObject(writer, this);
152 | writer.Flush();
153 | }
154 | }
155 | return true;
156 | }
157 | catch (Exception)
158 | {
159 | return false;
160 | }
161 | }
162 | }
163 |
164 | internal static class IniFileHandler
165 | {
166 | [DllImport("kernel32.dll", CharSet = CharSet.Unicode)]
167 | public static extern uint GetPrivateProfileString(
168 | string lpAppName,
169 | string lpKeyName,
170 | string lpDefault,
171 | StringBuilder lpReturnedString,
172 | uint nSize,
173 | string lpFileName);
174 |
175 | [DllImport("kernel32.dll", CharSet = CharSet.Unicode)]
176 | public static extern uint WritePrivateProfileString(
177 | string lpAppName,
178 | string lpKeyName,
179 | string lpString,
180 | string lpFileName);
181 | }
182 | }
183 |
--------------------------------------------------------------------------------
/voiceroidd/Injecter.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Reflection;
3 | using System.Diagnostics;
4 | using Codeer.Friendly.Windows;
5 | using Codeer.Friendly.Dynamic;
6 |
7 | namespace VoiceroidDaemon
8 | {
9 | ///
10 | /// VOICEROID2エディタにDLLインジェクションするクラス
11 | ///
12 | public class Injecter
13 | {
14 | ///
15 | /// 認証コードを取得する。
16 | /// VOICEROID2エディタが実行中である必要がある。
17 | ///
18 | /// 認証コードのシード値
19 | public static string GetKey()
20 | {
21 | // VOICEROIDエディタのプロセスを検索する
22 | Process[] voiceroid_processes = Process.GetProcessesByName("VoiceroidEditor");
23 | if (voiceroid_processes.Length == 0)
24 | {
25 | return null;
26 | }
27 | Process process = voiceroid_processes[0];
28 |
29 | // プロセスに接続する
30 | WindowsAppFriend app = new WindowsAppFriend(process);
31 | WindowsAppExpander.LoadAssembly(app, typeof(Injecter).Assembly);
32 | dynamic injected_program = app.Type(typeof(Injecter));
33 | try
34 | {
35 | // 認証コードを読み取って返す
36 | return injected_program.InjectedGetKey();
37 | }
38 | catch (Exception)
39 | {
40 | return null;
41 | }
42 | }
43 |
44 | ///
45 | /// 認証コードの取得のためにDLLインジェクション先で実行されるコード
46 | ///
47 | ///
48 | private static string InjectedGetKey()
49 | {
50 | Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies();
51 | foreach (Assembly assembly in assemblies)
52 | {
53 | if (assembly.GetName().Name == "AI.Framework.App")
54 | {
55 | Type type = assembly.GetType("AI.Framework.AppFramework");
56 | var property = type.GetProperty("Current");
57 | dynamic current = property.GetValue(type);
58 | return (string)current.AppSettings.LicenseKey;
59 | }
60 | }
61 | return null;
62 | }
63 | }
64 | }
65 |
--------------------------------------------------------------------------------
/voiceroidd/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Text;
3 | using System.IO;
4 | using System.Net;
5 | using System.Web;
6 | using System.Threading;
7 | using System.Threading.Tasks;
8 | using System.Windows.Forms;
9 | using System.Drawing;
10 | using System.Diagnostics;
11 | using System.Runtime.Serialization.Json;
12 | using System.ComponentModel.DataAnnotations;
13 | using McMaster.Extensions.CommandLineUtils;
14 | using Aitalk;
15 |
16 | namespace VoiceroidDaemon
17 | {
18 | [Command(Name = "voiceroidd", Description = "VOICEROID2 HTTP Server Daemon", ThrowOnUnexpectedArgument = false)]
19 | [SuppressDefaultHelpOption]
20 | class Program
21 | {
22 | ///
23 | /// エントリーポイント
24 | ///
25 | /// コマンドライン引数
26 | public static int Main(string[] args)
27 | {
28 | // コマンドライン引数をパースしてOnExecute()を呼び出す
29 | return CommandLineApplication.Execute(args);
30 | }
31 |
32 | ///
33 | /// 設定ファイルのパス
34 | ///
35 | [Option("-c", CommandOptionType.SingleValue)]
36 | private string ConfigFilePath { get; } = "config.json";
37 |
38 | ///
39 | /// 動作モード。
40 | /// "server"ならサーバー、"auth"なら認証コードの取得
41 | ///
42 | [Argument(0, Description = "auth or server")]
43 | public string OperationMode { get; } = "";
44 |
45 | ///
46 | /// プログラムの実行する
47 | ///
48 | private void OnExecute()
49 | {
50 | // 設定を読み込む
51 | Config = Configuration.Load(ConfigFilePath, out bool not_exists);
52 | if (not_exists == true)
53 | {
54 | Config.Save(ConfigFilePath);
55 | }
56 |
57 | try
58 | {
59 | // 動作モードに応じて処理を開始する
60 | switch (OperationMode.ToLower())
61 | {
62 | case "auth":
63 | GetAuthCode();
64 | break;
65 |
66 | case "server":
67 | StartServer();
68 | break;
69 |
70 | default:
71 | // ヘルプテキストを表示する
72 | MessageBox.Show(
73 | $@"コマンド
74 | ・認証コードを取得する。
75 | voiceroidd auth
76 | ・HTTPサーバーを起動する。
77 | voiceroidd server
78 |
79 | オプション
80 | ・設定ファイルのパスを明示的に指定する。未指定の場合は'config.json'が使用される。
81 | -c "
82 | , Caption);
83 | break;
84 | }
85 | }
86 | catch(Exception ex)
87 | {
88 | MessageBox.Show(ex.ToString(), Caption, MessageBoxButtons.OK, MessageBoxIcon.Error);
89 | }
90 | }
91 |
92 | ///
93 | /// 認証コードを取得して設定ファイルに記録するモード
94 | ///
95 | private void GetAuthCode()
96 | {
97 | DialogResult result;
98 | result = MessageBox.Show(
99 | "DLLの初期化に必要な認証コードをVOICEROID2エディタから取得します。\nVOICEROID2エディタを起動してください。",
100 | Caption, MessageBoxButtons.OKCancel);
101 | if (result != DialogResult.OK)
102 | {
103 | MessageBox.Show("認証コードの取得は中断されました。", Caption);
104 | }
105 | else
106 | {
107 | string auth_code_seed = Injecter.GetKey();
108 | if (auth_code_seed == null)
109 | {
110 | MessageBox.Show("認証コードの取得に失敗しました。", Caption);
111 | }
112 | else
113 | {
114 | result = MessageBox.Show(
115 | $"認証コード'{auth_code_seed}'を取得しました。\n設定を{ConfigFilePath}に保存しますか?",
116 | Caption, MessageBoxButtons.YesNo);
117 | if (result != DialogResult.Yes)
118 | {
119 | MessageBox.Show("認証コードは保存されませんでした。", Caption);
120 | }
121 | else
122 | {
123 | Config.AuthCodeSeed = auth_code_seed;
124 | if (Config.Save(ConfigFilePath) == true)
125 | {
126 | MessageBox.Show("設定を保存しました。", Caption);
127 | }
128 | else
129 | {
130 | MessageBox.Show("設定の保存に失敗しました。", Caption);
131 | }
132 | }
133 | }
134 | }
135 | }
136 |
137 | ///
138 | /// HTTPサーバーを起動するモード
139 | ///
140 | private void StartServer()
141 | {
142 | #if DEBUG
143 | // Debugビルドの場合、ログファイルを出力する
144 | Trace.Listeners.Add(new TextWriterTraceListener("trace.log"));
145 | Trace.AutoFlush = true;
146 | #endif
147 |
148 | // AITalkを初期化する
149 | AitalkWrapper.Initialize(Config.InstallPath, Config.AuthCodeSeed);
150 |
151 | try
152 | {
153 | // 言語ライブラリを読み込む
154 | AitalkWrapper.LoadLanguage(Config.LanguageName);
155 |
156 | // フレーズ辞書が設定されていれば読み込む
157 | if (File.Exists(Config.PhraseDictionaryPath))
158 | {
159 | AitalkWrapper.ReloadPhraseDictionary(Config.PhraseDictionaryPath);
160 | }
161 |
162 | // 単語辞書が設定されていれば読み込む
163 | if (File.Exists(Config.WordDictionaryPath))
164 | {
165 | AitalkWrapper.ReloadWordDictionary(Config.WordDictionaryPath);
166 | }
167 |
168 | // 記号ポーズ辞書が設定されていれば読み込む
169 | if (File.Exists(Config.SymbolDictionaryPath))
170 | {
171 | AitalkWrapper.ReloadSymbolDictionary(Config.SymbolDictionaryPath);
172 | }
173 |
174 | // ボイスライブラリを読み込む
175 | AitalkWrapper.LoadVoice(Config.VoiceDbName);
176 |
177 | // 話者を設定する
178 | AitalkWrapper.Parameter.CurrentSpeakerName = Config.VoiceName;
179 |
180 | // 処理を別スレッドで実行する
181 | Task task = Task.Factory.StartNew(Run);
182 |
183 | // トレイアイコンを作成する
184 | // アイコンはVOICEROIDエディタのものを使用するが、ダメならこの実行ファイルのものを使用する
185 | NotifyIcon notify_icon = new NotifyIcon();
186 | try
187 | {
188 | notify_icon.Icon = Icon.ExtractAssociatedIcon($"{Config.InstallPath}\\{Config.VoiceroidEditorExe}");
189 | }
190 | catch (Exception)
191 | {
192 | notify_icon.Icon = Icon.ExtractAssociatedIcon(Application.ExecutablePath);
193 | }
194 | notify_icon.Text = $"{Caption} : {Config.VoiceName}\nListening at {Config.ListeningAddress}";
195 | notify_icon.Visible = true;
196 |
197 | // トレイアイコンのコンテキストメニューを作成する
198 | ContextMenu menu = new ContextMenu();
199 | menu.MenuItems.Add(new MenuItem("Exit", new EventHandler((object sender, EventArgs e) =>
200 | {
201 | StopServerCancelToken.Cancel();
202 | task.Wait();
203 | notify_icon.Visible = false;
204 | Application.Exit();
205 | Environment.Exit(1);
206 | })));
207 | notify_icon.ContextMenu = menu;
208 |
209 | // メッセージループを開始する
210 | Application.Run();
211 | }
212 | finally
213 | {
214 | AitalkWrapper.Finish();
215 | }
216 | }
217 |
218 | // 処理を本体
219 | private void Run()
220 | {
221 | try
222 | {
223 | // HTTPサーバーを開始する
224 | var server = new HttpListener();
225 | server.Prefixes.Add(Config.ListeningAddress);
226 | server.Start();
227 | Trace.WriteLine($"HTTP server is listening at {Config.ListeningAddress}");
228 | Task server_task = WaitConnections(server, StopServerCancelToken.Token);
229 | try
230 | {
231 | server_task.Wait();
232 | }
233 | catch (Exception ex)
234 | {
235 | Trace.WriteLine($"{DateTime.Now} : server_task.Wait()\n{ex}");
236 | }
237 | }
238 | catch (Exception ex)
239 | {
240 | Trace.WriteLine($"{DateTime.Now} : Run()\n{ex}");
241 | MessageBox.Show(ex.ToString(), Caption);
242 | return;
243 | }
244 | }
245 |
246 | // 接続を待ち受ける
247 | private async Task WaitConnections(HttpListener server, CancellationToken cancel_token)
248 | {
249 | cancel_token.Register(() => server.Stop());
250 | while (cancel_token.IsCancellationRequested == false)
251 | {
252 | // リクエストを取得する
253 | var context = await server.GetContextAsync();
254 | try
255 | {
256 | ProcessRequest(context);
257 | }
258 | catch (Exception ex)
259 | {
260 | Trace.WriteLine($"{DateTime.Now} : WaitConnections()\n{ex}");
261 | MessageBox.Show(ex.ToString(), Caption);
262 | return;
263 | }
264 | }
265 | }
266 |
267 | // リクエストを処理する
268 | private void ProcessRequest(HttpListenerContext context)
269 | {
270 | HttpListenerRequest request = context.Request;
271 | HttpListenerResponse responce = context.Response;
272 |
273 | try
274 | {
275 | if (request.HttpMethod != "GET")
276 | {
277 | throw new NotImplementedException();
278 | }
279 |
280 | int offset = 0;
281 | string path = request.RawUrl.Substring(1);
282 | var query = HttpUtility.ParseQueryString(request.Url.Query);
283 |
284 | // メソッド名を調べる
285 | if (UrlMatch(path, "kana/", ref offset) == true)
286 | {
287 | // 仮名変換メソッドを呼び出している
288 | if (UrlMatch(path, "fromtext/", ref offset) == false)
289 | {
290 | throw new ArgumentException("変換するテキストが指定されていません。");
291 | }
292 |
293 | // 変換するテキストを取得する
294 | string text_encoded = path.Substring(offset, path.Length - offset);
295 | string text = HttpUtility.UrlDecode(text_encoded);
296 | string kana = AitalkWrapper.TextToKana(text, Config.KanaTimeout);
297 |
298 | // 仮名を返す
299 | byte[] result = Encoding.UTF8.GetBytes(kana);
300 | responce.OutputStream.Write(result, 0, result.Length);
301 | responce.ContentEncoding = Encoding.UTF8;
302 | responce.ContentType = "text/plain";
303 | }
304 | else if (UrlMatch(path, "speech/", ref offset) == true)
305 | {
306 | // 音声変換メソッドを呼び出している
307 | string kana = null;
308 | if (UrlMatch(path, "fromtext/", ref offset) == true)
309 | {
310 | // テキストが入力されたときは仮名に変換する
311 | string text_encoded = path.Substring(offset, path.Length - offset);
312 | string text = HttpUtility.UrlDecode(text_encoded);
313 | kana = AitalkWrapper.TextToKana(text, Config.KanaTimeout);
314 | }
315 | else if (UrlMatch(path, "fromkana/", ref offset) == true)
316 | {
317 | string kana_encoded = path.Substring(offset, path.Length - offset);
318 | kana = HttpUtility.UrlDecode(kana_encoded);
319 | }
320 | else
321 | {
322 | throw new ArgumentException("変換するテキストが指定されていません。");
323 | }
324 |
325 | // 音声に変換する
326 | var stream = new MemoryStream();
327 | AitalkWrapper.KanaToSpeech(kana, stream, Config.SpeechTimeout);
328 |
329 | // 音声を返す
330 | byte[] result = stream.ToArray();
331 | responce.OutputStream.Write(result, 0, result.Length);
332 | responce.ContentType = "audio/wav";
333 | }
334 | else if (path == "voicedb.json")
335 | {
336 | // ボイスライブラリの一覧を返す
337 | string[] voice_db_list = AitalkWrapper.VoiceDbList;
338 | using (var stream = new MemoryStream())
339 | {
340 | var serializer = new DataContractJsonSerializer(typeof(string[]));
341 | serializer.WriteObject(stream, voice_db_list);
342 | byte[] result = stream.ToArray();
343 | responce.OutputStream.Write(result, 0, result.Length);
344 | responce.ContentEncoding = Encoding.UTF8;
345 | responce.ContentType = "application/json";
346 | }
347 | }
348 | else if (path == "param.json")
349 | {
350 | // TTSパラメータを返す
351 | byte[] result = AitalkWrapper.Parameter.ToJson();
352 | responce.OutputStream.Write(result, 0, result.Length);
353 | responce.ContentEncoding = Encoding.UTF8;
354 | responce.ContentType = "application/json";
355 | }
356 | else
357 | {
358 | throw new FileNotFoundException();
359 | }
360 | }
361 | catch(NotImplementedException)
362 | {
363 | responce.StatusCode = (int)HttpStatusCode.NotImplemented;
364 | }
365 | catch (FileNotFoundException)
366 | {
367 | responce.StatusCode = (int)HttpStatusCode.NotFound;
368 | }
369 | catch (Exception ex)
370 | {
371 | // 例外を文字列化して返す
372 | responce.StatusCode = (int)HttpStatusCode.InternalServerError;
373 | byte[] byte_data = Encoding.UTF8.GetBytes(ex.ToString());
374 | responce.OutputStream.Write(byte_data, 0, byte_data.Length);
375 | responce.ContentEncoding = Encoding.UTF8;
376 | responce.ContentType = "text/plain";
377 | }
378 |
379 | // レスポンスを返す
380 | responce.Close();
381 | }
382 |
383 | // subpathがurlのパスの一部に一致するか調べ、一致したら次の部分パスを比較できるようにインデックスをずらす
384 | private static bool UrlMatch(string url, string subpath, ref int offset)
385 | {
386 | if (string.Compare(url, offset, subpath, 0, subpath.Length) == 0)
387 | {
388 | offset += subpath.Length;
389 | return true;
390 | }
391 | else
392 | {
393 | return false;
394 | }
395 | }
396 |
397 | ///
398 | /// 設定
399 | ///
400 | private Configuration Config;
401 |
402 | // サーバーを終了させるためのCancellationToken
403 | private CancellationTokenSource StopServerCancelToken = new CancellationTokenSource();
404 |
405 | ///
406 | /// メッセージボックスなどのキャプション
407 | ///
408 | private const string Caption = "Voiceroid Daemon";
409 | }
410 | }
411 |
--------------------------------------------------------------------------------
/voiceroidd/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // アセンブリに関する一般情報は以下の属性セットをとおして制御されます。
6 | // アセンブリに関連付けられている情報を変更するには、
7 | // これらの属性値を変更してください。
8 | [assembly: AssemblyTitle("voiceroidd")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("voiceroidd")]
13 | [assembly: AssemblyCopyright("Copyright © 2019")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // ComVisible を false に設定すると、このアセンブリ内の型は COM コンポーネントから
18 | // 参照できなくなります。COM からこのアセンブリ内の型にアクセスする必要がある場合は、
19 | // その型の ComVisible 属性を true に設定してください。
20 | [assembly: ComVisible(false)]
21 |
22 | // このプロジェクトが COM に公開される場合、次の GUID が typelib の ID になります
23 | [assembly: Guid("59726917-207f-4788-a149-6147e725cb85")]
24 |
25 | // アセンブリのバージョン情報は次の 4 つの値で構成されています:
26 | //
27 | // メジャー バージョン
28 | // マイナー バージョン
29 | // ビルド番号
30 | // Revision
31 | //
32 | // すべての値を指定するか、次を使用してビルド番号とリビジョン番号を既定に設定できます
33 | // 既定値にすることができます:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/voiceroidd/app.manifest:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
52 |
53 |
54 | true
55 |
56 |
57 |
58 |
59 |
73 |
74 |
75 |
--------------------------------------------------------------------------------
/voiceroidd/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/voiceroidd/voiceroidd.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {59726917-207F-4788-A149-6147E725CB85}
8 | WinExe
9 | voiceroidd
10 | voiceroidd
11 | v4.6.1
12 | 512
13 | true
14 | true
15 | publish\
16 | true
17 | Disk
18 | false
19 | Foreground
20 | 7
21 | Days
22 | false
23 | false
24 | true
25 | 0
26 | 1.0.0.%2a
27 | false
28 | false
29 | true
30 |
31 |
32 |
33 | AnyCPU
34 | true
35 | full
36 | false
37 | ..\Debug\
38 | DEBUG;TRACE
39 | prompt
40 | 4
41 |
42 |
43 | AnyCPU
44 | pdbonly
45 | true
46 | ..\Release\
47 | TRACE
48 | prompt
49 | 4
50 |
51 |
52 |
53 |
54 |
55 | app.manifest
56 |
57 |
58 |
59 | ..\packages\Codeer.Friendly.2.5.2\lib\net40\Codeer.Friendly.dll
60 |
61 |
62 | ..\packages\Codeer.Friendly.2.5.2\lib\net40\Codeer.Friendly.Dynamic.dll
63 |
64 |
65 | ..\packages\Codeer.Friendly.Windows.2.12.0\lib\net20\Codeer.Friendly.Windows.dll
66 |
67 |
68 | ..\packages\McMaster.Extensions.CommandLineUtils.2.3.2\lib\net45\McMaster.Extensions.CommandLineUtils.dll
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 | ..\packages\System.ValueTuple.4.4.0\lib\net47\System.ValueTuple.dll
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 | False
100 | Microsoft .NET Framework 4.6.1 %28x86 および x64%29
101 | true
102 |
103 |
104 | False
105 | .NET Framework 3.5 SP1
106 | false
107 |
108 |
109 |
110 |
111 | {b78d299f-cbb0-486f-a333-4013854480a7}
112 | Aitalk
113 |
114 |
115 |
116 |
--------------------------------------------------------------------------------