diff --git a/Daigassou/App.config b/Daigassou/App.config index 22ca626..86d857c 100644 --- a/Daigassou/App.config +++ b/Daigassou/App.config @@ -16,6 +16,15 @@ False + + 35 + + + 125 + + + ntp3.aliyun.com + diff --git a/Daigassou/Daigassou.csproj b/Daigassou/Daigassou.csproj index 05f3e0a..fa566b3 100644 --- a/Daigassou/Daigassou.csproj +++ b/Daigassou/Daigassou.csproj @@ -129,6 +129,7 @@ + AboutForm.cs diff --git a/Daigassou/Input_Midi/MidiToKey.cs b/Daigassou/Input_Midi/MidiToKey.cs index 9d16c30..ca03e57 100644 --- a/Daigassou/Input_Midi/MidiToKey.cs +++ b/Daigassou/Input_Midi/MidiToKey.cs @@ -64,8 +64,8 @@ public void TrackPlaybackPause() } internal class MidiToKey { - private readonly int MIN_DELAY_TIME_MS_EVENT; - private readonly int MIN_DELAY_TIME_MS_CHORD; + private readonly uint MIN_DELAY_TIME_MS_EVENT; + private readonly uint MIN_DELAY_TIME_MS_CHORD; private readonly List tracks; public int Index = 0; private MidiFile midi; @@ -80,8 +80,8 @@ public MidiToKey() tracks = new List(); Bpm = 80; Offset = EnumPitchOffset.None; - MIN_DELAY_TIME_MS_EVENT = 35; - MIN_DELAY_TIME_MS_CHORD = 120; + MIN_DELAY_TIME_MS_EVENT = Properties.Settings.Default.MinEventMs; + MIN_DELAY_TIME_MS_CHORD = Properties.Settings.Default.MinChordMs; } public EnumPitchOffset Offset { get; set; } diff --git a/Daigassou/MainForm.cs b/Daigassou/MainForm.cs index 9c59f12..24f5ed8 100644 --- a/Daigassou/MainForm.cs +++ b/Daigassou/MainForm.cs @@ -247,7 +247,7 @@ private void button2_Click(object sender, EventArgs e) private void btnTimeSync_Click(object sender, EventArgs e) { double error = 0; - var offset = new NtpClient("ntp3.aliyun.com").GetOffset(out error); + var offset = new NtpClient(Properties.Settings.Default.NtpServer).GetOffset(out error); if (CommonUtilities.SetSystemDateTime.SetLocalTimeByStr( DateTime.Now.AddMilliseconds(offset.TotalMilliseconds * -0.5))) tlblTime.Text = $"已同步 误差{offset.TotalMilliseconds}ms"; diff --git a/Daigassou/Properties/AssemblyInfo.cs b/Daigassou/Properties/AssemblyInfo.cs index c4280cd..58ac168 100644 --- a/Daigassou/Properties/AssemblyInfo.cs +++ b/Daigassou/Properties/AssemblyInfo.cs @@ -8,9 +8,9 @@ [assembly: AssemblyTitle("大合奏!-Daigassou-")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("fairylab.org")] +[assembly: AssemblyCompany("ffxiv.cat")] [assembly: AssemblyProduct("Daigassou")] -[assembly: AssemblyCopyright("Copyright © Y.Morino@Fairylab 2018")] +[assembly: AssemblyCopyright("Copyright © shiro@ffxiv.cat 2018-2019")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] diff --git a/Daigassou/Properties/Settings.Designer.cs b/Daigassou/Properties/Settings.Designer.cs index 1625eec..c27a384 100644 --- a/Daigassou/Properties/Settings.Designer.cs +++ b/Daigassou/Properties/Settings.Designer.cs @@ -12,7 +12,7 @@ namespace Daigassou.Properties { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.6.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.9.0.0")] public sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); @@ -36,7 +36,6 @@ public static Settings Default { [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("0")] public int StartKey { get { return ((int)(this["StartKey"])); @@ -59,7 +58,6 @@ public int StartKey { [global::System.Configuration.UserScopedSettingAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] - [global::System.Configuration.DefaultSettingValueAttribute("False")] public bool IsEightKeyLayout { get { return ((bool)(this["IsEightKeyLayout"])); @@ -79,5 +77,39 @@ public bool IsEightKeyLayout { this["KeyBinding22"] = value; } } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public uint MinEventMs { + get { + return ((uint)(this["MinEventMs"])); + } + set { + this["MinEventMs"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public uint MinChordMs { + get { + return ((uint)(this["MinChordMs"])); + } + set { + this["MinChordMs"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("ntp3.aliyun.com")] + public string NtpServer { + get { + return ((string)(this["NtpServer"])); + } + set { + this["NtpServer"] = value; + } + } } } diff --git a/Daigassou/Properties/Settings.settings b/Daigassou/Properties/Settings.settings index 6d1d582..accc127 100644 --- a/Daigassou/Properties/Settings.settings +++ b/Daigassou/Properties/Settings.settings @@ -2,20 +2,29 @@ - + - + 0 - + - + False - + + + 35 + + + 125 + + + ntp3.aliyun.com + \ No newline at end of file diff --git a/Daigassou/Settings.cs b/Daigassou/Settings.cs new file mode 100644 index 0000000..d2f13d9 --- /dev/null +++ b/Daigassou/Settings.cs @@ -0,0 +1,28 @@ +namespace Daigassou.Properties { + + + // 通过此类可以处理设置类的特定事件: + // 在更改某个设置的值之前将引发 SettingChanging 事件。 + // 在更改某个设置的值之后将引发 PropertyChanged 事件。 + // 在加载设置值之后将引发 SettingsLoaded 事件。 + // 在保存设置值之前将引发 SettingsSaving 事件。 + public sealed partial class Settings { + + public Settings() { + // // 若要为保存和更改设置添加事件处理程序,请取消注释下列行: + // + // this.SettingChanging += this.SettingChangingEventHandler; + // + // this.SettingsSaving += this.SettingsSavingEventHandler; + // + } + + private void SettingChangingEventHandler(object sender, System.Configuration.SettingChangingEventArgs e) { + // 在此处添加用于处理 SettingChangingEvent 事件的代码。 + } + + private void SettingsSavingEventHandler(object sender, System.ComponentModel.CancelEventArgs e) { + // 在此处添加用于处理 SettingsSaving 事件的代码。 + } + } +}