调整结构

This commit is contained in:
ww-rm
2025-04-09 01:07:17 +08:00
parent 3104733db0
commit dbe586cff8
34 changed files with 100 additions and 83 deletions

View File

@@ -15,6 +15,7 @@ using System.Collections.Specialized;
using NLog; using NLog;
using SpineViewer.Extensions; using SpineViewer.Extensions;
using SpineViewer.PropertyGridWrappers.Spine; using SpineViewer.PropertyGridWrappers.Spine;
using SpineViewer.Utilities;
namespace SpineViewer.Controls namespace SpineViewer.Controls
{ {
@@ -100,7 +101,7 @@ namespace SpineViewer.Controls
{ {
logger.Error(ex.ToString()); logger.Error(ex.ToString());
logger.Error("Failed to load {} {}", result.SkelPath, result.AtlasPath); logger.Error("Failed to load {} {}", result.SkelPath, result.AtlasPath);
MessageBox.Error(ex.ToString(), "骨骼加载失败"); MessagePopup.Error(ex.ToString(), "骨骼加载失败");
} }
logger.LogCurrentProcessMemoryUsage(); logger.LogCurrentProcessMemoryUsage();
@@ -221,7 +222,7 @@ namespace SpineViewer.Controls
{ {
if (validPaths.Count > 100) if (validPaths.Count > 100)
{ {
if (MessageBox.Quest($"共发现 {validPaths.Count} 个可加载骨骼,数量较多,是否一次性全部加载?") == DialogResult.Cancel) if (MessagePopup.Quest($"共发现 {validPaths.Count} 个可加载骨骼,数量较多,是否一次性全部加载?") == DialogResult.Cancel)
return; return;
} }
BatchAdd(new Dialogs.BatchOpenSpineDialogResult(SpineVersion.Auto, validPaths.ToArray())); BatchAdd(new Dialogs.BatchOpenSpineDialogResult(SpineVersion.Auto, validPaths.ToArray()));
@@ -410,7 +411,7 @@ namespace SpineViewer.Controls
if (listView.SelectedIndices.Count > 1) if (listView.SelectedIndices.Count > 1)
{ {
if (MessageBox.Quest($"确定移除所选 {listView.SelectedIndices.Count} 项吗?") != DialogResult.OK) if (MessagePopup.Quest($"确定移除所选 {listView.SelectedIndices.Count} 项吗?") != DialogResult.OK)
return; return;
} }
@@ -510,7 +511,7 @@ namespace SpineViewer.Controls
if (listView.Items.Count <= 0) if (listView.Items.Count <= 0)
return; return;
if (MessageBox.Quest($"确认移除所有 {listView.Items.Count} 项吗?") != DialogResult.OK) if (MessagePopup.Quest($"确认移除所有 {listView.Items.Count} 项吗?") != DialogResult.OK)
return; return;
listView.Items.Clear(); listView.Items.Clear();

View File

@@ -10,6 +10,7 @@ using System.Windows.Forms;
using System.Security.Policy; using System.Security.Policy;
using System.Diagnostics; using System.Diagnostics;
using NLog; using NLog;
using SpineViewer.Utilities;
namespace SpineViewer.Controls namespace SpineViewer.Controls
{ {
@@ -402,7 +403,7 @@ namespace SpineViewer.Controls
{ {
logger.Fatal(ex); logger.Fatal(ex);
logger.Fatal("Render task stopped"); logger.Fatal("Render task stopped");
MessageBox.Error(ex.ToString(), "预览画面已停止渲染"); MessagePopup.Error(ex.ToString(), "预览画面已停止渲染");
} }
finally finally
{ {

View File

@@ -8,6 +8,7 @@ using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows.Forms; using System.Windows.Forms;
using SpineViewer.PropertyGridWrappers.Spine; using SpineViewer.PropertyGridWrappers.Spine;
using SpineViewer.Utilities;
namespace SpineViewer.Controls namespace SpineViewer.Controls
{ {
@@ -86,7 +87,7 @@ namespace SpineViewer.Controls
if (spine.SkinNames.Count <= 0) if (spine.SkinNames.Count <= 0)
{ {
MessageBox.Info("没有可用的皮肤"); MessagePopup.Info("没有可用的皮肤");
return; return;
} }

View File

@@ -1,4 +1,5 @@
using System; using SpineViewer.Utilities;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
using System.Diagnostics; using System.Diagnostics;
@@ -40,7 +41,7 @@ namespace SpineViewer.Dialogs
else else
{ {
Clipboard.SetText(url); Clipboard.SetText(url);
MessageBox.Info("链接已复制到剪贴板,请前往浏览器进行访问"); MessagePopup.Info("链接已复制到剪贴板,请前往浏览器进行访问");
} }
} }
} }

View File

@@ -1,4 +1,5 @@
using SpineViewer.Spine; using SpineViewer.Spine;
using SpineViewer.Utilities;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
@@ -35,7 +36,7 @@ namespace SpineViewer.Dialogs
if (items.Count <= 0) if (items.Count <= 0)
{ {
MessageBox.Info("未选择任何文件"); MessagePopup.Info("未选择任何文件");
return; return;
} }
@@ -43,14 +44,14 @@ namespace SpineViewer.Dialogs
{ {
if (!File.Exists(p)) if (!File.Exists(p))
{ {
MessageBox.Info($"{p}", "skel文件不存在"); MessagePopup.Info($"{p}", "skel文件不存在");
return; return;
} }
} }
if (version != SpineVersion.Auto && !Spine.Spine.HasImplementation(version)) if (version != SpineVersion.Auto && !Spine.Spine.HasImplementation(version))
{ {
MessageBox.Info($"{version.GetName()} 版本尚未实现(咕咕咕~"); MessagePopup.Info($"{version.GetName()} 版本尚未实现(咕咕咕~");
return; return;
} }

View File

@@ -1,4 +1,5 @@
using SpineViewer.Spine; using SpineViewer.Spine;
using SpineViewer.Utilities;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
@@ -46,7 +47,7 @@ namespace SpineViewer.Dialogs
if (items.Count <= 0) if (items.Count <= 0)
{ {
MessageBox.Info("未选择任何文件"); MessagePopup.Info("未选择任何文件");
return; return;
} }
@@ -54,20 +55,20 @@ namespace SpineViewer.Dialogs
{ {
if (!File.Exists(p)) if (!File.Exists(p))
{ {
MessageBox.Info($"{p}", "skel文件不存在"); MessagePopup.Info($"{p}", "skel文件不存在");
return; return;
} }
} }
if (sourceVersion != SpineVersion.Auto && !SkeletonConverter.HasImplementation(sourceVersion)) if (sourceVersion != SpineVersion.Auto && !SkeletonConverter.HasImplementation(sourceVersion))
{ {
MessageBox.Info($"{sourceVersion.GetName()} 版本尚未实现(咕咕咕~"); MessagePopup.Info($"{sourceVersion.GetName()} 版本尚未实现(咕咕咕~");
return; return;
} }
if (!SkeletonConverter.HasImplementation(targetVersion)) if (!SkeletonConverter.HasImplementation(targetVersion))
{ {
MessageBox.Info($"{targetVersion.GetName()} 版本尚未实现(咕咕咕~"); MessagePopup.Info($"{targetVersion.GetName()} 版本尚未实现(咕咕咕~");
return; return;
} }

View File

@@ -1,4 +1,5 @@
using Microsoft.Win32; using Microsoft.Win32;
using SpineViewer.Utilities;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
@@ -92,7 +93,7 @@ namespace SpineViewer.Dialogs
var properties = selectedObject.GetType().GetProperties(); var properties = selectedObject.GetType().GetProperties();
var result = string.Join(Environment.NewLine, properties.Select(p => $"{p.Name}\t{p.GetValue(selectedObject)?.ToString()}")); var result = string.Join(Environment.NewLine, properties.Select(p => $"{p.Name}\t{p.GetValue(selectedObject)?.ToString()}"));
Clipboard.SetText(result); Clipboard.SetText(result);
MessageBox.Info("已复制"); MessagePopup.Info("已复制");
} }
} }
} }

