增加版本检测
This commit is contained in:
@@ -69,10 +69,7 @@ namespace SpineViewer.Controls
|
|||||||
{
|
{
|
||||||
Program.Logger.Error(ex.ToString());
|
Program.Logger.Error(ex.ToString());
|
||||||
Program.Logger.Error("Failed to load {} {}", dialog.SkelPath, dialog.AtlasPath);
|
Program.Logger.Error("Failed to load {} {}", dialog.SkelPath, dialog.AtlasPath);
|
||||||
if (ex is NotImplementedException)
|
MessageBox.Show(ex.ToString(), "骨骼加载失败", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
MessageBox.Show($"{dialog.Version.String()} 版本尚未实现(咕咕咕~)", "错误信息", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
|
||||||
else
|
|
||||||
MessageBox.Show(ex.ToString(), "骨骼加载失败", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Program.Logger.Info($"Current memory usage: {Program.Process.WorkingSet64 / 1024.0 / 1024.0:F2} MB");
|
Program.Logger.Info($"Current memory usage: {Program.Process.WorkingSet64 / 1024.0 / 1024.0:F2} MB");
|
||||||
|
|||||||
@@ -43,6 +43,8 @@ namespace SpineViewer.Dialogs
|
|||||||
|
|
||||||
private void button_Ok_Click(object sender, EventArgs e)
|
private void button_Ok_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
var version = (Spine.Version)comboBox_Version.SelectedValue;
|
||||||
|
|
||||||
if (listBox_FilePath.Items.Count <= 0)
|
if (listBox_FilePath.Items.Count <= 0)
|
||||||
{
|
{
|
||||||
MessageBox.Show("未选择任何文件", "错误信息", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
MessageBox.Show("未选择任何文件", "错误信息", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||||
@@ -58,8 +60,14 @@ namespace SpineViewer.Dialogs
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!Spine.Spine.ImplementedVersions.Contains(version))
|
||||||
|
{
|
||||||
|
MessageBox.Show($"{version.String()} 版本尚未实现(咕咕咕~)", "错误信息", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
SkelPaths = listBox_FilePath.Items.Cast<string>().ToArray();
|
SkelPaths = listBox_FilePath.Items.Cast<string>().ToArray();
|
||||||
Version = (Spine.Version)comboBox_Version.SelectedValue;
|
Version = version;
|
||||||
|
|
||||||
DialogResult = DialogResult.OK;
|
DialogResult = DialogResult.OK;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ using System.Linq;
|
|||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
|
||||||
namespace SpineViewer.Dialogs
|
namespace SpineViewer.Dialogs
|
||||||
{
|
{
|
||||||
public partial class OpenSpineDialog : Form
|
public partial class OpenSpineDialog : Form
|
||||||
@@ -53,6 +52,7 @@ namespace SpineViewer.Dialogs
|
|||||||
{
|
{
|
||||||
var skelPath = textBox_SkelPath.Text;
|
var skelPath = textBox_SkelPath.Text;
|
||||||
var atlasPath = textBox_AtlasPath.Text;
|
var atlasPath = textBox_AtlasPath.Text;
|
||||||
|
var version = (Spine.Version)comboBox_Version.SelectedValue;
|
||||||
|
|
||||||
if (!File.Exists(skelPath))
|
if (!File.Exists(skelPath))
|
||||||
{
|
{
|
||||||
@@ -78,9 +78,15 @@ namespace SpineViewer.Dialogs
|
|||||||
atlasPath = Path.GetFullPath(atlasPath);
|
atlasPath = Path.GetFullPath(atlasPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!Spine.Spine.ImplementedVersions.Contains(version))
|
||||||
|
{
|
||||||
|
MessageBox.Show($"{version.String()} 版本尚未实现(咕咕咕~)", "错误信息", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
SkelPath = skelPath;
|
SkelPath = skelPath;
|
||||||
AtlasPath = atlasPath;
|
AtlasPath = atlasPath;
|
||||||
Version = (Spine.Version)comboBox_Version.SelectedValue;
|
Version = version;
|
||||||
|
|
||||||
DialogResult = DialogResult.OK;
|
DialogResult = DialogResult.OK;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,6 +40,7 @@ namespace SpineViewer.Spine
|
|||||||
/// 实现类缓存
|
/// 实现类缓存
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private static readonly Dictionary<Version, Type> ImplementationTypes = [];
|
private static readonly Dictionary<Version, Type> ImplementationTypes = [];
|
||||||
|
public static readonly Dictionary<Version, Type>.KeyCollection ImplementedVersions;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 用于解决 PMA 和渐变动画问题的片段着色器
|
/// 用于解决 PMA 和渐变动画问题的片段着色器
|
||||||
@@ -74,6 +75,7 @@ namespace SpineViewer.Spine
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
Program.Logger.Debug("Find Spine implementations: [{}]", string.Join(", ", ImplementationTypes.Keys));
|
Program.Logger.Debug("Find Spine implementations: [{}]", string.Join(", ", ImplementationTypes.Keys));
|
||||||
|
ImplementedVersions = ImplementationTypes.Keys;
|
||||||
|
|
||||||
// 加载 FragmentShader
|
// 加载 FragmentShader
|
||||||
try
|
try
|
||||||
|
|||||||
Reference in New Issue
Block a user