Skip to content

Commit

Permalink
基本暗黑模式支持
Browse files Browse the repository at this point in the history
  • Loading branch information
WhatDamon committed Aug 21, 2024
1 parent 6627137 commit b094f02
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 6 deletions.
4 changes: 4 additions & 0 deletions NCMDumpGUI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,8 @@
<AdditionalFiles Remove="app.manifest" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="DarkNet" Version="2.3.0" />
</ItemGroup>

</Project>
13 changes: 10 additions & 3 deletions Program.cs
Original file line number Diff line number Diff line change
@@ -1,25 +1,32 @@
using Dark.Net;

namespace NCMDumpGUI
{
internal static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>

[STAThread]
static void Main()
{
Application.SetHighDpiMode(HighDpiMode.SystemAware);
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
IDarkNet darkNet = DarkNet.Instance;
if (!File.Exists("libncmdump.dll"))
{
MessageBox.Show("核心不存在\n请确认libncmdump.dll与本程序在同一目录", "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
Environment.Exit(0);
}
else
{
// To customize application configuration such as set high DPI settings or default font,
// see https://aka.ms/applicationconfiguration.
ApplicationConfiguration.Initialize();
Application.Run(new WndMain());
Form mainForm = new WndMain();
Theme windowTheme = Theme.Auto;
darkNet.SetWindowThemeForms(mainForm, windowTheme);
Application.Run(mainForm);
}
}
}
Expand Down
13 changes: 10 additions & 3 deletions WndMain.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using Dark.Net;
using System;
using System.Diagnostics;
using System.Runtime.InteropServices;
Expand Down Expand Up @@ -100,7 +101,7 @@ private void browseButton_Click(object sender, EventArgs e)
// 检查ncm二进制文件
private bool CheckNCMBinary(string filePath)
{
string correctHeader = "CTENFDAM";
string magicHeader = "CTENFDAM";

try
{
Expand All @@ -112,7 +113,7 @@ private bool CheckNCMBinary(string filePath)
if (bytesRead == 8)
{
string header = Encoding.ASCII.GetString(bytes);
if (header == correctHeader)
if (header == magicHeader)
{
return true;
}
Expand Down Expand Up @@ -297,15 +298,21 @@ private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs
MessageBox.Show("注意!\n此应用只用于学习用途,禁止用于商业或违法用途,\n请在遵守NCM文件提供平台的服务条款下使用本应用,\n作者对商业或违法使用本软件造成的任何后果不承担任何责任!", "免责声明", MessageBoxButtons.OK, MessageBoxIcon.Information);
}

private string currentFilePath = "";
private string currentFolderPath = "";

private void fileFolderComboBox_SelectedIndexChanged(object sender, EventArgs e)
{
filepathTextBox.Text = "";
if (fileFolderComboBox.SelectedIndex == 1)
{
currentFilePath = filepathTextBox.Text;
filepathTextBox.Text = currentFolderPath;
scanMoreFoldersCheckBox.Visible = true;
}
else
{
currentFolderPath = filepathTextBox.Text;
filepathTextBox.Text = currentFilePath;
scanMoreFoldersCheckBox.Visible = false;
}
}
Expand Down

0 comments on commit b094f02

Please sign in to comment.