Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# CHANGELOG

## v0.16.23

- 增加 json 文件后缀关联

## v0.16.22

- 修复导出 Psd 格式时的 null 引用错误
Expand Down
29 changes: 22 additions & 7 deletions SpineViewer/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -277,14 +277,22 @@ public bool AssociateFileSuffix
{
try
{
// 检查 .skel 的 ProgID
// 检查 .skel 的 ProgID 关联
using (var key = Registry.CurrentUser.OpenSubKey(@"Software\Classes\.skel"))
{
var progIdValue = key?.GetValue("") as string;
if (!string.Equals(progIdValue, App.ProgId, StringComparison.OrdinalIgnoreCase))
return false;
}

// 检查 .json 的 ProgID 关联
using (var key = Registry.CurrentUser.OpenSubKey(@"Software\Classes\.json"))
{
var progIdValue = key?.GetValue("") as string;
if (!string.Equals(progIdValue, App.ProgId, StringComparison.OrdinalIgnoreCase))
return false;
}

// 检查 command 指令是否相同
using (var key = Registry.CurrentUser.OpenSubKey($@"Software\Classes\{App.ProgId}\shell\open\command"))
{
Expand All @@ -303,12 +311,6 @@ public bool AssociateFileSuffix
{
if (value)
{
// 文件关联
using (var key = Registry.CurrentUser.CreateSubKey(@"Software\Classes\.skel"))
{
key?.SetValue("", App.ProgId);
}

using (var key = Registry.CurrentUser.CreateSubKey($@"Software\Classes\{App.ProgId}"))
{
key?.SetValue("", SkelFileDescription);
Expand All @@ -321,11 +323,24 @@ public bool AssociateFileSuffix
shellKey?.SetValue("", ShellOpenCommand);
}
}

// .skel 文件关联
using (var key = Registry.CurrentUser.CreateSubKey(@"Software\Classes\.skel"))
{
key?.SetValue("", App.ProgId);
}

// .json 文件关联
using (var key = Registry.CurrentUser.CreateSubKey(@"Software\Classes\.json"))
{
key?.SetValue("", App.ProgId);
}
}
else
{
// 删除关联
Registry.CurrentUser.DeleteSubKeyTree(@"Software\Classes\.skel", false);
Registry.CurrentUser.DeleteSubKeyTree(@"Software\Classes\.json", false);
Registry.CurrentUser.DeleteSubKeyTree($@"Software\Classes\{App.ProgId}", false);
}

Expand Down
2 changes: 1 addition & 1 deletion SpineViewer/SpineViewer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<BaseOutputPath>$(SolutionDir)out</BaseOutputPath>
<OutputPath>$(BaseOutputPath)\$(Configuration)\$(PlatformTarget)</OutputPath>
<IncludeSourceRevisionInInformationalVersion>false</IncludeSourceRevisionInInformationalVersion>
<Version>0.16.22</Version>
<Version>0.16.23</Version>
<OutputType>WinExe</OutputType>
<UseWPF>true</UseWPF>
</PropertyGroup>
Expand Down
2 changes: 1 addition & 1 deletion SpineViewerCLI/SpineViewerCLI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<BaseOutputPath>$(SolutionDir)out</BaseOutputPath>
<OutputPath>$(BaseOutputPath)\$(Configuration)\$(PlatformTarget)</OutputPath>
<IncludeSourceRevisionInInformationalVersion>false</IncludeSourceRevisionInInformationalVersion>
<Version>0.16.22</Version>
<Version>0.16.23</Version>
<OutputType>Exe</OutputType>
</PropertyGroup>

Expand Down
Loading