View File

@@ -1,4 +1,5 @@
using SpineViewer.PropertyGridWrappers.Exporter; using SpineViewer.PropertyGridWrappers.Exporter;
using SpineViewer.Utilities;
using System; using System;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
@@ -64,7 +65,7 @@ namespace SpineViewer.Dialogs
{ {
if (wrapper.Exporter.Validate() is string error) if (wrapper.Exporter.Validate() is string error)
{ {
MessageBox.Info(error, "参数错误"); MessagePopup.Info(error, "参数错误");
return; return;
} }
DialogResult = DialogResult.OK; DialogResult = DialogResult.OK;

View File

@@ -1,4 +1,5 @@
using SpineViewer.Spine; using SpineViewer.Spine;
using SpineViewer.Utilities;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
@@ -57,7 +58,7 @@ namespace SpineViewer.Dialogs
if (!File.Exists(skelPath)) if (!File.Exists(skelPath))
{ {
MessageBox.Info($"{skelPath}", "skel文件不存在"); MessagePopup.Info($"{skelPath}", "skel文件不存在");
return; return;
} }
else else
@@ -71,7 +72,7 @@ namespace SpineViewer.Dialogs
} }
else if (!File.Exists(atlasPath)) else if (!File.Exists(atlasPath))
{ {
MessageBox.Info($"{atlasPath}", "atlas文件不存在"); MessagePopup.Info($"{atlasPath}", "atlas文件不存在");
return; return;
} }
else else
@@ -81,7 +82,7 @@ namespace SpineViewer.Dialogs
if (version != SpineVersion.Auto && !Spine.Spine.HasImplementation(version)) if (version != SpineVersion.Auto && !Spine.Spine.HasImplementation(version))
{ {
MessageBox.Info($"{version.GetName()} 版本尚未实现(咕咕咕~"); MessagePopup.Info($"{version.GetName()} 版本尚未实现(咕咕咕~");
return; return;
} }

