Skip to content

Commit

Permalink
・Injector呼び出し時のパスの取り扱いミスを修正
Browse files Browse the repository at this point in the history
・VoiceroidDaemonのビルド時にInjectorをコピーするよう修正
  • Loading branch information
Nkyoku committed Jan 27, 2020
1 parent bfe447e commit ff1c8ad
Show file tree
Hide file tree
Showing 5 changed files with 93 additions and 7 deletions.
9 changes: 8 additions & 1 deletion Injecter/Injecter.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,17 @@
<ManifestKeyFile>Injecter_TemporaryKey.pfx</ManifestKeyFile>
</PropertyGroup>
<PropertyGroup>
<GenerateManifests>true</GenerateManifests>
<GenerateManifests>false</GenerateManifests>
</PropertyGroup>
<PropertyGroup>
<SignManifests>true</SignManifests>
</PropertyGroup>
<PropertyGroup>
<TargetZone>LocalIntranet</TargetZone>
</PropertyGroup>
<PropertyGroup>
<ApplicationManifest>Properties\app.manifest</ApplicationManifest>
</PropertyGroup>
<ItemGroup>
<Reference Include="Codeer.Friendly, Version=2.5.2.0, Culture=neutral, PublicKeyToken=6c44da6fca38aa86, processorArchitecture=MSIL">
<HintPath>..\packages\Codeer.Friendly.2.5.2\lib\net40\Codeer.Friendly.dll</HintPath>
Expand Down Expand Up @@ -87,6 +93,7 @@
<ItemGroup>
<None Include="App.config" />
<None Include="packages.config" />
<None Include="Properties\app.manifest" />
</ItemGroup>
<ItemGroup>
<BootstrapperPackage Include=".NETFramework,Version=v4.6.1">
Expand Down
70 changes: 70 additions & 0 deletions Injecter/Properties/app.manifest
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
<?xml version="1.0" encoding="utf-8"?>
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
<assemblyIdentity version="1.0.0.0" name="MyApplication.app" />
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
<security>
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
<!-- UAC マニフェスト オプション
Windows のユーザー アカウント制御のレベルを変更するには、
requestedExecutionLevel ノードを以下のいずれかで置換します。
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
<requestedExecutionLevel level="highestAvailable" uiAccess="false" />
requestedExecutionLevel 要素を指定すると、ファイルおよびレジストリの仮想化が無効にされます。
アプリケーションが下位互換性を保つためにこの仮想化を要求する場合、この要素を
削除します。
-->
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
</requestedPrivileges>
<applicationRequestMinimum>
<PermissionSet class="System.Security.PermissionSet" version="1" Unrestricted="true" ID="Custom" SameSite="site" />
<defaultAssemblyRequest permissionSetReference="Custom" />
</applicationRequestMinimum>
</security>
</trustInfo>
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application>
<!-- このアプリケーションがテストされ、動作するよう設計された Windows バージョンの
一覧。適切な要素をコメント解除すると、最も互換性のある環境を Windows が
自動的に選択します。-->
<!-- Windows Vista -->
<!--<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}" />-->
<!-- Windows 7 -->
<!--<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}" />-->
<!-- Windows 8 -->
<!--<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}" />-->
<!-- Windows 8.1 -->
<!--<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}" />-->
<!-- Windows 10 -->
<!--<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />-->
</application>
</compatibility>
<!-- アプリケーションが DPI 対応であり、それ以上の DPI で Windows によって自動的にスケーリングされないことを
示します。Windows Presentation Foundation (WPF) アプリケーションは自動的に DPI に対応し、オプトインする必要は
ありません。さらに、この設定にオプトインする .NET Framework 4.6 を対象とする Windows Forms アプリケーションは、
app.config ファイルで 'EnableWindowsFormsHighDpiAutoResizing' 設定を 'true' に設定する必要があります。-->
<!--
<application xmlns="urn:schemas-microsoft-com:asm.v3">
<windowsSettings>
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true</dpiAware>
</windowsSettings>
</application>
-->
<!-- Windows のコモン コントロールとダイアログのテーマを有効にします (Windows XP 以降) -->
<!--
<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.0.0"
processorArchitecture="*"
publicKeyToken="6595b64144ccf1df"
language="*"
/>
</dependentAssembly>
</dependency>
-->
</assembly>
12 changes: 8 additions & 4 deletions VoiceroidDaemon/Controllers/GetKeyApiController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using VoiceroidDaemon.Models;
using System.IO;
using System.Reflection;

namespace VoiceroidDaemon.Controllers
{
Expand All @@ -21,21 +23,23 @@ public class GetKeyApiController : ControllerBase
/// </summary>
/// <returns></returns>
[HttpGet("{exe}")]
public string ConvertTextFromRequest(string exe)
public string GetKey(string exe)
{
try
{
ProcessStartInfo start_info = new ProcessStartInfo();
start_info.FileName = "Injecter/Injecter.exe";
start_info.Arguments = exe ?? Setting.System.VoiceroidEditorExe;
start_info.FileName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "\\Injecter.exe";
start_info.Arguments = "\"" + Setting.System.InstallPath + "\\" + (exe ?? Setting.System.VoiceroidEditorExe) + "\"";
start_info.CreateNoWindow = true;
start_info.RedirectStandardOutput = true;
using (Process process = Process.Start(start_info))
{
process.WaitForExit(10000);
if (process.HasExited == true)
{
return process.StandardOutput.ReadToEnd();
string result = process.StandardOutput.ReadToEnd();
process.WaitForExit();
return result;
}
else
{
Expand Down
2 changes: 1 addition & 1 deletion VoiceroidDaemon/Controllers/HomeController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public IActionResult SystemSetting(SystemSettingModel system_setting)
}
else
{
ViewData["Alert"] = "設定は保存され、設定の有効性が確認されました。";
ViewData["Alert"] = "設定は保存され、設定の有効性が確認されました。\\n一部の設定は再起動するまで反映されません。";
}
}
return SystemSetting();
Expand Down
7 changes: 6 additions & 1 deletion VoiceroidDaemon/VoiceroidDaemon.csproj
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>netcoreapp2.1</TargetFramework>
<Platforms>AnyCPU</Platforms>
<Version>2.0.1</Version>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
Expand Down Expand Up @@ -53,4 +54,8 @@
<ProjectReference Include="..\Aitalk\Aitalk.csproj" />
</ItemGroup>

<Target Name="PostBuild" AfterTargets="PostBuildEvent">
<Exec Command="xcopy /I /D /Y &quot;$(SolutionDir)Injecter\bin\$(ConfigurationName)&quot; &quot;$(TargetDir)&quot;" />
</Target>

</Project>

0 comments on commit ff1c8ad

Please sign in to comment.