增加自动版本
This commit is contained in:
@@ -22,7 +22,7 @@ namespace SpineViewer.Dialogs
|
|||||||
comboBox_Version.DataSource = VersionHelper.Versions.ToList();
|
comboBox_Version.DataSource = VersionHelper.Versions.ToList();
|
||||||
comboBox_Version.DisplayMember = "Value";
|
comboBox_Version.DisplayMember = "Value";
|
||||||
comboBox_Version.ValueMember = "Key";
|
comboBox_Version.ValueMember = "Key";
|
||||||
comboBox_Version.SelectedValue = Spine.Version.V38;
|
comboBox_Version.SelectedValue = Spine.Version.Auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void BatchOpenSpineDialog_Load(object sender, EventArgs e)
|
private void BatchOpenSpineDialog_Load(object sender, EventArgs e)
|
||||||
@@ -60,7 +60,7 @@ namespace SpineViewer.Dialogs
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Spine.Spine.ImplementedVersions.Contains(version))
|
if (version != Spine.Version.Auto && !Spine.Spine.ImplementedVersions.Contains(version))
|
||||||
{
|
{
|
||||||
MessageBox.Show($"{version.String()} 版本尚未实现(咕咕咕~)", "错误信息", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
MessageBox.Show($"{version.String()} 版本尚未实现(咕咕咕~)", "错误信息", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -22,7 +22,12 @@ namespace SpineViewer.Dialogs
|
|||||||
public ConvertFileFormatDialog()
|
public ConvertFileFormatDialog()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
comboBox_SourceVersion.DataSource = VersionHelper.Versions.ToList();
|
|
||||||
|
// XXX: 文件格式转换暂时不支持自动检测版本
|
||||||
|
var impVersions = VersionHelper.Versions.ToDictionary();
|
||||||
|
impVersions.Remove(Spine.Version.Auto);
|
||||||
|
|
||||||
|
comboBox_SourceVersion.DataSource = impVersions.ToList();
|
||||||
comboBox_SourceVersion.DisplayMember = "Value";
|
comboBox_SourceVersion.DisplayMember = "Value";
|
||||||
comboBox_SourceVersion.ValueMember = "Key";
|
comboBox_SourceVersion.ValueMember = "Key";
|
||||||
comboBox_SourceVersion.SelectedValue = Spine.Version.V38;
|
comboBox_SourceVersion.SelectedValue = Spine.Version.V38;
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ namespace SpineViewer.Dialogs
|
|||||||
comboBox_Version.DataSource = VersionHelper.Versions.ToList();
|
comboBox_Version.DataSource = VersionHelper.Versions.ToList();
|
||||||
comboBox_Version.DisplayMember = "Value";
|
comboBox_Version.DisplayMember = "Value";
|
||||||
comboBox_Version.ValueMember = "Key";
|
comboBox_Version.ValueMember = "Key";
|
||||||
comboBox_Version.SelectedValue = Spine.Version.V38;
|
comboBox_Version.SelectedValue = Spine.Version.Auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OpenSpineDialog_Load(object sender, EventArgs e)
|
private void OpenSpineDialog_Load(object sender, EventArgs e)
|
||||||
@@ -78,7 +78,7 @@ namespace SpineViewer.Dialogs
|
|||||||
atlasPath = Path.GetFullPath(atlasPath);
|
atlasPath = Path.GetFullPath(atlasPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Spine.Spine.ImplementedVersions.Contains(version))
|
if (version != Spine.Version.Auto && !Spine.Spine.ImplementedVersions.Contains(version))
|
||||||
{
|
{
|
||||||
MessageBox.Show($"{version.String()} 版本尚未实现(咕咕咕~)", "错误信息", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
MessageBox.Show($"{version.String()} 版本尚未实现(咕咕咕~)", "错误信息", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
@@ -13,7 +14,8 @@ namespace SpineViewer.Spine
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 描述缓存
|
/// 描述缓存
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static readonly Dictionary<Version, string> Versions = [];
|
public static readonly ReadOnlyDictionary<Version, string> Versions;
|
||||||
|
private static readonly Dictionary<Version, string> versions = [];
|
||||||
|
|
||||||
static VersionHelper()
|
static VersionHelper()
|
||||||
{
|
{
|
||||||
@@ -22,8 +24,9 @@ namespace SpineViewer.Spine
|
|||||||
{
|
{
|
||||||
var field = typeof(Version).GetField(value.ToString());
|
var field = typeof(Version).GetField(value.ToString());
|
||||||
var attribute = field?.GetCustomAttribute<DescriptionAttribute>();
|
var attribute = field?.GetCustomAttribute<DescriptionAttribute>();
|
||||||
Versions[(Version)value] = attribute?.Description ?? value.ToString();
|
versions[(Version)value] = attribute?.Description ?? value.ToString();
|
||||||
}
|
}
|
||||||
|
Versions = versions.AsReadOnly();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
Reference in New Issue
Block a user