View File

@@ -1,4 +1,5 @@
using NLog; using NLog;
using SpineViewer.Utilities;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
@@ -51,7 +52,7 @@ namespace SpineViewer.Dialogs
if (e.Error != null) if (e.Error != null)
{ {
logger.Error(e.Error.ToString()); logger.Error(e.Error.ToString());
MessageBox.Error(e.Error.ToString(), "执行出错"); MessagePopup.Error(e.Error.ToString(), "执行出错");
DialogResult = DialogResult.Abort; DialogResult = DialogResult.Abort;
} }
else if (e.Cancelled) else if (e.Cancelled)

View File

@@ -1,6 +1,7 @@
using NLog; using NLog;
using SpineViewer.Extensions; using SpineViewer.Extensions;
using SpineViewer.PropertyGridWrappers; using SpineViewer.PropertyGridWrappers;
using SpineViewer.Utilities;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;

View File

@@ -1,4 +1,5 @@
using System; using SpineViewer.Natives;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
using System.Data; using System.Data;

View File

@@ -1,6 +1,6 @@
namespace SpineViewer namespace SpineViewer
{ {
partial class MainForm partial class SpineViewerForm
{ {
/// <summary> /// <summary>
/// Required designer variable. /// Required designer variable.
@@ -29,7 +29,7 @@
private void InitializeComponent() private void InitializeComponent()
{ {
components = new System.ComponentModel.Container(); components = new System.ComponentModel.Container();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainForm)); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(SpineViewerForm));
menuStrip = new MenuStrip(); menuStrip = new MenuStrip();
toolStripMenuItem_File = new ToolStripMenuItem(); toolStripMenuItem_File = new ToolStripMenuItem();
toolStripMenuItem_Open = new ToolStripMenuItem(); toolStripMenuItem_Open = new ToolStripMenuItem();

View File

@@ -3,17 +3,18 @@ using SpineViewer.Spine;
using System.ComponentModel; using System.ComponentModel;
using System.Diagnostics; using System.Diagnostics;
using SpineViewer.Exporter; using SpineViewer.Exporter;
using SpineViewer.Extensions;
using System.Reflection.Metadata; using System.Reflection.Metadata;
using SpineViewer.PropertyGridWrappers.Exporter; using SpineViewer.PropertyGridWrappers.Exporter;
using SpineViewer.Utilities;
using SpineViewer.Natives;
namespace SpineViewer namespace SpineViewer
{ {
internal partial class MainForm : Form internal partial class SpineViewerForm : Form
{ {
private Logger logger = LogManager.GetCurrentClassLogger(); private Logger logger = LogManager.GetCurrentClassLogger();
public MainForm() public SpineViewerForm()
{ {
InitializeComponent(); InitializeComponent();
InitializeLogConfiguration(); InitializeLogConfiguration();
@@ -27,7 +28,7 @@ namespace SpineViewer
{ {
logger.Error(ex.ToString()); logger.Error(ex.ToString());
logger.Error("Failed to load fragment shader"); logger.Error("Failed to load fragment shader");
MessageBox.Warn("Fragment shader 加载失败预乘Alpha通道属性失效"); MessagePopup.Warn("Fragment shader 加载失败预乘Alpha通道属性失效");
} }
} }
@@ -84,7 +85,7 @@ namespace SpineViewer
private void toolStripMenuItem_ExportFrame_Click(object sender, EventArgs e) private void toolStripMenuItem_ExportFrame_Click(object sender, EventArgs e)
{ {
if (spinePreviewer.IsUpdating && MessageBox.Quest("画面仍在更新,建议手动暂停画面后导出固定的一帧,是否继续?") != DialogResult.OK) if (spinePreviewer.IsUpdating && MessagePopup.Quest("画面仍在更新,建议手动暂停画面后导出固定的一帧,是否继续?") != DialogResult.OK)
return; return;
var exporter = new FrameExporter() var exporter = new FrameExporter()

View File

@@ -2,7 +2,7 @@
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using System.Windows.Forms; using System.Windows.Forms;
namespace SpineViewer namespace SpineViewer.Natives
{ {
internal enum TBPFLAG internal enum TBPFLAG
{ {
@@ -19,15 +19,15 @@ namespace SpineViewer
{ {
// ITaskbarList // ITaskbarList
void HrInit(); void HrInit();
void AddTab(IntPtr hwnd); void AddTab(nint hwnd);
void DeleteTab(IntPtr hwnd); void DeleteTab(nint hwnd);
void ActivateTab(IntPtr hwnd); void ActivateTab(nint hwnd);
void SetActiveAlt(IntPtr hwnd); void SetActiveAlt(nint hwnd);
// ITaskbarList2 // ITaskbarList2
void MarkFullscreenWindow(IntPtr hwnd, [MarshalAs(UnmanagedType.Bool)] bool fFullscreen); void MarkFullscreenWindow(nint hwnd, [MarshalAs(UnmanagedType.Bool)] bool fFullscreen);
// ITaskbarList3 // ITaskbarList3
void SetProgressValue(IntPtr hwnd, ulong ullCompleted, ulong ullTotal); void SetProgressValue(nint hwnd, ulong ullCompleted, ulong ullTotal);
void SetProgressState(IntPtr hwnd, TBPFLAG tbpFlags); void SetProgressState(nint hwnd, TBPFLAG tbpFlags);
//void RegisterTab(IntPtr hwndTab, IntPtr hwndMDI); //void RegisterTab(IntPtr hwndTab, IntPtr hwndMDI);
//void UnregisterTab(IntPtr hwndTab); //void UnregisterTab(IntPtr hwndTab);
//void SetTabOrder(IntPtr hwndTab, IntPtr hwndInsertBefore); //void SetTabOrder(IntPtr hwndTab, IntPtr hwndInsertBefore);
@@ -52,12 +52,12 @@ namespace SpineViewer
taskbarList.HrInit(); taskbarList.HrInit();
} }
public static void SetProgressState(IntPtr windowHandle, TBPFLAG state) public static void SetProgressState(nint windowHandle, TBPFLAG state)
{ {
taskbarList.SetProgressState(windowHandle, state); taskbarList.SetProgressState(windowHandle, state);
} }
public static void SetProgressValue(IntPtr windowHandle, ulong completed, ulong total) public static void SetProgressValue(nint windowHandle, ulong completed, ulong total)
{ {
taskbarList.SetProgressValue(windowHandle, completed, total); taskbarList.SetProgressValue(windowHandle, completed, total);
} }

View File

@@ -7,7 +7,7 @@ using System.Runtime.InteropServices;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace SpineViewer namespace SpineViewer.Natives
{ {
/// <summary> /// <summary>
/// Win32 Sdk 包装类 /// Win32 Sdk 包装类
@@ -38,7 +38,7 @@ namespace SpineViewer
public const int ULW_ALPHA = 0x00000002; public const int ULW_ALPHA = 0x00000002;
public const int ULW_OPAQUE = 0x00000004; public const int ULW_OPAQUE = 0x00000004;
public const IntPtr HWND_TOPMOST = -1; public const nint HWND_TOPMOST = -1;
public const uint SWP_NOSIZE = 0x0001; public const uint SWP_NOSIZE = 0x0001;
public const uint SWP_NOMOVE = 0x0002; public const uint SWP_NOMOVE = 0x0002;
@@ -87,28 +87,28 @@ namespace SpineViewer
} }
[DllImport("user32.dll", SetLastError = true)] [DllImport("user32.dll", SetLastError = true)]
public static extern IntPtr GetDC(IntPtr hWnd); public static extern nint GetDC(nint hWnd);
[DllImport("user32.dll", SetLastError = true)] [DllImport("user32.dll", SetLastError = true)]
public static extern int ReleaseDC(IntPtr hWnd, IntPtr hDC); public static extern int ReleaseDC(nint hWnd, nint hDC);
[DllImport("user32.dll", SetLastError = true)] [DllImport("user32.dll", SetLastError = true)]
public static extern int SetWindowLong(IntPtr hWnd, int nIndex, int dwNewLong); public static extern int SetWindowLong(nint hWnd, int nIndex, int dwNewLong);
[DllImport("user32.dll", SetLastError = true)] [DllImport("user32.dll", SetLastError = true)]
public static extern int GetWindowLong(IntPtr hWnd, int nIndex); public static extern int GetWindowLong(nint hWnd, int nIndex);
[DllImport("user32.dll", SetLastError = true)] [DllImport("user32.dll", SetLastError = true)]
public static extern bool GetLayeredWindowAttributes(IntPtr hWnd, ref uint crKey, ref byte bAlpha, ref uint dwFlags); public static extern bool GetLayeredWindowAttributes(nint hWnd, ref uint crKey, ref byte bAlpha, ref uint dwFlags);
[DllImport("user32.dll", SetLastError = true)] [DllImport("user32.dll", SetLastError = true)]
public static extern bool SetLayeredWindowAttributes(IntPtr hWnd, uint pcrKey, byte pbAlpha, uint pdwFlags); public static extern bool SetLayeredWindowAttributes(nint hWnd, uint pcrKey, byte pbAlpha, uint pdwFlags);
[DllImport("user32.dll", SetLastError = true)] [DllImport("user32.dll", SetLastError = true)]
public static extern bool UpdateLayeredWindow(IntPtr hWnd, IntPtr hdcDst, IntPtr pptDst, ref SIZE psize, IntPtr hdcSrc, ref POINT pptSrc, int crKey, ref BLENDFUNCTION pblend, int dwFlags); public static extern bool UpdateLayeredWindow(nint hWnd, nint hdcDst, nint pptDst, ref SIZE psize, nint hdcSrc, ref POINT pptSrc, int crKey, ref BLENDFUNCTION pblend, int dwFlags);
[DllImport("user32.dll", SetLastError = true)] [DllImport("user32.dll", SetLastError = true)]
public static extern bool SetWindowPos(IntPtr hWnd, IntPtr hWndInsertAfter, int X, int Y, int cx, int cy, uint uFlags); public static extern bool SetWindowPos(nint hWnd, nint hWndInsertAfter, int X, int Y, int cx, int cy, uint uFlags);
[DllImport("user32.dll", SetLastError = true)] [DllImport("user32.dll", SetLastError = true)]
public static extern uint GetDoubleClickTime(); public static extern uint GetDoubleClickTime();
@@ -117,37 +117,37 @@ namespace SpineViewer
private static extern bool GetLastInputInfo(ref LASTINPUTINFO plii); private static extern bool GetLastInputInfo(ref LASTINPUTINFO plii);
[DllImport("user32.dll", SetLastError = true)] [DllImport("user32.dll", SetLastError = true)]
public static extern IntPtr FindWindow(string lpClassName, string lpWindowName); public static extern nint FindWindow(string lpClassName, string lpWindowName);
[DllImport("user32.dll", SetLastError = true)] [DllImport("user32.dll", SetLastError = true)]
public static extern IntPtr SendMessageTimeout(IntPtr hWnd, uint Msg, IntPtr wParam, IntPtr lParam, uint fuFlags, uint uTimeout, out IntPtr lpdwResult); public static extern nint SendMessageTimeout(nint hWnd, uint Msg, nint wParam, nint lParam, uint fuFlags, uint uTimeout, out nint lpdwResult);
[DllImport("user32.dll", SetLastError = true)] [DllImport("user32.dll", SetLastError = true)]
public static extern IntPtr FindWindowEx(IntPtr parentHandle, IntPtr childAfter, string className, string windowTitle); public static extern nint FindWindowEx(nint parentHandle, nint childAfter, string className, string windowTitle);
[DllImport("user32.dll", SetLastError = true)] [DllImport("user32.dll", SetLastError = true)]
public static extern IntPtr SetParent(IntPtr hWndChild, IntPtr hWndNewParent); public static extern nint SetParent(nint hWndChild, nint hWndNewParent);
[DllImport("user32.dll", SetLastError = true)] [DllImport("user32.dll", SetLastError = true)]
public static extern IntPtr GetParent(IntPtr hWnd); public static extern nint GetParent(nint hWnd);
[DllImport("user32.dll", SetLastError = true)] [DllImport("user32.dll", SetLastError = true)]
public static extern IntPtr GetAncestor(IntPtr hWnd, uint gaFlags); public static extern nint GetAncestor(nint hWnd, uint gaFlags);
[DllImport("user32.dll", SetLastError = true)] [DllImport("user32.dll", SetLastError = true)]
public static extern IntPtr GetWindow(IntPtr hWnd, uint uCmd); public static extern nint GetWindow(nint hWnd, uint uCmd);
[DllImport("gdi32.dll", SetLastError = true)] [DllImport("gdi32.dll", SetLastError = true)]
public static extern IntPtr CreateCompatibleDC(IntPtr hdc); public static extern nint CreateCompatibleDC(nint hdc);
[DllImport("gdi32.dll", SetLastError = true)] [DllImport("gdi32.dll", SetLastError = true)]
public static extern bool DeleteDC(IntPtr hdc); public static extern bool DeleteDC(nint hdc);
[DllImport("gdi32.dll", SetLastError = true)] [DllImport("gdi32.dll", SetLastError = true)]
public static extern IntPtr SelectObject(IntPtr hdc, IntPtr hgdiobj); public static extern nint SelectObject(nint hdc, nint hgdiobj);
[DllImport("gdi32.dll", SetLastError = true)] [DllImport("gdi32.dll", SetLastError = true)]
public static extern bool DeleteObject(IntPtr hObject); public static extern bool DeleteObject(nint hObject);
public static TimeSpan GetLastInputElapsedTime() public static TimeSpan GetLastInputElapsedTime()
{ {
@@ -164,12 +164,12 @@ namespace SpineViewer
return TimeSpan.FromMilliseconds(idleTimeMillis); return TimeSpan.FromMilliseconds(idleTimeMillis);
} }
public static IntPtr GetWorkerW() public static nint GetWorkerW()
{ {
var progman = FindWindow("Progman", null); var progman = FindWindow("Progman", null);
if (progman == IntPtr.Zero) if (progman == nint.Zero)
return IntPtr.Zero; return nint.Zero;
IntPtr hWnd = FindWindowEx(progman, 0, "WorkerW", null); nint hWnd = FindWindowEx(progman, 0, "WorkerW", null);
Debug.WriteLine($"{hWnd:x8}"); Debug.WriteLine($"{hWnd:x8}");
return hWnd; return hWnd;
} }

View File

@@ -1,4 +1,5 @@
using NLog; using NLog;
using SpineViewer.Utilities;
using System.Diagnostics; using System.Diagnostics;
using System.Reflection; using System.Reflection;
@@ -49,12 +50,12 @@ namespace SpineViewer
try try
{ {
Application.Run(new MainForm() { Text = $"SpineViewer - v{Version}"}); Application.Run(new SpineViewerForm() { Text = $"SpineViewer - v{Version}"});
} }
catch (Exception ex) catch (Exception ex)
{ {
logger.Fatal(ex.ToString()); logger.Fatal(ex.ToString());
MessageBox.Error(ex.ToString(), "程序已崩溃"); MessagePopup.Error(ex.ToString(), "程序已崩溃");
} }
} }

View File

@@ -7,7 +7,7 @@ using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using SpineRuntime21; using SpineRuntime21;
using SpineViewer.Extensions; using SpineViewer.Utilities;
namespace SpineViewer.Spine.Implementations.Spine namespace SpineViewer.Spine.Implementations.Spine
{ {

View File

@@ -7,7 +7,7 @@ using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using SpineRuntime36; using SpineRuntime36;
using SpineViewer.Extensions; using SpineViewer.Utilities;
namespace SpineViewer.Spine.Implementations.Spine namespace SpineViewer.Spine.Implementations.Spine
{ {

View File

@@ -4,7 +4,7 @@ using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using SpineRuntime37; using SpineRuntime37;
using SpineViewer.Extensions; using SpineViewer.Utilities;
namespace SpineViewer.Spine.Implementations.Spine namespace SpineViewer.Spine.Implementations.Spine
{ {

View File

@@ -7,7 +7,7 @@ using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using SpineRuntime38; using SpineRuntime38;
using SpineRuntime38.Attachments; using SpineRuntime38.Attachments;
using SpineViewer.Extensions; using SpineViewer.Utilities;
namespace SpineViewer.Spine.Implementations.Spine namespace SpineViewer.Spine.Implementations.Spine
{ {

View File

@@ -6,7 +6,7 @@ using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using SpineRuntime40; using SpineRuntime40;
using SpineViewer.Extensions; using SpineViewer.Utilities;
namespace SpineViewer.Spine.Implementations.Spine namespace SpineViewer.Spine.Implementations.Spine
{ {

View File

@@ -6,7 +6,7 @@ using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using SpineRuntime41; using SpineRuntime41;
using SpineViewer.Extensions; using SpineViewer.Utilities;
namespace SpineViewer.Spine.Implementations.Spine namespace SpineViewer.Spine.Implementations.Spine
{ {

View File

@@ -6,7 +6,7 @@ using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using SpineRuntime42; using SpineRuntime42;
using SpineViewer.Extensions; using SpineViewer.Utilities;
namespace SpineViewer.Spine.Implementations.Spine namespace SpineViewer.Spine.Implementations.Spine
{ {

View File

@@ -9,6 +9,7 @@ using System.Text;
using System.Text.Json; using System.Text.Json;
using System.Text.Json.Nodes; using System.Text.Json.Nodes;
using System.Text.Encodings.Web; using System.Text.Encodings.Web;
using SpineViewer.Utilities;
namespace SpineViewer.Spine namespace SpineViewer.Spine
{ {

View File

@@ -5,6 +5,7 @@ using System.Drawing.Design;
using NLog; using NLog;
using System.Xml.Linq; using System.Xml.Linq;
using SpineViewer.Extensions; using SpineViewer.Extensions;
using SpineViewer.Utilities;
namespace SpineViewer.Spine namespace SpineViewer.Spine
{ {

View File

@@ -1,4 +1,5 @@
using System; using SpineViewer.Utilities;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Collections.Immutable; using System.Collections.Immutable;
using System.Collections.ObjectModel; using System.Collections.ObjectModel;

View File

@@ -6,7 +6,7 @@ using System.Reflection;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace SpineViewer namespace SpineViewer.Utilities
{ {
public interface IImplementationKey<TKey> public interface IImplementationKey<TKey>
{ {

View File

@@ -5,35 +5,35 @@ using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows; using System.Windows;
namespace SpineViewer namespace SpineViewer.Utilities
{ {
/// <summary> /// <summary>
/// 弹窗消息静态类 /// 弹窗消息静态类
/// </summary> /// </summary>
public static class MessageBox public static class MessagePopup
{ {
/// <summary> /// <summary>
/// 提示弹窗 /// 提示弹窗
/// </summary> /// </summary>
public static void Info(string text, string title = "提示信息") => public static void Info(string text, string title = "提示信息") =>
System.Windows.Forms.MessageBox.Show(text, title, MessageBoxButtons.OK, MessageBoxIcon.Information); MessageBox.Show(text, title, MessageBoxButtons.OK, MessageBoxIcon.Information);
/// <summary> /// <summary>
/// 警告弹窗 /// 警告弹窗
/// </summary> /// </summary>
public static void Warn(string text, string title = "警告信息") => public static void Warn(string text, string title = "警告信息") =>
System.Windows.Forms.MessageBox.Show(text, title, MessageBoxButtons.OK, MessageBoxIcon.Warning); MessageBox.Show(text, title, MessageBoxButtons.OK, MessageBoxIcon.Warning);
/// <summary> /// <summary>
/// 错误弹窗 /// 错误弹窗
/// </summary> /// </summary>
public static void Error(string text, string title = "错误信息") => public static void Error(string text, string title = "错误信息") =>
System.Windows.Forms.MessageBox.Show(text, title, MessageBoxButtons.OK, MessageBoxIcon.Error); MessageBox.Show(text, title, MessageBoxButtons.OK, MessageBoxIcon.Error);
/// <summary> /// <summary>
/// 操作确认弹窗 /// 操作确认弹窗
/// </summary> /// </summary>
public static DialogResult Quest(string text, string title = "操作确认") => public static DialogResult Quest(string text, string title = "操作确认") =>
System.Windows.Forms.MessageBox.Show(text, title, MessageBoxButtons.OKCancel, MessageBoxIcon.Question); MessageBox.Show(text, title, MessageBoxButtons.OKCancel, MessageBoxIcon.Question);
} }
} }

View File

@@ -4,7 +4,7 @@ using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace SpineViewer.Extensions namespace SpineViewer.Utilities
{ {
/// <summary> /// <summary>
/// SFML 混合模式, 预乘模式下输入和输出的像素值都是预乘的 /// SFML 混合模式, 预乘模式下输入和输出的像素值都是预乘的

View File

@@ -4,7 +4,7 @@ using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace SpineViewer.Extensions namespace SpineViewer.Utilities
{ {
public static class SFMLShader public static class SFMLShader
{ {