From e6628f123ea65a7bf160c0e8d3c01d9a26eb79fe Mon Sep 17 00:00:00 2001 From: "allen.yan" Date: Wed, 6 Aug 2025 17:21:45 +0800 Subject: [PATCH] =?UTF-8?q?mute=E6=8C=89=E9=88=95=E9=82=8F=E8=BC=AF?= =?UTF-8?q?=E6=9B=B4=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- PrimaryFormParts/PrimaryForm.cs | 296 +++++++++++++++++--------------- 1 file changed, 156 insertions(+), 140 deletions(-) diff --git a/PrimaryFormParts/PrimaryForm.cs b/PrimaryFormParts/PrimaryForm.cs index ea717eb..7920746 100644 --- a/PrimaryFormParts/PrimaryForm.cs +++ b/PrimaryFormParts/PrimaryForm.cs @@ -6,6 +6,9 @@ using System.Text.RegularExpressions; using DBObj; using OverlayFormObj; using Timer = System.Windows.Forms.Timer; +using IniParser.Model; +using IniParser; +using System.Text; namespace DualScreenDemo { @@ -465,7 +468,9 @@ namespace DualScreenDemo string selectedTheme = ReadSelectedThemePath(); if (!string.IsNullOrEmpty(selectedTheme)) { - string backgroundImagePath = Path.Combine(Application.StartupPath, "themes\\superstar\\主畫面\\0.下方選單_主畫面.jpg"); + var data = LoadConfigData(); + + string backgroundImagePath = Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\主畫面\\0.下方選單_主畫面.jpg"); try { using (Image originalImage = Image.FromFile(backgroundImagePath)) @@ -996,6 +1001,8 @@ namespace DualScreenDemo #region 主畫面按鈕設定 private void InitializeOtherControls() { + var data = LoadConfigData(); + InitializeButton(ref newSongAlertButton, ref newSongAlertNormalBackground, ref newSongAlertActiveBackground, "newSongAlertButton", 20, 98, 105, 120, "themes\\superstar\\button\\1.主類別\\主類別上方_新歌快報(未按).png", NewSongAlertButton_Click); InitializeButton(ref hotPlayButton, ref hotPlayNormalBackground, ref hotPlayActiveBackground, "hotPlayButton", 137, 98, 106, 120, "themes\\superstar\\button\\1.主類別\\主類別上方_熱門排行(未按).png", HotPlayButton_Click); @@ -1013,9 +1020,9 @@ namespace DualScreenDemo serviceBellButton = new Button { Text = "" }; ConfigureButton(serviceBellButton, 843, 98, 107, 120, - new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別上方_服務鈴(未按).png")), - new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別上方_服務鈴(未按).png")), - new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別上方_服務鈴(已按).png")), + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\1.主類別\\主類別上方_服務鈴(未按).png")), + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\1.主類別\\主類別上方_服務鈴(未按).png")), + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\1.主類別\\主類別上方_服務鈴(已按).png")), (sender, e) => OnServiceBellButtonClick(sender, e)); @@ -1031,72 +1038,72 @@ namespace DualScreenDemo mobileSongRequestButton = new Button { Text = "" }; mobileSongRequestButton.Name = "mobileSongRequestButton"; ConfigureButton(mobileSongRequestButton, 1198, 629, 223, 88, - new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別上方_手機點歌.png")), - new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別上方_手機點歌.png")), - new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別上方_手機點歌.png")), + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\1.主類別\\主類別上方_手機點歌.png")), + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\1.主類別\\主類別上方_手機點歌.png")), + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\1.主類別\\主類別上方_手機點歌.png")), MobileSongRequestButton_Click); qieGeButton = new Button { Text = "" }; qieGeButton.Name = "qieGeButton"; ConfigureButton(qieGeButton, 20, 738, 92, 147, - new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別下方_切歌.png")), - new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別下方_切歌.png")), - new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別下方_切歌.png")), + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\1.主類別\\主類別下方_切歌.png")), + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\1.主類別\\主類別下方_切歌.png")), + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\1.主類別\\主類別下方_切歌.png")), (sender, e) => videoPlayerForm.PlayNextSong()); musicUpButton = new Button { Text = "" }; musicUpButton.Name = "musicUpButton"; ConfigureButton(musicUpButton, 128, 738, 93, 62, - new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別下方_音樂+.png")), - new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別下方_音樂+.png")), - new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\音樂及麥克風icon_音樂++.png")), + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\1.主類別\\主類別下方_音樂+.png")), + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\1.主類別\\主類別下方_音樂+.png")), + new Bitmap(Path.Combine(data["ImageSrc"]["path"] , "themes\\superstar\\button\\1.主類別\\音樂及麥克風icon_音樂++.png")), (sender, e) => { OverlayForm.MainForm.ShowTopRightLabel("音量 ↑", "a2 b3 a4"); }); musicDownButton = new Button { Text = "" }; musicDownButton.Name = "musicDownButton"; ConfigureButton(musicDownButton, 128, 823, 93, 62, - new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別下方_音樂-.png")), - new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別下方_音樂-.png")), - new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\音樂及麥克風icon_音樂--.png")), + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\1.主類別\\主類別下方_音樂-.png")), + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\1.主類別\\主類別下方_音樂-.png")), + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\1.主類別\\音樂及麥克風icon_音樂--.png")), (sender, e) => { OverlayForm.MainForm.ShowTopRightLabel("音量 ↓", "a2 b4 a4"); }); micUpButton = new Button { Text = "" }; micUpButton.Name = "micUpButton"; ConfigureButton(micUpButton, 238, 738, 93, 62, - new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別下方_麥克風+.png")), - new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別下方_麥克風+.png")), - new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\音樂及麥克風icon_麥克風++.png")), + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\1.主類別\\主類別下方_麥克風+.png")), + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\1.主類別\\主類別下方_麥克風+.png")), + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\1.主類別\\音樂及麥克風icon_麥克風++.png")), (sender, e) => { OverlayForm.MainForm.ShowTopRightLabel("麥克風 ↑", "a2 b5 a4"); }); micDownButton = new Button { Text = "" }; micDownButton.Name = "micDownButton"; ConfigureButton(micDownButton, 238, 823, 93, 62, - new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別下方_麥克風-.png")), - new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別下方_麥克風-.png")), - new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\音樂及麥克風icon_麥克風--.png")), + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\1.主類別\\主類別下方_麥克風-.png")), + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\1.主類別\\主類別下方_麥克風-.png")), + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\1.主類別\\音樂及麥克風icon_麥克風--.png")), (sender, e) => { OverlayForm.MainForm.ShowTopRightLabel("麥克風 ↓", "a2 b6 a4"); }); originalSongButton = new Button { Text = "" }; originalSongButton.Name = "originalSongButton"; ConfigureButton(originalSongButton, 347, 738, 93, 62, - new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別下方_原唱.png")), - new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別下方_原唱.png")), - new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別下方_原唱.png")), + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\1.主類別\\主類別下方_原唱.png")), + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\1.主類別\\主類別下方_原唱.png")), + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\1.主類別\\主類別下方_原唱.png")), OriginalSongButton_Click); replayButton = new Button { Text = "" }; replayButton.Name = "replayButton"; ConfigureButton(replayButton, 347, 823, 93, 62, - new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別下方_重唱.png")), - new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別下方_重唱.png")), - new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別下方_重唱.png")), + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\1.主類別\\主類別下方_重唱.png")), + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\1.主類別\\主類別下方_重唱.png")), + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\1.主類別\\主類別下方_重唱.png")), ReplayButton_Click); @@ -1104,9 +1111,9 @@ namespace DualScreenDemo Text = "", Name = "pauseButton" }; ConfigureButton(pauseButton, 456, 738, 93, 62, - new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別下方_暫停.png")), - new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別下方_暫停.png")), - new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別下方_暫停.png")), + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\1.主類別\\主類別下方_暫停.png")), + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\1.主類別\\主類別下方_暫停.png")), + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\1.主類別\\主類別下方_暫停.png")), PauseButton_Click); @@ -1117,144 +1124,144 @@ namespace DualScreenDemo Visible = false }; ConfigureButton(playButton, 456, 738, 93, 62, - new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別下方_暫停.png")), - new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別下方_暫停.png")), - new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別下方_暫停.png")), + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\1.主類別\\主類別下方_暫停.png")), + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\1.主類別\\主類別下方_暫停.png")), + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\1.主類別\\主類別下方_暫停.png")), PlayButton_Click); muteButton = new Button { Text = "" }; muteButton.Name = "muteButton"; ConfigureButton(muteButton, 456, 823, 93, 62, - new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別下方_靜音.png")), - new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別下方_靜音.png")), - new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別下方_靜音.png")), + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\1.主類別\\主類別下方_靜音.png")), + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\1.主類別\\主類別下方_靜音.png")), + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\1.主類別\\主類別下方_靜音.png")), MuteUnmuteButton_Click); maleKeyButton = new Button { Text = "" }; maleKeyButton.Name = "maleKeyButton"; ConfigureButton(maleKeyButton, 564, 738, 93, 62, - new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別下方_男調.png")), - new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別下方_男調.png")), - new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別下方_男調.png")), + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\1.主類別\\主類別下方_男調.png")), + new Bitmap(Path.Combine(data["ImageSrc"]["path"] , "themes\\superstar\\button\\1.主類別\\主類別下方_男調.png")), + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\1.主類別\\主類別下方_男調.png")), MaleKeyButton_Click); femaleKeyButton = new Button { Text = "" }; femaleKeyButton.Name = "femaleKeyButton"; ConfigureButton(femaleKeyButton, 565, 823, 93, 62, - new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別下方_女調.png")), - new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別下方_女調.png")), - new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別下方_女調.png")), + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\1.主類別\\主類別下方_女調.png")), + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\1.主類別\\主類別下方_女調.png")), + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\1.主類別\\主類別下方_女調.png")), FemaleKeyButton_Click); standardKeyButton = new Button { Text = "" }; standardKeyButton.Name = "standardKeyButton"; ConfigureButton(standardKeyButton, 674, 738, 93, 62, - new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別下方_標準調.png")), - new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別下方_標準調.png")), - new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別下方_標準調.png")), + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\1.主類別\\主類別下方_標準調.png")), + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\1.主類別\\主類別下方_標準調.png")), + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\1.主類別\\主類別下方_標準調.png")), StandardKeyButton_Click); soundEffectButton = new Button { Text = "" }; soundEffectButton.Name = "soundEffectButton"; ConfigureButton(soundEffectButton, 674, 823, 93, 62, - new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別下方_音效.png")), - new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別下方_音效.png")), - new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別下方_音效.png")), + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\1.主類別\\主類別下方_音效.png")), + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\1.主類別\\主類別下方_音效.png")), + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\1.主類別\\主類別下方_音效.png")), SoundEffectButton_Click); pitchUpButton = new Button { Text = "" }; pitchUpButton.Name = "pitchUpButton"; ConfigureButton(pitchUpButton, 784, 738, 93, 62, - new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別下方_升調.png")), - new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別下方_升調.png")), - new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別下方_升調.png")), + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\1.主類別\\主類別下方_升調.png")), + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\1.主類別\\主類別下方_升調.png")), + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\1.主類別\\主類別下方_升調.png")), PitchUpButton_Click); pitchDownButton = new Button { Text = "" }; pitchDownButton.Name = "pitchDownButton"; ConfigureButton(pitchDownButton, 784, 823, 93, 62, - new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別下方_降調.png")), - new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別下方_降調.png")), - new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別下方_降調.png")), + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\1.主類別\\主類別下方_降調.png")), + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\1.主類別\\主類別下方_降調.png")), + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\1.主類別\\主類別下方_降調.png")), PitchDownButton_Click); syncScreenButton = new Button { Text = "" }; syncScreenButton.Name = "syncScreenButton"; ConfigureButton(syncScreenButton, 893, 736, 92, 149, - new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別下方_同步畫面.png")), - new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別下方_同步畫面.png")), - new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別下方_同步畫面.png")), + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\1.主類別\\主類別下方_同步畫面.png")), + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\1.主類別\\主類別下方_同步畫面.png")), + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\1.主類別\\主類別下方_同步畫面.png")), SyncScreenButton_Click); toggleLightButton = new Button { Text = "" }; toggleLightButton.Name = "toggleLightButton"; ConfigureButton(toggleLightButton, 1002, 736, 92, 149, - new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別下方_燈光控制.png")), - new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別下方_燈光控制.png")), - new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別下方_燈光控制.png")), + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\1.主類別\\主類別下方_燈光控制.png")), + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\1.主類別\\主類別下方_燈光控制.png")), + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\1.主類別\\主類別下方_燈光控制.png")), ToggleLightButton_Click); btnPreviousPage = new Button { Text = "" }; btnPreviousPage.Name = "btnPreviousPageButton"; ConfigureButton(btnPreviousPage, 1110, 738, 93, 62, - new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別下方_上一頁.png")), - new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別下方_上一頁.png")), - new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別下方_上一頁.png")), + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\1.主類別\\主類別下方_上一頁.png")), + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\1.主類別\\主類別下方_上一頁.png")), + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\1.主類別\\主類別下方_上一頁.png")), PreviousPageButton_Click); btnReturn = new Button { Text = "" }; btnReturn.Name = "btnReturn"; ConfigureButton(btnReturn, 1220, 738, 93, 62, - new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別下方_退出.png")), - new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別下方_退出.png")), - new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別下方_退出.png")), + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\1.主類別\\主類別下方_退出.png")), + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\1.主類別\\主類別下方_退出.png")), + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\1.主類別\\主類別下方_退出.png")), ShouYeButton_Click); btnNextPage = new Button { Text = "" }; btnNextPage.Name = "btnNextPage"; ConfigureButton(btnNextPage, 1330, 738, 93, 62, - new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別下方_下一頁.png")), - new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別下方_下一頁.png")), - new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別下方_下一頁.png")), + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\1.主類別\\主類別下方_下一頁.png")), + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\1.主類別\\主類別下方_下一頁.png")), + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\1.主類別\\主類別下方_下一頁.png")), NextPageButton_Click); btnApplause = new Button { Text = "" }; btnApplause.Name = "btnApplause"; ConfigureButton(btnApplause, 1110, 823, 93, 62, - new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別下方_掌聲.png")), - new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別下方_掌聲.png")), - new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別下方_掌聲.png")), + new Bitmap(Path.Combine(data["ImageSrc"]["path"] , "themes\\superstar\\button\\1.主類別\\主類別下方_掌聲.png")), + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\1.主類別\\主類別下方_掌聲.png")), + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\1.主類別\\主類別下方_掌聲.png")), ApplauseButton_Click); btnSimplifiedChinese = new Button { Text = "" }; btnSimplifiedChinese.Name = "btnSimplifiedChinese"; ConfigureButton(btnSimplifiedChinese, 1330, 823, 93, 62, - new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別下方_簡體.png")), - new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別下方_簡體.png")), - new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別下方_簡體.png")), + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\1.主類別\\主類別下方_簡體.png")), + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\1.主類別\\主類別下方_簡體.png")), + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\1.主類別\\主類別下方_簡體.png")), SimplifiedChineseButton_Click); btnTraditionalChinese = new Button { Text = "" }; btnTraditionalChinese.Name = "btnTraditionalChinese"; ConfigureButton(btnTraditionalChinese, 1220, 823, 93, 62, - new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別下方_繁體.png")), - new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別下方_繁體.png")), - new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別下方_繁體.png")), + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\1.主類別\\主類別下方_繁體.png")), + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\1.主類別\\主類別下方_繁體.png")), + new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\1.主類別\\主類別下方_繁體.png")), TraditionalChineseButton_Click); /* 關閉應用程式按鈕*/ @@ -1269,10 +1276,12 @@ namespace DualScreenDemo private void InitializeButton(ref Button button, ref Bitmap normalBackground, ref Bitmap activeBackground, string buttonName, int x, int y, int width, int height, string imagePath, EventHandler clickEventHandler) { + var data = LoadConfigData(); + button = new Button { Text = "", Name = buttonName }; ResizeAndPositionButton(button, x, y, width, height); Rectangle buttonCropArea = new Rectangle(x, y, width, height); - normalBackground = new Bitmap(Path.Combine(Application.StartupPath, imagePath)); + normalBackground = new Bitmap(Path.Combine(data["ImageSrc"]["path"], imagePath)); activeBackground = mouseDownImage.Clone(buttonCropArea, mouseDownImage.PixelFormat); button.BackgroundImage = normalBackground; button.BackgroundImageLayout = ImageLayout.Stretch; @@ -1285,31 +1294,7 @@ namespace DualScreenDemo this.Controls.Add(button); } - private void InitializeButton( - ref Button button, - string buttonName, - int x, int y, - int width, int height, - Rectangle cropArea, - Bitmap normalStateImage, - EventHandler clickEventHandler) - { - button = new Button { Text = "", Name = buttonName }; - ResizeAndPositionButton(button, x, y, width, height); - //button.BackgroundImage = normalStateImage.Clone(cropArea, normalStateImage.PixelFormat); - button.BackgroundImage = normalStateImage; - //button.BackColor = Color.Transparent; - button.BackgroundImageLayout = ImageLayout.Stretch; - button.FlatStyle = FlatStyle.Flat; - button.FlatAppearance.BorderSize = 0; - //button.FlatAppearance.MouseOverBackColor = Color.Transparent; - //button.FlatAppearance.MouseDownBackColor = Color.Transparent; - if (clickEventHandler != null) - { - button.Click += clickEventHandler; - } - this.Controls.Add(button); - } + private void InitializeMultiPagePanel() { // 獲取螢幕尺寸 @@ -1340,6 +1325,7 @@ namespace DualScreenDemo public void Label_Click(object sender, EventArgs e) { + var data = LoadConfigData(); var label = sender as Label; if (label != null && label.Tag is SongData) { @@ -1348,7 +1334,7 @@ namespace DualScreenDemo this.DoubleBuffered = true; this.SuspendLayout(); - DrawTextOnVodScreenPictureBox(Path.Combine(Application.StartupPath, @"themes\superstar\button\3.介面\歌曲點播_空白介面.png"), currentSelectedSong); + DrawTextOnVodScreenPictureBox(Path.Combine(data["ImageSrc"]["path"], @"themes\superstar\button\3.介面\歌曲點播_空白介面.png"), currentSelectedSong); SetVodScreenPictureBoxAndButtonsVisibility(true); this.ResumeLayout(true); } @@ -1425,88 +1411,89 @@ namespace DualScreenDemo private void LoadImages() { + var data = LoadConfigData(); string selectedThemePath = ReadSelectedThemePath(); - string basePath = Path.Combine(Application.StartupPath, selectedThemePath); + string basePath = Path.Combine(data["ImageSrc"]["path"], selectedThemePath); int targetWidth = System.Windows.Forms.Screen.PrimaryScreen.Bounds.Width; int targetHeight = System.Windows.Forms.Screen.PrimaryScreen.Bounds.Height; - normalStateImage = new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\主畫面\\0.下方選單_主畫面.jpg")); + normalStateImage = new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\主畫面\\0.下方選單_主畫面.jpg")); resizedNormalStateImage = ResizeImage(normalStateImage, targetWidth, targetHeight); - mouseOverImage = new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\主畫面\\0.主選單_已按.jpg")); + mouseOverImage = new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\主畫面\\0.主選單_已按.jpg")); resizedMouseOverImage = ResizeImage(mouseOverImage, targetWidth, targetHeight); - mouseDownImage = new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\主畫面\\0.主選單_已按.jpg")); + mouseDownImage = new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\主畫面\\0.主選單_已按.jpg")); resizedMouseDownImage = ResizeImage(mouseDownImage, targetWidth, targetHeight); - normalStateImageNewSongAlert = new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\主畫面\\1.新歌快報_未按.jpg")); + normalStateImageNewSongAlert = new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\主畫面\\1.新歌快報_未按.jpg")); resizedNormalStateImageForNewSongAlert = ResizeImage(normalStateImageNewSongAlert, targetWidth, targetHeight); - mouseOverImageNewSongAlert = new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\主畫面\\1.新歌快報_已按.jpg")); + mouseOverImageNewSongAlert = new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\主畫面\\1.新歌快報_已按.jpg")); resizedMouseOverImageForNewSongAlert = ResizeImage(mouseOverImageNewSongAlert, targetWidth, targetHeight); - mouseDownImageNewSongAlert = new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\主畫面\\1.新歌快報_已按.jpg")); + mouseDownImageNewSongAlert = new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\主畫面\\1.新歌快報_已按.jpg")); resizedMouseDownImageForNewSongAlert = ResizeImage(mouseDownImageNewSongAlert, targetWidth, targetHeight); - normalStateImageArtistQuery = new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\主畫面\\3.歌星查詢_未按.jpg")); + normalStateImageArtistQuery = new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\主畫面\\3.歌星查詢_未按.jpg")); resizedNormalStateImageForArtistQuery = ResizeImage(normalStateImageArtistQuery, targetWidth, targetHeight); - mouseOverImageArtistQuery = new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\主畫面\\3.歌星查詢_已按.jpg")); + mouseOverImageArtistQuery = new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\主畫面\\3.歌星查詢_已按.jpg")); resizedMouseOverImageForArtistQuery = ResizeImage(mouseOverImageArtistQuery, targetWidth, targetHeight); - mouseDownImageArtistQuery = new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\主畫面\\3.歌星查詢_已按.jpg")); + mouseDownImageArtistQuery = new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\主畫面\\3.歌星查詢_已按.jpg")); resizedMouseDownImageForArtistQuery = ResizeImage(mouseDownImageArtistQuery, targetWidth, targetHeight); - normalStateImageSongQuery = new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\主畫面\\4.歌名查詢_未按.jpg")); + normalStateImageSongQuery = new Bitmap(Path.Combine(data["ImageSrc"]["path"] , "themes\\superstar\\主畫面\\4.歌名查詢_未按.jpg")); resizedNormalStateImageForSongQuery = ResizeImage(normalStateImageSongQuery, targetWidth, targetHeight); - mouseOverImageSongQuery = new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\主畫面\\4.歌名查詢_已按.jpg")); + mouseOverImageSongQuery = new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\主畫面\\4.歌名查詢_已按.jpg")); resizedMouseOverImageForSongQuery = ResizeImage(mouseOverImageSongQuery, targetWidth, targetHeight); - mouseDownImageSongQuery = new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\主畫面\\4.歌名查詢_已按.jpg")); + mouseDownImageSongQuery = new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\主畫面\\4.歌名查詢_已按.jpg")); resizedMouseDownImageForSongQuery = ResizeImage(mouseDownImageSongQuery, targetWidth, targetHeight); - normalStateImageLanguageQuery = new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\主畫面\\5.語別查詢_未按.jpg")); + normalStateImageLanguageQuery = new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\主畫面\\5.語別查詢_未按.jpg")); resizedNormalStateImageForLanguageQuery = ResizeImage(normalStateImageLanguageQuery, targetWidth, targetHeight); - mouseOverImageLanguageQuery = new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\主畫面\\5.語別查詢_已按.jpg")); + mouseOverImageLanguageQuery = new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\主畫面\\5.語別查詢_已按.jpg")); resizedMouseOverImageForLanguageQuery = ResizeImage(mouseOverImageLanguageQuery, targetWidth, targetHeight); - mouseDownImageLanguageQuery = new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\主畫面\\5.語別查詢_已按.jpg")); + mouseDownImageLanguageQuery = new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\主畫面\\5.語別查詢_已按.jpg")); resizedMouseDownImageForLanguageQuery = ResizeImage(mouseDownImageLanguageQuery, targetWidth, targetHeight); - normalStateImageCategoryQuery = new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\主畫面\\7.類別查詢_未按.jpg")); + normalStateImageCategoryQuery = new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\主畫面\\7.類別查詢_未按.jpg")); resizedNormalStateImageForCategoryQuery = ResizeImage(normalStateImageCategoryQuery, targetWidth, targetHeight); - mouseOverImageCategoryQuery = new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\主畫面\\7.類別查詢_已按.jpg")); + mouseOverImageCategoryQuery = new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\主畫面\\7.類別查詢_已按.jpg")); resizedMouseOverImageForCategoryQuery = ResizeImage(mouseOverImageCategoryQuery, targetWidth, targetHeight); - mouseDownImageCategoryQuery = new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\主畫面\\7.類別查詢_已按.jpg")); + mouseDownImageCategoryQuery = new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\主畫面\\7.類別查詢_已按.jpg")); resizedMouseDownImageForCategoryQuery = ResizeImage(mouseDownImageCategoryQuery, targetWidth, targetHeight); - normalStateImageForPromotionsAndMenu = new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\主畫面\\555021.jpg")); + normalStateImageForPromotionsAndMenu = new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\主畫面\\555021.jpg")); resizedNormalStateImageForPromotionsAndMenu = ResizeImage(normalStateImageForPromotionsAndMenu, targetWidth, targetHeight); try { - string imagePath = Path.Combine(Application.StartupPath, "themes\\superstar\\主畫面\\選單內介面_同步畫面.jpg"); + string imagePath = Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\主畫面\\選單內介面_同步畫面.jpg"); if (File.Exists(imagePath)) { @@ -1526,17 +1513,17 @@ namespace DualScreenDemo } - normalStateImageForSceneSoundEffects = new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\主畫面\\555022.jpg")); + normalStateImageForSceneSoundEffects = new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\主畫面\\555022.jpg")); resizedNormalStateImageForSceneSoundEffects = ResizeImage(normalStateImageForSceneSoundEffects, targetWidth, targetHeight); - normalStateImageHotSong = new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\主畫面\\2.熱門排行_未按.jpg")); + normalStateImageHotSong = new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\主畫面\\2.熱門排行_未按.jpg")); resizedNormalStateImageForHotSong = ResizeImage(normalStateImageHotSong, targetWidth, targetHeight); - mouseDownImageHotSong = new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\主畫面\\2.熱門排行_已按.jpg")); + mouseDownImageHotSong = new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\主畫面\\2.熱門排行_已按.jpg")); resizedMouseDownImageForHotSong = ResizeImage(mouseDownImageHotSong, targetWidth, targetHeight); - normalStateImageForLightControl = new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\主畫面\\選單內介面_燈光控制.jpg")); + normalStateImageForLightControl = new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\主畫面\\選單內介面_燈光控制.jpg")); resizedNormalStateImageForLightControl = ResizeImage(normalStateImageForLightControl, targetWidth, targetHeight); } @@ -1669,6 +1656,8 @@ namespace DualScreenDemo private void DeliciousFoodButton_Click(object sender, EventArgs e) { + var data = LoadConfigData(); + newSongAlertButton.BackgroundImage = newSongAlertNormalBackground; hotPlayButton.BackgroundImage = hotPlayNormalBackground; singerSearchButton.BackgroundImage = singerSearchNormalBackground; @@ -1679,7 +1668,7 @@ namespace DualScreenDemo orderedSongsButton.BackgroundImage = orderedSongsNormalBackground; myFavoritesButton.BackgroundImage = myFavoritesNormalBackground; promotionsButton.BackgroundImage = promotionsNormalBackground; - deliciousFoodButton.BackgroundImage = new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別上方_美味菜單(已按).png")); + deliciousFoodButton.BackgroundImage = new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\1.主類別\\主類別上方_美味菜單(已按).png")); isOnOrderedSongsPage = false; SetHotSongButtonsVisibility(false); @@ -1872,11 +1861,11 @@ namespace DualScreenDemo private void MuteUnmuteButton_Click(object sender, EventArgs e) { - SetHotSongButtonsVisibility(false); - SetNewSongButtonsVisibility(false); - SetSingerSearchButtonsVisibility(false); - SetSongSearchButtonsVisibility(false); - SetPictureBoxToggleLightAndButtonsVisibility(false); + //SetHotSongButtonsVisibility(false); + //SetNewSongButtonsVisibility(false); + //SetSingerSearchButtonsVisibility(false); + //SetSongSearchButtonsVisibility(false); + //SetPictureBoxToggleLightAndButtonsVisibility(false); if (videoPlayerForm.isMuted) { @@ -2157,9 +2146,11 @@ namespace DualScreenDemo // 添加載入按鈕圖片的方法 private Image LoadButtonImage(string imageName) { + var data = LoadConfigData(); + try { - string filePath = Path.Combine(Application.StartupPath, "themes", "superstar", "ButtonImages", imageName); + string filePath = Path.Combine(data["ImageSrc"]["path"], "themes", "superstar", "ButtonImages", imageName); if (File.Exists(filePath)) { return Image.FromFile(filePath); @@ -2179,9 +2170,11 @@ namespace DualScreenDemo /// private Image LoadSendOffImage() { + var data = LoadConfigData(); + try { - string filePath = Path.Combine(Application.StartupPath, "themes\\superstar\\主畫面\\選單內介面_送客畫面.jpg"); + string filePath = Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\主畫面\\選單內介面_送客畫面.jpg"); if (File.Exists(filePath)) { return Image.FromFile(filePath); @@ -2224,6 +2217,8 @@ namespace DualScreenDemo private void OrderedSongsButton_Click(object sender, EventArgs e) { + var data= LoadConfigData(); + newSongAlertButton.BackgroundImage = newSongAlertNormalBackground; hotPlayButton.BackgroundImage = hotPlayNormalBackground; singerSearchButton.BackgroundImage = singerSearchNormalBackground; @@ -2231,7 +2226,7 @@ namespace DualScreenDemo languageSearchButton.BackgroundImage = languageSearchNormalBackground; groupSearchButton.BackgroundImage = groupSearchNormalBackground; categorySearchButton.BackgroundImage = categorySearchNormalBackground; - orderedSongsButton.BackgroundImage = new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別上方_已點歌曲(已按).png")); + orderedSongsButton.BackgroundImage = new Bitmap(Path.Combine(data["ImageSrc"]["path"], "themes\\superstar\\button\\1.主類別\\主類別上方_已點歌曲(已按).png")); myFavoritesButton.BackgroundImage = myFavoritesNormalBackground; promotionsButton.BackgroundImage = promotionsNormalBackground; deliciousFoodButton.BackgroundImage = deliciousFoodNormalBackground; @@ -2268,6 +2263,7 @@ namespace DualScreenDemo multiPagePanel.LoadPlayedSongs(List); } + #region 控制項Visible屬性設定 private void SetUIVisible(Control parent) { foreach (Control ctrl in parent.Controls) @@ -2295,5 +2291,25 @@ namespace DualScreenDemo } } } + #endregion + + + /// + /// 從設定檔 (config.ini) 載入 INI 設定數據。 + /// + /// 回傳解析後的 INI 設定數據 (IniData)。 + private IniData LoadConfigData() + { + var parser = new FileIniDataParser(); + string iniFilePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "config.ini"); + + + // 使用 UTF-8 讀取 INI 檔案並解析內容 + using (var reader = new StreamReader(iniFilePath, Encoding.UTF8)) + { + return parser.ReadData(reader); + } + } + } } \ No newline at end of file