Skip to content
This repository has been archived by the owner on Mar 6, 2024. It is now read-only.

Commit

Permalink
バグ修正
Browse files Browse the repository at this point in the history
  • Loading branch information
Takym committed Mar 26, 2020
1 parent 06d506d commit e45e1ec
Show file tree
Hide file tree
Showing 10 changed files with 67 additions and 34 deletions.
3 changes: 3 additions & 0 deletions AupLauncher.sln
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,15 @@ Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
Remote|Any CPU = Remote|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{C174EF44-FEDC-42CE-92F7-41D969651530}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C174EF44-FEDC-42CE-92F7-41D969651530}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C174EF44-FEDC-42CE-92F7-41D969651530}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C174EF44-FEDC-42CE-92F7-41D969651530}.Release|Any CPU.Build.0 = Release|Any CPU
{C174EF44-FEDC-42CE-92F7-41D969651530}.Remote|Any CPU.ActiveCfg = Remote|Any CPU
{C174EF44-FEDC-42CE-92F7-41D969651530}.Remote|Any CPU.Build.0 = Remote|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
15 changes: 14 additions & 1 deletion AupLauncher/AupLauncher.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,21 @@
<PropertyGroup>
<ApplicationIcon>Properties\AupFile.ico</ApplicationIcon>
</PropertyGroup>
<PropertyGroup />
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Remote|AnyCPU'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>\\REMOTEDEBUGGER\AupLauncher\</OutputPath>
<DefineConstants>TRACE;DEBUG;REMOTE</DefineConstants>
<CheckForOverflowUnderflow>true</CheckForOverflowUnderflow>
<DebugType>full</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
<LangVersion>7.3</LangVersion>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup>
<ApplicationManifest>Properties\App.manifest</ApplicationManifest>
<NoWin32Manifest>true</NoWin32Manifest>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
Expand Down
37 changes: 22 additions & 15 deletions AupLauncher/FormMain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ private void FormMain_Load(object sender, EventArgs e)
if (!Program.Settings.IsInstalled) {
Program.Settings.Install();
}
cbox_invfile.Items.Add(ExecutionKind.InvalidValue .Localized());
cbox_invfile.Items.Add(ExecutionKind.ShowError .Localized());
cbox_invfile.Items.Add(ExecutionKind.Nothing .Localized());
cbox_invfile.Items.Add(ExecutionKind.AviUtl .Localized());
Expand All @@ -29,7 +30,7 @@ private void btn_avi_path_Click(object sender, EventArgs e)
{
ofd.Reset();
ofd.ReadOnlyChecked = true;
ofd.Filter = Resources.UI_avi_path_filter;
ofd.Filter = Resources.UI_avi_path_filter + "|aviutl.exe";
if (ofd.ShowDialog() == DialogResult.OK) {
tbox_avi_path.Text = ofd.FileName;
}
Expand All @@ -42,7 +43,7 @@ private void btn_aud_path_Click(object sender, EventArgs e)
{
ofd.Reset();
ofd.ReadOnlyChecked = true;
ofd.Filter = Resources.UI_aud_path_filter;
ofd.Filter = Resources.UI_aud_path_filter + "|audacity.exe";
if (ofd.ShowDialog() == DialogResult.OK) {
tbox_aud_path.Text = ofd.FileName;
}
Expand All @@ -55,7 +56,7 @@ private void btn_cus_path_Click(object sender, EventArgs e)
{
ofd.Reset();
ofd.ReadOnlyChecked = true;
ofd.Filter = Resources.UI_cus_path_filter;
ofd.Filter = Resources.UI_cus_path_filter + "|*.exe;*.com;*.bat;*.cmd";
if (ofd.ShowDialog() == DialogResult.OK) {
tbox_cus_path.Text = ofd.FileName;
}
Expand All @@ -81,6 +82,7 @@ private void cbox_invfile_SelectedIndexChanged(object sender, EventArgs e)
private void btnReset_Click(object sender, EventArgs e)
{
Program.Settings.Default.Reset();
this.RefreshControls();

btnReload.Enabled = true;
btnSave .Enabled = true;
Expand All @@ -89,18 +91,7 @@ private void btnReset_Click(object sender, EventArgs e)
private void btnReload_Click(object sender, EventArgs e)
{
Program.Settings.LoadFromRegistry();
tbox_avi_path.Text = Program.Settings.Default.AviUtlPath;
tbox_avi_args.Text = Program.Settings.Default.AviUtlArgs;
tbox_aud_path.Text = Program.Settings.Default.AudacityPath;
tbox_aud_args.Text = Program.Settings.Default.AudacityArgs;
tbox_cus_path.Text = Program.Settings.Default.CustomProgramPath;
tbox_cus_args.Text = Program.Settings.Default.CustomProgramArgs;
cbox_invfile.SelectedItem = Program.Settings.Default.HandleForInvalidFile.Localized();

this.SetCustomProgramEnabled();

btnReload.Enabled = false;
btnSave .Enabled = false;
this.RefreshControls();
}

private void btnSave_Click(object sender, EventArgs e)
Expand Down Expand Up @@ -131,6 +122,22 @@ private void btnUninstall_Click(object sender, EventArgs e)
}
}

private void RefreshControls()
{
tbox_avi_path.Text = Program.Settings.Default.AviUtlPath;
tbox_avi_args.Text = Program.Settings.Default.AviUtlArgs;
tbox_aud_path.Text = Program.Settings.Default.AudacityPath;
tbox_aud_args.Text = Program.Settings.Default.AudacityArgs;
tbox_cus_path.Text = Program.Settings.Default.CustomProgramPath;
tbox_cus_args.Text = Program.Settings.Default.CustomProgramArgs;
cbox_invfile.SelectedItem = Program.Settings.Default.HandleForInvalidFile.Localized();

this.SetCustomProgramEnabled();

btnReload.Enabled = false;
btnSave.Enabled = false;
}

private void SetCustomProgramEnabled()
{
if (((LocalizedExecutionKind)(cbox_invfile.SelectedItem)).Value == ExecutionKind.RunCustomProgram) {
Expand Down
13 changes: 9 additions & 4 deletions AupLauncher/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ public static class Program
public const string Description = "Launcher for AviUtl & Audacity Project Files";
public const string Author = "Takym";
public const string Copyright = "Copyright (C) 2020 Takym.";
public const string Version = "0.0.0.0";
public const string CodeName = "aupl00a0";
public const string Version = "0.0.0.1";
public const string CodeName = "aupl00a1";

public static Settings Settings { get; private set; }

Expand Down Expand Up @@ -65,6 +65,10 @@ public static (ExecutionKind, string) DetermineFileKind(string fname)
using (var fs = new FileStream(fname, FileMode.Open, FileAccess.Read, FileShare.Read))
using (var br = new BinaryReader(fs, Encoding.UTF8))
using (var sr = new StreamReader(fs, Encoding.UTF8)) {
if (fs.Length == 0) {
return (Settings.Default.HandleForInvalidFile, fname);
}

byte[] sig = br.ReadBytes(_aviutl_signature.Length);
if (sig.Length == _aviutl_signature.Length) {
for (int i = 0; i < _aviutl_signature.Length; ++i) {
Expand All @@ -75,6 +79,7 @@ public static (ExecutionKind, string) DetermineFileKind(string fname)
return (ExecutionKind.AviUtl, fname);
}
audacity:
fs.Seek(0, SeekOrigin.Begin);
string sig2 = sr.ReadLine().TrimStart();
if (sig2.StartsWith("<?xml")) {
return (ExecutionKind.Audacity, fname);
Expand Down Expand Up @@ -127,8 +132,8 @@ public static int StartupProgram((ExecutionKind kind, string fname) arg)

public static string CreateArgs(string format, string args)
{
string bat = Path.GetTempFileName();
File.WriteAllText(bat, $"@echo off\r\necho {format}", Encoding.UTF8);
string bat = Path.ChangeExtension(Path.GetTempFileName(), "bat");
File.WriteAllText(bat, $"@echo off\r\necho {format}", new UTF8Encoding(false));
var psi = new ProcessStartInfo();
psi.CreateNoWindow = true;
psi.UseShellExecute = false;
Expand Down
6 changes: 4 additions & 2 deletions AupLauncher/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,10 @@
[assembly: ComVisible(false)]
[assembly: Guid("c174ef44-fedc-42ce-92f7-41d969651530")]

#if DEBUG
#if REMOTE
[assembly: AssemblyConfiguration("Any CPU (32-bit preferred); Remote")]
#elif DEBUG
[assembly: AssemblyConfiguration("Any CPU (32-bit preferred); Debug")]
#else
[assembly: AssemblyConfiguration("Any CPU (64-bit preferred); Debug")]
[assembly: AssemblyConfiguration("Any CPU (64-bit preferred); Release")]
#endif
2 changes: 1 addition & 1 deletion AupLauncher/Properties/Resources.en.resx
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@
<value>Run AviUtl</value>
</data>
<data name="EK_InvalidValue" xml:space="preserve">
<value>This is an invalid value</value>
<value>This is an invalid value. (Do not use!)</value>
</data>
<data name="EK_Nothing" xml:space="preserve">
<value>Do nothing</value>
Expand Down
2 changes: 1 addition & 1 deletion AupLauncher/Properties/Resources.ja.resx
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@
<value>AviUtl を起動する</value>
</data>
<data name="EK_InvalidValue" xml:space="preserve">
<value>無効な値です</value>
<value>無効な値です(利用しないでください)</value>
</data>
<data name="EK_Nothing" xml:space="preserve">
<value>何もしない</value>
Expand Down
4 changes: 2 additions & 2 deletions AupLauncher/SettingProfile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@ public virtual void Reset()
this.DisplayName = Resources.NewProfileDisplayName;
this.AviUtlPath = "C:\\AviUtl\\aviutl.exe";
this.AviUtlArgs = "%1";
this.AudacityPath = "‪%ProgramFiles(x86)%\\Audacity\\audacity.exe";
this.AudacityPath = "C:\\Program Files (x86)\\Audacity\\audacity.exe";
this.AudacityArgs = "%1";
this.CustomProgramPath = "%SystemRoot%\\notepad.exe";
this.CustomProgramPath = "C:\\Windows\\notepad.exe";
this.CustomProgramArgs = "%1";
this.HandleForInvalidFile = ExecutionKind.ShowError;
}
Expand Down
4 changes: 2 additions & 2 deletions AupLauncher/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public void LoadFromRegistry()
if (this.IsDisposed) {
throw new ObjectDisposedException(nameof(Settings));
}
var sver = Version.Parse(_reg.GetValue("SavedVersion", "255.255.255.255").ToString());
var sver = Version.Parse(_reg.GetValue("SavedVersion", Program.Version).ToString());
if (sver <= Program.GetVersion()) {
_defkey = _reg.GetValue("DefaultProfile", "_default").ToString();
string[] profiles = _reg.GetSubKeyNames();
Expand Down Expand Up @@ -164,7 +164,7 @@ public void Install()
using (var verb = shell.CreateSubKey("shell\\open")) {
verb.SetValue("", Resources.ShellMenu_Open);
using (var cmd = verb.CreateSubKey("command")) {
cmd.SetValue("", Application.ExecutablePath);
cmd.SetValue("", $"\"{Application.ExecutablePath}\" \"%1\"");
}
}
this.CopyRegistry(shell, shellcls, true);
Expand Down
15 changes: 9 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,14 @@ AviUtl

## 使い方
* 上記の指示に従って正しくインストールした場合、「.aup」ファイルを開くと自動的に AviUtl または Audacity が起動します。
* また、ファイル名の先頭に「aupfile:」と付けてブラウザ・エクスプローラ等のアドレスバーに入力する事でも起動できます。
* AupLauncher.exe に何も引数を与えずに起動した場合、設定画面が開かれます。

## バージョン履歴
|バージョン|開発コード名|更新日 |内容 |
|:--------:|:----------:|:---------|:-------------------|
|v0.0.0.0 |aupl00a0 |2020/03/24|最初のリリースです。|
|バージョン|開発コード名|更新日 |内容 |
|:--------:|:----------:|:---------|:-----------------------------------------------------------------------|
|v0.0.0.1 |aupl00a1 |2020/03/26|前回のリリースの不具合を大幅に修正しました。27日の真夜中に完成しました。|
|v0.0.0.0 |aupl00a0 |2020/03/24|最初のリリースです。 |

<a id="en"></a>
## Summary
Expand Down Expand Up @@ -73,6 +75,7 @@ Please refer [LICENSE.txt](LICENSE.txt) for more information.
* When you executed AupLauncher.exe without any arguments, the launcher will open the settings window.

## Change Log
|Version |Code Name |Update |Changes |
|:--------:|:----------:|:---------|:-----------------|
|v0.0.0.0 |aupl00a0 |2020/03/24|The first release.|
|Version |Code Name |Update |Changes |
|:--------:|:----------:|:---------|:----------------------------------------------------|
|v0.0.0.1 |aupl00a1 |2020/03/26|Fixed many bugs. This release is made midnight of 27.|
|v0.0.0.0 |aupl00a0 |2020/03/24|The first release. |

0 comments on commit e45e1ec

Please sign in to comment.