diff --git a/SpineViewer/Controls/SpineListView.cs b/SpineViewer/Controls/SpineListView.cs index f9f715a..5b0452a 100644 --- a/SpineViewer/Controls/SpineListView.cs +++ b/SpineViewer/Controls/SpineListView.cs @@ -15,6 +15,7 @@ using System.Collections.Specialized; using NLog; using SpineViewer.Extensions; using SpineViewer.PropertyGridWrappers.Spine; +using SpineViewer.Utilities; namespace SpineViewer.Controls { @@ -100,7 +101,7 @@ namespace SpineViewer.Controls { logger.Error(ex.ToString()); logger.Error("Failed to load {} {}", result.SkelPath, result.AtlasPath); - MessageBox.Error(ex.ToString(), "骨骼加载失败"); + MessagePopup.Error(ex.ToString(), "骨骼加载失败"); } logger.LogCurrentProcessMemoryUsage(); @@ -221,7 +222,7 @@ namespace SpineViewer.Controls { if (validPaths.Count > 100) { - if (MessageBox.Quest($"共发现 {validPaths.Count} 个可加载骨骼,数量较多,是否一次性全部加载?") == DialogResult.Cancel) + if (MessagePopup.Quest($"共发现 {validPaths.Count} 个可加载骨骼,数量较多,是否一次性全部加载?") == DialogResult.Cancel) return; } BatchAdd(new Dialogs.BatchOpenSpineDialogResult(SpineVersion.Auto, validPaths.ToArray())); @@ -410,7 +411,7 @@ namespace SpineViewer.Controls if (listView.SelectedIndices.Count > 1) { - if (MessageBox.Quest($"确定移除所选 {listView.SelectedIndices.Count} 项吗?") != DialogResult.OK) + if (MessagePopup.Quest($"确定移除所选 {listView.SelectedIndices.Count} 项吗?") != DialogResult.OK) return; } @@ -510,7 +511,7 @@ namespace SpineViewer.Controls if (listView.Items.Count <= 0) return; - if (MessageBox.Quest($"确认移除所有 {listView.Items.Count} 项吗?") != DialogResult.OK) + if (MessagePopup.Quest($"确认移除所有 {listView.Items.Count} 项吗?") != DialogResult.OK) return; listView.Items.Clear(); diff --git a/SpineViewer/Controls/SpinePreviewer.cs b/SpineViewer/Controls/SpinePreviewer.cs index 49040b5..014315c 100644 --- a/SpineViewer/Controls/SpinePreviewer.cs +++ b/SpineViewer/Controls/SpinePreviewer.cs @@ -10,6 +10,7 @@ using System.Windows.Forms; using System.Security.Policy; using System.Diagnostics; using NLog; +using SpineViewer.Utilities; namespace SpineViewer.Controls { @@ -402,7 +403,7 @@ namespace SpineViewer.Controls { logger.Fatal(ex); logger.Fatal("Render task stopped"); - MessageBox.Error(ex.ToString(), "预览画面已停止渲染"); + MessagePopup.Error(ex.ToString(), "预览画面已停止渲染"); } finally { diff --git a/SpineViewer/Controls/SpinePropertyGrid.cs b/SpineViewer/Controls/SpinePropertyGrid.cs index 0022273..708198d 100644 --- a/SpineViewer/Controls/SpinePropertyGrid.cs +++ b/SpineViewer/Controls/SpinePropertyGrid.cs @@ -8,6 +8,7 @@ using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using SpineViewer.PropertyGridWrappers.Spine; +using SpineViewer.Utilities; namespace SpineViewer.Controls { @@ -86,7 +87,7 @@ namespace SpineViewer.Controls if (spine.SkinNames.Count <= 0) { - MessageBox.Info("没有可用的皮肤"); + MessagePopup.Info("没有可用的皮肤"); return; } diff --git a/SpineViewer/Dialogs/AboutDialog.cs b/SpineViewer/Dialogs/AboutDialog.cs index d7d4198..400d52c 100644 --- a/SpineViewer/Dialogs/AboutDialog.cs +++ b/SpineViewer/Dialogs/AboutDialog.cs @@ -1,4 +1,5 @@ -using System; +using SpineViewer.Utilities; +using System; using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics; @@ -40,7 +41,7 @@ namespace SpineViewer.Dialogs else { Clipboard.SetText(url); - MessageBox.Info("链接已复制到剪贴板,请前往浏览器进行访问"); + MessagePopup.Info("链接已复制到剪贴板,请前往浏览器进行访问"); } } } diff --git a/SpineViewer/Dialogs/BatchOpenSpineDialog.cs b/SpineViewer/Dialogs/BatchOpenSpineDialog.cs index 76dab4c..19c23c6 100644 --- a/SpineViewer/Dialogs/BatchOpenSpineDialog.cs +++ b/SpineViewer/Dialogs/BatchOpenSpineDialog.cs @@ -1,4 +1,5 @@ using SpineViewer.Spine; +using SpineViewer.Utilities; using System; using System.Collections.Generic; using System.ComponentModel; @@ -35,7 +36,7 @@ namespace SpineViewer.Dialogs if (items.Count <= 0) { - MessageBox.Info("未选择任何文件"); + MessagePopup.Info("未选择任何文件"); return; } @@ -43,14 +44,14 @@ namespace SpineViewer.Dialogs { if (!File.Exists(p)) { - MessageBox.Info($"{p}", "skel文件不存在"); + MessagePopup.Info($"{p}", "skel文件不存在"); return; } } if (version != SpineVersion.Auto && !Spine.Spine.HasImplementation(version)) { - MessageBox.Info($"{version.GetName()} 版本尚未实现(咕咕咕~)"); + MessagePopup.Info($"{version.GetName()} 版本尚未实现(咕咕咕~)"); return; } diff --git a/SpineViewer/Dialogs/ConvertFileFormatDialog.cs b/SpineViewer/Dialogs/ConvertFileFormatDialog.cs index 0990613..30b98f4 100644 --- a/SpineViewer/Dialogs/ConvertFileFormatDialog.cs +++ b/SpineViewer/Dialogs/ConvertFileFormatDialog.cs @@ -1,4 +1,5 @@ using SpineViewer.Spine; +using SpineViewer.Utilities; using System; using System.Collections.Generic; using System.ComponentModel; @@ -46,7 +47,7 @@ namespace SpineViewer.Dialogs if (items.Count <= 0) { - MessageBox.Info("未选择任何文件"); + MessagePopup.Info("未选择任何文件"); return; } @@ -54,20 +55,20 @@ namespace SpineViewer.Dialogs { if (!File.Exists(p)) { - MessageBox.Info($"{p}", "skel文件不存在"); + MessagePopup.Info($"{p}", "skel文件不存在"); return; } } if (sourceVersion != SpineVersion.Auto && !SkeletonConverter.HasImplementation(sourceVersion)) { - MessageBox.Info($"{sourceVersion.GetName()} 版本尚未实现(咕咕咕~)"); + MessagePopup.Info($"{sourceVersion.GetName()} 版本尚未实现(咕咕咕~)"); return; } if (!SkeletonConverter.HasImplementation(targetVersion)) { - MessageBox.Info($"{targetVersion.GetName()} 版本尚未实现(咕咕咕~)"); + MessagePopup.Info($"{targetVersion.GetName()} 版本尚未实现(咕咕咕~)"); return; } diff --git a/SpineViewer/Dialogs/DiagnosticsDialog.cs b/SpineViewer/Dialogs/DiagnosticsDialog.cs index 4a3d673..44094f6 100644 --- a/SpineViewer/Dialogs/DiagnosticsDialog.cs +++ b/SpineViewer/Dialogs/DiagnosticsDialog.cs @@ -1,4 +1,5 @@ using Microsoft.Win32; +using SpineViewer.Utilities; using System; using System.Collections.Generic; using System.ComponentModel; @@ -92,7 +93,7 @@ namespace SpineViewer.Dialogs var properties = selectedObject.GetType().GetProperties(); var result = string.Join(Environment.NewLine, properties.Select(p => $"{p.Name}\t{p.GetValue(selectedObject)?.ToString()}")); Clipboard.SetText(result); - MessageBox.Info("已复制"); + MessagePopup.Info("已复制"); } } } diff --git a/SpineViewer/Dialogs/ExportDialog.cs b/SpineViewer/Dialogs/ExportDialog.cs index 6dafa6f..31b2d9b 100644 --- a/SpineViewer/Dialogs/ExportDialog.cs +++ b/SpineViewer/Dialogs/ExportDialog.cs @@ -1,4 +1,5 @@ using SpineViewer.PropertyGridWrappers.Exporter; +using SpineViewer.Utilities; using System; using System.Collections; using System.Collections.Generic; @@ -64,7 +65,7 @@ namespace SpineViewer.Dialogs { if (wrapper.Exporter.Validate() is string error) { - MessageBox.Info(error, "参数错误"); + MessagePopup.Info(error, "参数错误"); return; } DialogResult = DialogResult.OK; diff --git a/SpineViewer/Dialogs/OpenSpineDialog.cs b/SpineViewer/Dialogs/OpenSpineDialog.cs index db9dbe5..4d14194 100644 --- a/SpineViewer/Dialogs/OpenSpineDialog.cs +++ b/SpineViewer/Dialogs/OpenSpineDialog.cs @@ -1,4 +1,5 @@ using SpineViewer.Spine; +using SpineViewer.Utilities; using System; using System.Collections.Generic; using System.ComponentModel; @@ -57,7 +58,7 @@ namespace SpineViewer.Dialogs if (!File.Exists(skelPath)) { - MessageBox.Info($"{skelPath}", "skel文件不存在"); + MessagePopup.Info($"{skelPath}", "skel文件不存在"); return; } else @@ -71,7 +72,7 @@ namespace SpineViewer.Dialogs } else if (!File.Exists(atlasPath)) { - MessageBox.Info($"{atlasPath}", "atlas文件不存在"); + MessagePopup.Info($"{atlasPath}", "atlas文件不存在"); return; } else @@ -81,7 +82,7 @@ namespace SpineViewer.Dialogs if (version != SpineVersion.Auto && !Spine.Spine.HasImplementation(version)) { - MessageBox.Info($"{version.GetName()} 版本尚未实现(咕咕咕~)"); + MessagePopup.Info($"{version.GetName()} 版本尚未实现(咕咕咕~)"); return; } diff --git a/SpineViewer/Dialogs/ProgressDialog.cs b/SpineViewer/Dialogs/ProgressDialog.cs index 91dbfa8..560d946 100644 --- a/SpineViewer/Dialogs/ProgressDialog.cs +++ b/SpineViewer/Dialogs/ProgressDialog.cs @@ -1,4 +1,5 @@ using NLog; +using SpineViewer.Utilities; using System; using System.Collections.Generic; using System.ComponentModel; @@ -51,7 +52,7 @@ namespace SpineViewer.Dialogs if (e.Error != null) { logger.Error(e.Error.ToString()); - MessageBox.Error(e.Error.ToString(), "执行出错"); + MessagePopup.Error(e.Error.ToString(), "执行出错"); DialogResult = DialogResult.Abort; } else if (e.Cancelled) diff --git a/SpineViewer/Exporter/Exporter.cs b/SpineViewer/Exporter/Exporter.cs index f5fc7ea..5a70697 100644 --- a/SpineViewer/Exporter/Exporter.cs +++ b/SpineViewer/Exporter/Exporter.cs @@ -1,6 +1,7 @@ using NLog; using SpineViewer.Extensions; using SpineViewer.PropertyGridWrappers; +using SpineViewer.Utilities; using System; using System.Collections.Generic; using System.ComponentModel; diff --git a/SpineViewer/PetForm.Designer.cs b/SpineViewer/Forms/PetForm.Designer.cs similarity index 100% rename from SpineViewer/PetForm.Designer.cs rename to SpineViewer/Forms/PetForm.Designer.cs diff --git a/SpineViewer/PetForm.cs b/SpineViewer/Forms/PetForm.cs similarity index 97% rename from SpineViewer/PetForm.cs rename to SpineViewer/Forms/PetForm.cs index b5ed123..0138ba5 100644 --- a/SpineViewer/PetForm.cs +++ b/SpineViewer/Forms/PetForm.cs @@ -1,4 +1,5 @@ -using System; +using SpineViewer.Natives; +using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; diff --git a/SpineViewer/PetForm.resx b/SpineViewer/Forms/PetForm.resx similarity index 100% rename from SpineViewer/PetForm.resx rename to SpineViewer/Forms/PetForm.resx diff --git a/SpineViewer/MainForm.Designer.cs b/SpineViewer/Forms/SpineViewerForm.Designer.cs similarity index 99% rename from SpineViewer/MainForm.Designer.cs rename to SpineViewer/Forms/SpineViewerForm.Designer.cs index d1fcf9b..083a171 100644 --- a/SpineViewer/MainForm.Designer.cs +++ b/SpineViewer/Forms/SpineViewerForm.Designer.cs @@ -1,6 +1,6 @@ namespace SpineViewer { - partial class MainForm + partial class SpineViewerForm { /// /// Required designer variable. @@ -29,7 +29,7 @@ private void InitializeComponent() { 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(); toolStripMenuItem_File = new ToolStripMenuItem(); toolStripMenuItem_Open = new ToolStripMenuItem(); diff --git a/SpineViewer/MainForm.cs b/SpineViewer/Forms/SpineViewerForm.cs similarity index 97% rename from SpineViewer/MainForm.cs rename to SpineViewer/Forms/SpineViewerForm.cs index d57cbe3..7a7dc30 100644 --- a/SpineViewer/MainForm.cs +++ b/SpineViewer/Forms/SpineViewerForm.cs @@ -3,17 +3,18 @@ using SpineViewer.Spine; using System.ComponentModel; using System.Diagnostics; using SpineViewer.Exporter; -using SpineViewer.Extensions; using System.Reflection.Metadata; using SpineViewer.PropertyGridWrappers.Exporter; +using SpineViewer.Utilities; +using SpineViewer.Natives; namespace SpineViewer { - internal partial class MainForm : Form + internal partial class SpineViewerForm : Form { private Logger logger = LogManager.GetCurrentClassLogger(); - public MainForm() + public SpineViewerForm() { InitializeComponent(); InitializeLogConfiguration(); @@ -27,7 +28,7 @@ namespace SpineViewer { logger.Error(ex.ToString()); 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) { - if (spinePreviewer.IsUpdating && MessageBox.Quest("画面仍在更新,建议手动暂停画面后导出固定的一帧,是否继续?") != DialogResult.OK) + if (spinePreviewer.IsUpdating && MessagePopup.Quest("画面仍在更新,建议手动暂停画面后导出固定的一帧,是否继续?") != DialogResult.OK) return; var exporter = new FrameExporter() diff --git a/SpineViewer/MainForm.resx b/SpineViewer/Forms/SpineViewerForm.resx similarity index 100% rename from SpineViewer/MainForm.resx rename to SpineViewer/Forms/SpineViewerForm.resx diff --git a/SpineViewer/TaskbarManager.cs b/SpineViewer/Natives/TaskbarManager.cs similarity index 74% rename from SpineViewer/TaskbarManager.cs rename to SpineViewer/Natives/TaskbarManager.cs index f255cb5..de6274d 100644 --- a/SpineViewer/TaskbarManager.cs +++ b/SpineViewer/Natives/TaskbarManager.cs @@ -2,7 +2,7 @@ using System.Runtime.InteropServices; using System.Windows.Forms; -namespace SpineViewer +namespace SpineViewer.Natives { internal enum TBPFLAG { @@ -19,15 +19,15 @@ namespace SpineViewer { // ITaskbarList void HrInit(); - void AddTab(IntPtr hwnd); - void DeleteTab(IntPtr hwnd); - void ActivateTab(IntPtr hwnd); - void SetActiveAlt(IntPtr hwnd); + void AddTab(nint hwnd); + void DeleteTab(nint hwnd); + void ActivateTab(nint hwnd); + void SetActiveAlt(nint hwnd); // ITaskbarList2 - void MarkFullscreenWindow(IntPtr hwnd, [MarshalAs(UnmanagedType.Bool)] bool fFullscreen); + void MarkFullscreenWindow(nint hwnd, [MarshalAs(UnmanagedType.Bool)] bool fFullscreen); // ITaskbarList3 - void SetProgressValue(IntPtr hwnd, ulong ullCompleted, ulong ullTotal); - void SetProgressState(IntPtr hwnd, TBPFLAG tbpFlags); + void SetProgressValue(nint hwnd, ulong ullCompleted, ulong ullTotal); + void SetProgressState(nint hwnd, TBPFLAG tbpFlags); //void RegisterTab(IntPtr hwndTab, IntPtr hwndMDI); //void UnregisterTab(IntPtr hwndTab); //void SetTabOrder(IntPtr hwndTab, IntPtr hwndInsertBefore); @@ -52,12 +52,12 @@ namespace SpineViewer taskbarList.HrInit(); } - public static void SetProgressState(IntPtr windowHandle, TBPFLAG state) + public static void SetProgressState(nint windowHandle, TBPFLAG 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); } diff --git a/SpineViewer/Win32.cs b/SpineViewer/Natives/Win32.cs similarity index 69% rename from SpineViewer/Win32.cs rename to SpineViewer/Natives/Win32.cs index 8bca057..460cac8 100644 --- a/SpineViewer/Win32.cs +++ b/SpineViewer/Natives/Win32.cs @@ -7,7 +7,7 @@ using System.Runtime.InteropServices; using System.Text; using System.Threading.Tasks; -namespace SpineViewer +namespace SpineViewer.Natives { /// /// Win32 Sdk 包装类 @@ -38,7 +38,7 @@ namespace SpineViewer public const int ULW_ALPHA = 0x00000002; 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_NOMOVE = 0x0002; @@ -87,28 +87,28 @@ namespace SpineViewer } [DllImport("user32.dll", SetLastError = true)] - public static extern IntPtr GetDC(IntPtr hWnd); + public static extern nint GetDC(nint hWnd); [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)] - 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)] - public static extern int GetWindowLong(IntPtr hWnd, int nIndex); + public static extern int GetWindowLong(nint hWnd, int nIndex); [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)] - 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)] - 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)] - 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)] public static extern uint GetDoubleClickTime(); @@ -117,37 +117,37 @@ namespace SpineViewer private static extern bool GetLastInputInfo(ref LASTINPUTINFO plii); [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)] - 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)] - 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)] - public static extern IntPtr SetParent(IntPtr hWndChild, IntPtr hWndNewParent); + public static extern nint SetParent(nint hWndChild, nint hWndNewParent); [DllImport("user32.dll", SetLastError = true)] - public static extern IntPtr GetParent(IntPtr hWnd); + public static extern nint GetParent(nint hWnd); [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)] - public static extern IntPtr GetWindow(IntPtr hWnd, uint uCmd); + public static extern nint GetWindow(nint hWnd, uint uCmd); [DllImport("gdi32.dll", SetLastError = true)] - public static extern IntPtr CreateCompatibleDC(IntPtr hdc); + public static extern nint CreateCompatibleDC(nint hdc); [DllImport("gdi32.dll", SetLastError = true)] - public static extern bool DeleteDC(IntPtr hdc); + public static extern bool DeleteDC(nint hdc); [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)] - public static extern bool DeleteObject(IntPtr hObject); + public static extern bool DeleteObject(nint hObject); public static TimeSpan GetLastInputElapsedTime() { @@ -164,12 +164,12 @@ namespace SpineViewer return TimeSpan.FromMilliseconds(idleTimeMillis); } - public static IntPtr GetWorkerW() + public static nint GetWorkerW() { var progman = FindWindow("Progman", null); - if (progman == IntPtr.Zero) - return IntPtr.Zero; - IntPtr hWnd = FindWindowEx(progman, 0, "WorkerW", null); + if (progman == nint.Zero) + return nint.Zero; + nint hWnd = FindWindowEx(progman, 0, "WorkerW", null); Debug.WriteLine($"{hWnd:x8}"); return hWnd; } diff --git a/SpineViewer/Program.cs b/SpineViewer/Program.cs index b1f752b..88d62c6 100644 --- a/SpineViewer/Program.cs +++ b/SpineViewer/Program.cs @@ -1,4 +1,5 @@ using NLog; +using SpineViewer.Utilities; using System.Diagnostics; using System.Reflection; @@ -49,12 +50,12 @@ namespace SpineViewer try { - Application.Run(new MainForm() { Text = $"SpineViewer - v{Version}"}); + Application.Run(new SpineViewerForm() { Text = $"SpineViewer - v{Version}"}); } catch (Exception ex) { logger.Fatal(ex.ToString()); - MessageBox.Error(ex.ToString(), "程序已崩溃"); + MessagePopup.Error(ex.ToString(), "程序已崩溃"); } } diff --git a/SpineViewer/Spine/Implementations/Spine/Spine21.cs b/SpineViewer/Spine/Implementations/Spine/Spine21.cs index 2a7cd6e..b151c5c 100644 --- a/SpineViewer/Spine/Implementations/Spine/Spine21.cs +++ b/SpineViewer/Spine/Implementations/Spine/Spine21.cs @@ -7,7 +7,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; using SpineRuntime21; -using SpineViewer.Extensions; +using SpineViewer.Utilities; namespace SpineViewer.Spine.Implementations.Spine { diff --git a/SpineViewer/Spine/Implementations/Spine/Spine36.cs b/SpineViewer/Spine/Implementations/Spine/Spine36.cs index 72edbdd..65e1832 100644 --- a/SpineViewer/Spine/Implementations/Spine/Spine36.cs +++ b/SpineViewer/Spine/Implementations/Spine/Spine36.cs @@ -7,7 +7,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; using SpineRuntime36; -using SpineViewer.Extensions; +using SpineViewer.Utilities; namespace SpineViewer.Spine.Implementations.Spine { diff --git a/SpineViewer/Spine/Implementations/Spine/Spine37.cs b/SpineViewer/Spine/Implementations/Spine/Spine37.cs index acebdf2..de441c1 100644 --- a/SpineViewer/Spine/Implementations/Spine/Spine37.cs +++ b/SpineViewer/Spine/Implementations/Spine/Spine37.cs @@ -4,7 +4,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; using SpineRuntime37; -using SpineViewer.Extensions; +using SpineViewer.Utilities; namespace SpineViewer.Spine.Implementations.Spine { diff --git a/SpineViewer/Spine/Implementations/Spine/Spine38.cs b/SpineViewer/Spine/Implementations/Spine/Spine38.cs index 59d4536..62032ff 100644 --- a/SpineViewer/Spine/Implementations/Spine/Spine38.cs +++ b/SpineViewer/Spine/Implementations/Spine/Spine38.cs @@ -7,7 +7,7 @@ using System.Text; using System.Threading.Tasks; using SpineRuntime38; using SpineRuntime38.Attachments; -using SpineViewer.Extensions; +using SpineViewer.Utilities; namespace SpineViewer.Spine.Implementations.Spine { diff --git a/SpineViewer/Spine/Implementations/Spine/Spine40.cs b/SpineViewer/Spine/Implementations/Spine/Spine40.cs index 19f53e7..139e2a7 100644 --- a/SpineViewer/Spine/Implementations/Spine/Spine40.cs +++ b/SpineViewer/Spine/Implementations/Spine/Spine40.cs @@ -6,7 +6,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; using SpineRuntime40; -using SpineViewer.Extensions; +using SpineViewer.Utilities; namespace SpineViewer.Spine.Implementations.Spine { diff --git a/SpineViewer/Spine/Implementations/Spine/Spine41.cs b/SpineViewer/Spine/Implementations/Spine/Spine41.cs index 39bffcc..1de932c 100644 --- a/SpineViewer/Spine/Implementations/Spine/Spine41.cs +++ b/SpineViewer/Spine/Implementations/Spine/Spine41.cs @@ -6,7 +6,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; using SpineRuntime41; -using SpineViewer.Extensions; +using SpineViewer.Utilities; namespace SpineViewer.Spine.Implementations.Spine { diff --git a/SpineViewer/Spine/Implementations/Spine/Spine42.cs b/SpineViewer/Spine/Implementations/Spine/Spine42.cs index 45ed97a..e95b39e 100644 --- a/SpineViewer/Spine/Implementations/Spine/Spine42.cs +++ b/SpineViewer/Spine/Implementations/Spine/Spine42.cs @@ -6,7 +6,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; using SpineRuntime42; -using SpineViewer.Extensions; +using SpineViewer.Utilities; namespace SpineViewer.Spine.Implementations.Spine { diff --git a/SpineViewer/Spine/SkeletonConverter.cs b/SpineViewer/Spine/SkeletonConverter.cs index 923247d..c86387f 100644 --- a/SpineViewer/Spine/SkeletonConverter.cs +++ b/SpineViewer/Spine/SkeletonConverter.cs @@ -9,6 +9,7 @@ using System.Text; using System.Text.Json; using System.Text.Json.Nodes; using System.Text.Encodings.Web; +using SpineViewer.Utilities; namespace SpineViewer.Spine { diff --git a/SpineViewer/Spine/Spine.cs b/SpineViewer/Spine/Spine.cs index 29e6d03..fd00ea6 100644 --- a/SpineViewer/Spine/Spine.cs +++ b/SpineViewer/Spine/Spine.cs @@ -5,6 +5,7 @@ using System.Drawing.Design; using NLog; using System.Xml.Linq; using SpineViewer.Extensions; +using SpineViewer.Utilities; namespace SpineViewer.Spine { diff --git a/SpineViewer/Spine/SpineHelper.cs b/SpineViewer/Spine/SpineHelper.cs index 209ed65..2fb30a3 100644 --- a/SpineViewer/Spine/SpineHelper.cs +++ b/SpineViewer/Spine/SpineHelper.cs @@ -1,4 +1,5 @@ -using System; +using SpineViewer.Utilities; +using System; using System.Collections.Generic; using System.Collections.Immutable; using System.Collections.ObjectModel; diff --git a/SpineViewer/ImplementationResolver.cs b/SpineViewer/Utilities/ImplementationResolver.cs similarity index 98% rename from SpineViewer/ImplementationResolver.cs rename to SpineViewer/Utilities/ImplementationResolver.cs index 977088d..fba9151 100644 --- a/SpineViewer/ImplementationResolver.cs +++ b/SpineViewer/Utilities/ImplementationResolver.cs @@ -6,7 +6,7 @@ using System.Reflection; using System.Text; using System.Threading.Tasks; -namespace SpineViewer +namespace SpineViewer.Utilities { public interface IImplementationKey { diff --git a/SpineViewer/MessageBox.cs b/SpineViewer/Utilities/MessagePopup.cs similarity index 62% rename from SpineViewer/MessageBox.cs rename to SpineViewer/Utilities/MessagePopup.cs index cf9b249..c897880 100644 --- a/SpineViewer/MessageBox.cs +++ b/SpineViewer/Utilities/MessagePopup.cs @@ -5,35 +5,35 @@ using System.Text; using System.Threading.Tasks; using System.Windows; -namespace SpineViewer +namespace SpineViewer.Utilities { /// /// 弹窗消息静态类 /// - public static class MessageBox + public static class MessagePopup { /// /// 提示弹窗 /// 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); /// /// 警告弹窗 /// 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); /// /// 错误弹窗 /// 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); /// /// 操作确认弹窗 /// 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); } } diff --git a/SpineViewer/Extensions/SFMLBlendMode.cs b/SpineViewer/Utilities/SFMLBlendMode.cs similarity index 99% rename from SpineViewer/Extensions/SFMLBlendMode.cs rename to SpineViewer/Utilities/SFMLBlendMode.cs index 0936ecc..e0bdd15 100644 --- a/SpineViewer/Extensions/SFMLBlendMode.cs +++ b/SpineViewer/Utilities/SFMLBlendMode.cs @@ -4,7 +4,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -namespace SpineViewer.Extensions +namespace SpineViewer.Utilities { /// /// SFML 混合模式, 预乘模式下输入和输出的像素值都是预乘的 diff --git a/SpineViewer/Extensions/SFMLShader.cs b/SpineViewer/Utilities/SFMLShader.cs similarity index 98% rename from SpineViewer/Extensions/SFMLShader.cs rename to SpineViewer/Utilities/SFMLShader.cs index eacaf36..a03e709 100644 --- a/SpineViewer/Extensions/SFMLShader.cs +++ b/SpineViewer/Utilities/SFMLShader.cs @@ -4,7 +4,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -namespace SpineViewer.Extensions +namespace SpineViewer.Utilities { public static class SFMLShader {