using System.Drawing;\r
using System.IO;\r
using System.Windows.Forms;\r
+using KancolleSniffer.Net;\r
+using KancolleSniffer.View;\r
\r
namespace KancolleSniffer\r
{\r
_main.CheckVersionUp((current, latest) =>\r
{\r
labelVersion.Text = "バージョン" + current;\r
- labelLatest.Text = double.Parse(current) >= double.Parse(latest) ? "最新です" : "最新は" + latest + "です";\r
+ labelLatest.Text = current == latest ? "最新です" : "最新は" + latest + "です";\r
});\r
labelCopyright.Text = FileVersionInfo.GetVersionInfo(Application.ExecutablePath).LegalCopyright;\r
\r
checkBoxResultRank.Checked = (_config.Spoilers & Spoiler.ResultRank) != 0;\r
checkBoxAirBattleResult.Checked = (_config.Spoilers & Spoiler.AirBattleResult) != 0;\r
checkBoxBattleResult.Checked = (_config.Spoilers & Spoiler.BattleResult) != 0;\r
+ checkBoxNextCell.Checked = (_config.Spoilers & Spoiler.NextCell) != 0;\r
checkBoxPresetAkashi.Checked = _config.UsePresetAkashi;\r
\r
numericUpDownSoundVolume.Value = _config.Sounds.Volume;\r
\r
_config.Spoilers = (checkBoxResultRank.Checked ? Spoiler.ResultRank : 0) |\r
(checkBoxAirBattleResult.Checked ? Spoiler.AirBattleResult : 0) |\r
- (checkBoxBattleResult.Checked ? Spoiler.BattleResult : 0);\r
+ (checkBoxBattleResult.Checked ? Spoiler.BattleResult : 0) |\r
+ (checkBoxNextCell.Checked ? Spoiler.NextCell : 0);\r
_config.UsePresetAkashi = checkBoxPresetAkashi.Checked;\r
\r
_config.Sounds.Volume = (int)numericUpDownSoundVolume.Value;\r
foreach (var name in Config.NotificationNames)\r
- _config.Sounds[name] = _soundSettings[name];\r
+ _config.Sounds[name] = MakePathRooted(_soundSettings[name]);\r
}\r
\r
private bool ValidatePorts(out int listen, out int outbound, out int server)\r
{\r
_config.Log.On = checkBoxOutput.Checked;\r
_config.Log.MaterialLogInterval = (int)numericUpDownMaterialLogInterval.Value;\r
- _config.Log.OutputDir = textBoxOutput.Text;\r
+ _config.Log.OutputDir = MakePathRooted(textBoxOutput.Text);\r
_main.ApplyLogSetting();\r
}\r
\r
private void ApplyDebugSettings()\r
{\r
_config.DebugLogging = checkBoxDebugLog.Checked;\r
- _config.DebugLogFile = textBoxDebugLog.Text;\r
+ _config.DebugLogFile = MakePathRooted(textBoxDebugLog.Text);\r
_main.ApplyDebugLogSetting();\r
}\r
\r
+ private string MakePathRooted(string path)\r
+ {\r
+ try\r
+ {\r
+ return string.IsNullOrWhiteSpace(path)\r
+ ? ""\r
+ : Path.IsPathRooted(path)\r
+ ? path\r
+ : Path.Combine(Config.BaseDir, path);\r
+ }\r
+ catch (ArgumentException)\r
+ {\r
+ return "";\r
+ }\r
+ }\r
+\r
private void textBoxSoundFile_TextChanged(object sender, EventArgs e)\r
{\r
_soundSettings[(string)listBoxSoundFile.SelectedItem] = textBoxSoundFile.Text;\r
\r
private void buttonOpenFile_Click(object sender, EventArgs e)\r
{\r
- openSoundFileDialog.FileName = textBoxSoundFile.Text;\r
- openSoundFileDialog.InitialDirectory = String.IsNullOrEmpty(textBoxSoundFile.Text)\r
- ? Config.BaseDir\r
- : Path.GetDirectoryName(textBoxSoundFile.Text) ?? Config.BaseDir;\r
+ SetInitialPath(openSoundFileDialog, textBoxSoundFile.Text);\r
if (openSoundFileDialog.ShowDialog() != DialogResult.OK)\r
return;\r
textBoxSoundFile.Text = openSoundFileDialog.FileName;\r
\r
private void buttonResetAchievement_Click(object sender, EventArgs e)\r
{\r
- _main.ResetAchievemnt();\r
+ _main.ResetAchievement();\r
}\r
\r
private void linkLabelProductName_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)\r
\r
private void buttonDebugLogOpenFile_Click(object sender, EventArgs e)\r
{\r
- openDebugLogDialog.FileName = textBoxDebugLog.Text;\r
- openDebugLogDialog.InitialDirectory = Path.GetDirectoryName(textBoxDebugLog.Text);\r
+ SetInitialPath(openDebugLogDialog, textBoxDebugLog.Text);\r
if (openDebugLogDialog.ShowDialog(this) == DialogResult.OK)\r
textBoxDebugLog.Text = openDebugLogDialog.FileName;\r
textBoxDebugLog.Select(textBoxDebugLog.Text.Length, 0);\r
}\r
\r
+ private void SetInitialPath(OpenFileDialog dialog, string path)\r
+ {\r
+ var dir = Config.BaseDir;\r
+ var file = "";\r
+ if (!string.IsNullOrWhiteSpace(path))\r
+ {\r
+ var res = Path.GetDirectoryName(path);\r
+ if (res == null) // root\r
+ {\r
+ dir = path;\r
+ }\r
+ else if (res != "") // contain directory\r
+ {\r
+ dir = res;\r
+ file = Path.GetFileName(path);\r
+ }\r
+ else\r
+ {\r
+ file = path;\r
+ }\r
+ }\r
+ dialog.InitialDirectory = dir;\r
+ dialog.FileName = file;\r
+ }\r
+\r
private void buttonPlayDebugLog_Click(object sender, EventArgs e)\r
{\r
_main.SetPlayLog(textBoxDebugLog.Text);\r