diff --git a/DereTore.Applications.ScoreEditor/Forms/FEditNote.Designer.cs b/DereTore.Applications.ScoreEditor/Forms/FEditNote.Designer.cs deleted file mode 100644 index 52bb9a3..0000000 --- a/DereTore.Applications.ScoreEditor/Forms/FEditNote.Designer.cs +++ /dev/null @@ -1,168 +0,0 @@ -namespace DereTore.Applications.ScoreEditor.Forms { - partial class FEditNote { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) { - if (disposing && (components != null)) { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() { - this.label1 = new System.Windows.Forms.Label(); - this.label3 = new System.Windows.Forms.Label(); - this.label2 = new System.Windows.Forms.Label(); - this.cboNoteStartPos = new System.Windows.Forms.ComboBox(); - this.cboNoteFinishPos = new System.Windows.Forms.ComboBox(); - this.btnOK = new System.Windows.Forms.Button(); - this.btnCancel = new System.Windows.Forms.Button(); - this.txtNoteTiming = new System.Windows.Forms.TextBox(); - this.btnTimingAdd = new System.Windows.Forms.Button(); - this.btnTimingSubtract = new System.Windows.Forms.Button(); - this.SuspendLayout(); - // - // label1 - // - this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(12, 32); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(71, 12); - this.label1.TabIndex = 0; - this.label1.Text = "Timing (s):"; - // - // label3 - // - this.label3.AutoSize = true; - this.label3.Location = new System.Drawing.Point(12, 85); - this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size(71, 12); - this.label3.TabIndex = 2; - this.label3.Text = "Finish Pos:"; - // - // label2 - // - this.label2.AutoSize = true; - this.label2.Location = new System.Drawing.Point(12, 59); - this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(65, 12); - this.label2.TabIndex = 1; - this.label2.Text = "Start Pos:"; - // - // cboNoteStartPos - // - this.cboNoteStartPos.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this.cboNoteStartPos.FormattingEnabled = true; - this.cboNoteStartPos.Location = new System.Drawing.Point(89, 56); - this.cboNoteStartPos.Name = "cboNoteStartPos"; - this.cboNoteStartPos.Size = new System.Drawing.Size(143, 20); - this.cboNoteStartPos.TabIndex = 4; - // - // cboNoteFinishPos - // - this.cboNoteFinishPos.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this.cboNoteFinishPos.FormattingEnabled = true; - this.cboNoteFinishPos.Location = new System.Drawing.Point(89, 82); - this.cboNoteFinishPos.Name = "cboNoteFinishPos"; - this.cboNoteFinishPos.Size = new System.Drawing.Size(143, 20); - this.cboNoteFinishPos.TabIndex = 5; - // - // btnOK - // - this.btnOK.Location = new System.Drawing.Point(62, 129); - this.btnOK.Name = "btnOK"; - this.btnOK.Size = new System.Drawing.Size(82, 27); - this.btnOK.TabIndex = 6; - this.btnOK.Text = "OK"; - this.btnOK.UseVisualStyleBackColor = true; - // - // btnCancel - // - this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; - this.btnCancel.Location = new System.Drawing.Point(150, 129); - this.btnCancel.Name = "btnCancel"; - this.btnCancel.Size = new System.Drawing.Size(82, 27); - this.btnCancel.TabIndex = 7; - this.btnCancel.Text = "Cancel"; - this.btnCancel.UseVisualStyleBackColor = true; - // - // txtNoteTiming - // - this.txtNoteTiming.Location = new System.Drawing.Point(89, 29); - this.txtNoteTiming.Name = "txtNoteTiming"; - this.txtNoteTiming.Size = new System.Drawing.Size(94, 21); - this.txtNoteTiming.TabIndex = 8; - // - // btnTimingAdd - // - this.btnTimingAdd.Location = new System.Drawing.Point(189, 28); - this.btnTimingAdd.Name = "btnTimingAdd"; - this.btnTimingAdd.Size = new System.Drawing.Size(20, 20); - this.btnTimingAdd.TabIndex = 9; - this.btnTimingAdd.Text = "+"; - this.btnTimingAdd.UseVisualStyleBackColor = true; - // - // btnTimingSubtract - // - this.btnTimingSubtract.Location = new System.Drawing.Point(212, 28); - this.btnTimingSubtract.Name = "btnTimingSubtract"; - this.btnTimingSubtract.Size = new System.Drawing.Size(20, 20); - this.btnTimingSubtract.TabIndex = 10; - this.btnTimingSubtract.Text = "-"; - this.btnTimingSubtract.UseVisualStyleBackColor = true; - // - // FEditNote - // - this.AcceptButton = this.btnOK; - this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi; - this.CancelButton = this.btnCancel; - this.ClientSize = new System.Drawing.Size(250, 172); - this.Controls.Add(this.btnTimingSubtract); - this.Controls.Add(this.btnTimingAdd); - this.Controls.Add(this.txtNoteTiming); - this.Controls.Add(this.btnCancel); - this.Controls.Add(this.btnOK); - this.Controls.Add(this.cboNoteFinishPos); - this.Controls.Add(this.cboNoteStartPos); - this.Controls.Add(this.label3); - this.Controls.Add(this.label2); - this.Controls.Add(this.label1); - this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; - this.MaximizeBox = false; - this.MinimizeBox = false; - this.Name = "FEditNote"; - this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; - this.Text = "Create Note"; - this.ResumeLayout(false); - this.PerformLayout(); - - } - - #endregion - - private System.Windows.Forms.Label label1; - private System.Windows.Forms.Label label3; - private System.Windows.Forms.Label label2; - private System.Windows.Forms.ComboBox cboNoteStartPos; - private System.Windows.Forms.ComboBox cboNoteFinishPos; - private System.Windows.Forms.Button btnOK; - private System.Windows.Forms.Button btnCancel; - private System.Windows.Forms.TextBox txtNoteTiming; - private System.Windows.Forms.Button btnTimingAdd; - private System.Windows.Forms.Button btnTimingSubtract; - } -} \ No newline at end of file diff --git a/DereTore.Applications.ScoreEditor/Forms/FEditNote.cs b/DereTore.Applications.ScoreEditor/Forms/FEditNote.cs deleted file mode 100644 index ece1fd3..0000000 --- a/DereTore.Applications.ScoreEditor/Forms/FEditNote.cs +++ /dev/null @@ -1,205 +0,0 @@ -using System; -using System.Globalization; -using System.Linq; -using System.Windows.Forms; -using DereTore.Applications.ScoreEditor.Model; - -namespace DereTore.Applications.ScoreEditor.Forms { - public partial class FEditNote : Form { - - ~FEditNote() { - UnregisterEventHandlers(); - } - - public static Note ShowCreateNote(double now) { - return ShowCreateNote(null, now); - } - - public static Note ShowEditNote(Note template) { - return ShowEditNote(null, template); - } - - public static Note ShowCreateNote(IWin32Window window, double now) { - using (var f = new FEditNote()) { - f.CreateNodeInfo(now); - f.ShowDialog(window); - return f.DialogResult == DialogResult.OK ? f.GetNote() : null; - } - } - - public static Note ShowEditNote(IWin32Window window, Note template) { - using (var f = new FEditNote()) { - f.LoadNoteInfo(template); - f.ShowDialog(window); - return f.DialogResult == DialogResult.OK ? f.GetNote() : null; - } - } - - private FEditNote() { - InitializeComponent(); - RegisterEventHandlers(); - InitializeControls(); - _editMode = EditMode.Create; - DialogResult = DialogResult.Cancel; - } - - private Note GetNote() { - return _generatedNote?.Clone(); - } - - private void LoadNoteInfo(Note template) { - _generatedNote = template.Clone(); - txtNoteTiming.Text = template.HitTiming.ToString(CultureInfo.InvariantCulture); - cboNoteStartPos.SelectedIndex = (int)template.StartPosition - 1; - cboNoteFinishPos.SelectedIndex = (int)template.FinishPosition - 1; - _editMode = EditMode.Edit; - } - - private void CreateNodeInfo(double now) { - txtNoteTiming.Text = now.ToString(CultureInfo.InvariantCulture); - cboNoteStartPos.SelectedIndex = cboNoteFinishPos.SelectedIndex = 0; - _editMode = EditMode.Create; - } - - private void UnregisterEventHandlers() { - btnOK.Click -= BtnOK_Click; - btnCancel.Click -= BtnCancel_Click; - Load -= FEditNote_Load; - btnTimingAdd.Click -= BtnTimingAdd_Click; - btnTimingSubtract.Click -= BtnTimingSubtract_Click; - txtNoteTiming.MouseWheel -= TxtNoteTiming_MouseWheel; - } - - private void RegisterEventHandlers() { - btnOK.Click += BtnOK_Click; - btnCancel.Click += BtnCancel_Click; - Load += FEditNote_Load; - btnTimingAdd.Click += BtnTimingAdd_Click; - btnTimingSubtract.Click += BtnTimingSubtract_Click; - txtNoteTiming.MouseWheel += TxtNoteTiming_MouseWheel; - } - - private void TxtNoteTiming_MouseWheel(object sender, MouseEventArgs e) { - if (e.Delta > 0) { - AddTiming(); - } else { - SubtractTiming(); - } - } - - private void BtnTimingSubtract_Click(object sender, EventArgs e) { - SubtractTiming(); - } - - private void BtnTimingAdd_Click(object sender, EventArgs e) { - AddTiming(); - } - - private void FEditNote_Load(object sender, EventArgs e) { - switch (_editMode) { - case EditMode.Create: - Text = CreateNoteTitle; - break; - case EditMode.Edit: - Text = EditNoteTitle; - break; - default: - break; - } - } - - private void BtnCancel_Click(object sender, EventArgs e) { - DialogResult = DialogResult.Cancel; - Close(); - } - - private void BtnOK_Click(object sender, EventArgs e) { - string reason; - var checkResult = CheckFields(out reason); - if (!checkResult) { - this.ShowMessageBox(reason, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); - return; - } - FillNote(); - DialogResult = DialogResult.OK; - Close(); - } - - private bool CheckFields(out string reason) { - double f; - if (!double.TryParse(txtNoteTiming.Text, out f)) { - reason = "Note time should be a real number."; - return false; - } - if (f <= 0) { - reason = "Notes should appear after the song starts."; - return false; - } - reason = null; - return true; - } - - private void FillNote() { - var note = _generatedNote ?? new Note(); - note.HitTiming = double.Parse(txtNoteTiming.Text); - var sp1 = (NotePosition)(cboNoteStartPos.SelectedIndex + 1); - var fp1 = (NotePosition)(cboNoteFinishPos.SelectedIndex + 1); - if (!note.IsHoldRelease) { - note.StartPosition = sp1; - note.FinishPosition = fp1; - } else { - if (sp1 != note.PrevHoldNote.StartPosition || fp1 != note.PrevHoldNote.FinishPosition) { - this.ShowMessageBox("This note is a hold note (release), therefore modification of its start/finish position is ignored."); - note.StartPosition = note.PrevHoldNote.StartPosition; - note.FinishPosition = note.PrevHoldNote.FinishPosition; - } - } - // If this is called during creation, other fields should be initialized using NoteManipulator.InitializeAsTap(). - _generatedNote = note; - } - - private void InitializeControls() { - foreach (var i in Enumerable.Range(0, 5)) { - cboNoteStartPos.Items.Add(PositionDescriptions[i]); - cboNoteFinishPos.Items.Add(PositionDescriptions[i]); - } - } - - private void AddTiming() { - double d; - double.TryParse(txtNoteTiming.Text, out d); - d += NoteManipulator.NoteTimingStep; - txtNoteTiming.Text = d.ToString(CultureInfo.InvariantCulture); - } - - private void SubtractTiming() { - double d; - double.TryParse(txtNoteTiming.Text, out d); - d -= NoteManipulator.NoteTimingStep; - if (d < 0) { - d = 0; - } - txtNoteTiming.Text = d.ToString(CultureInfo.InvariantCulture); - } - - private Note _generatedNote; - private EditMode _editMode; - - private static readonly string[] PositionDescriptions = { - "Left", - "Center Left", - "Center", - "Center Right", - "Right" - }; - - private static readonly string CreateNoteTitle = "Create Note"; - private static readonly string EditNoteTitle = "Edit Note"; - - private enum EditMode { - Create, - Edit - } - - } -} diff --git a/DereTore.Applications.ScoreEditor/Forms/FEditNote.resx b/DereTore.Applications.ScoreEditor/Forms/FEditNote.resx deleted file mode 100644 index 7080a7d..0000000 --- a/DereTore.Applications.ScoreEditor/Forms/FEditNote.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/DereTore.Applications.ScoreEditor/Forms/FMakeSync.Designer.cs b/DereTore.Applications.ScoreEditor/Forms/FMakeSync.Designer.cs deleted file mode 100644 index e913d96..0000000 --- a/DereTore.Applications.ScoreEditor/Forms/FMakeSync.Designer.cs +++ /dev/null @@ -1,161 +0,0 @@ -namespace DereTore.Applications.ScoreEditor.Forms { - partial class FMakeSync { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) { - if (disposing && (components != null)) { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() { - this.label1 = new System.Windows.Forms.Label(); - this.btnOK = new System.Windows.Forms.Button(); - this.btnCancel = new System.Windows.Forms.Button(); - this.txtCurrentNote = new System.Windows.Forms.TextBox(); - this.label2 = new System.Windows.Forms.Label(); - this.cboNotes = new System.Windows.Forms.ComboBox(); - this.label3 = new System.Windows.Forms.Label(); - this.radUseFirst = new System.Windows.Forms.RadioButton(); - this.radUseSecond = new System.Windows.Forms.RadioButton(); - this.SuspendLayout(); - // - // label1 - // - this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(12, 19); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(83, 12); - this.label1.TabIndex = 0; - this.label1.Text = "Current note:"; - // - // btnOK - // - this.btnOK.Location = new System.Drawing.Point(206, 169); - this.btnOK.Name = "btnOK"; - this.btnOK.Size = new System.Drawing.Size(82, 27); - this.btnOK.TabIndex = 1; - this.btnOK.Text = "OK"; - this.btnOK.UseVisualStyleBackColor = true; - // - // btnCancel - // - this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; - this.btnCancel.Location = new System.Drawing.Point(294, 169); - this.btnCancel.Name = "btnCancel"; - this.btnCancel.Size = new System.Drawing.Size(82, 27); - this.btnCancel.TabIndex = 3; - this.btnCancel.Text = "Cancel"; - this.btnCancel.UseVisualStyleBackColor = true; - // - // txtCurrentNote - // - this.txtCurrentNote.Location = new System.Drawing.Point(101, 19); - this.txtCurrentNote.Name = "txtCurrentNote"; - this.txtCurrentNote.ReadOnly = true; - this.txtCurrentNote.Size = new System.Drawing.Size(265, 21); - this.txtCurrentNote.TabIndex = 4; - // - // label2 - // - this.label2.AutoSize = true; - this.label2.Location = new System.Drawing.Point(12, 46); - this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(65, 12); - this.label2.TabIndex = 5; - this.label2.Text = "Sync pair:"; - // - // cboNotes - // - this.cboNotes.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this.cboNotes.FormattingEnabled = true; - this.cboNotes.Location = new System.Drawing.Point(101, 46); - this.cboNotes.Name = "cboNotes"; - this.cboNotes.Size = new System.Drawing.Size(265, 20); - this.cboNotes.TabIndex = 6; - // - // label3 - // - this.label3.AutoSize = true; - this.label3.Location = new System.Drawing.Point(12, 84); - this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size(137, 12); - this.label3.TabIndex = 7; - this.label3.Text = "When timings mismatch:"; - // - // radUseFirst - // - this.radUseFirst.AutoSize = true; - this.radUseFirst.Location = new System.Drawing.Point(115, 106); - this.radUseFirst.Name = "radUseFirst"; - this.radUseFirst.Size = new System.Drawing.Size(173, 16); - this.radUseFirst.TabIndex = 8; - this.radUseFirst.TabStop = true; - this.radUseFirst.Text = "Use current note as basis"; - this.radUseFirst.UseVisualStyleBackColor = true; - // - // radUseSecond - // - this.radUseSecond.AutoSize = true; - this.radUseSecond.Location = new System.Drawing.Point(115, 128); - this.radUseSecond.Name = "radUseSecond"; - this.radUseSecond.Size = new System.Drawing.Size(155, 16); - this.radUseSecond.TabIndex = 9; - this.radUseSecond.TabStop = true; - this.radUseSecond.Text = "Use sync pair as basis"; - this.radUseSecond.UseVisualStyleBackColor = true; - // - // FMakeSync - // - this.AcceptButton = this.btnOK; - this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi; - this.CancelButton = this.btnCancel; - this.ClientSize = new System.Drawing.Size(388, 208); - this.Controls.Add(this.radUseSecond); - this.Controls.Add(this.radUseFirst); - this.Controls.Add(this.label3); - this.Controls.Add(this.cboNotes); - this.Controls.Add(this.label2); - this.Controls.Add(this.txtCurrentNote); - this.Controls.Add(this.btnCancel); - this.Controls.Add(this.btnOK); - this.Controls.Add(this.label1); - this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; - this.MaximizeBox = false; - this.MinimizeBox = false; - this.Name = "FMakeSync"; - this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; - this.Text = "Make Sync"; - this.ResumeLayout(false); - this.PerformLayout(); - - } - - #endregion - - private System.Windows.Forms.Label label1; - private System.Windows.Forms.Button btnOK; - private System.Windows.Forms.Button btnCancel; - private System.Windows.Forms.TextBox txtCurrentNote; - private System.Windows.Forms.Label label2; - private System.Windows.Forms.ComboBox cboNotes; - private System.Windows.Forms.Label label3; - private System.Windows.Forms.RadioButton radUseFirst; - private System.Windows.Forms.RadioButton radUseSecond; - } -} \ No newline at end of file diff --git a/DereTore.Applications.ScoreEditor/Forms/FMakeSync.cs b/DereTore.Applications.ScoreEditor/Forms/FMakeSync.cs deleted file mode 100644 index c0efc3f..0000000 --- a/DereTore.Applications.ScoreEditor/Forms/FMakeSync.cs +++ /dev/null @@ -1,149 +0,0 @@ -using System; -using System.Globalization; -using System.Linq; -using System.Windows.Forms; -using DereTore.Applications.ScoreEditor.Model; - -namespace DereTore.Applications.ScoreEditor.Forms { - public partial class FMakeSync : Form { - - ~FMakeSync() { - UnregisterEventHandlers(); - } - - public static MakeSyncBasis SelectNotes(Score score, Note note, out Note anotherNote) { - return SelectNotes(null, score, note, out anotherNote); - } - - public static MakeSyncBasis SelectNotes(IWin32Window window, Score score, Note note, out Note anotherNote) { - using (var f = new FMakeSync()) { - f.Init(score, note); - var result = f.ShowDialog(window); - anotherNote = result == DialogResult.OK ? f.GetTheOtherNote() : null; - return f._basis; - } - } - - private FMakeSync() { - InitializeComponent(); - RegisterEventHandlers(); - DialogResult = DialogResult.Cancel; - _basis = MakeSyncBasis.None; - } - - private void Init(Score score, Note note) { - txtCurrentNote.Text = $"Note ID #{note.Id} ({note.HitTiming})"; - _initNote = note; - var notes = score.Notes.Where(n => n.IsGamingNote && n != note).ToList(); - notes.Sort((n1, n2) => n1.HitTiming.CompareTo(n2.HitTiming)); - var dataSource = (from n in notes - let diff = n.HitTiming - note.HitTiming - let diffDesc = diff > 0 ? "+" + diff.ToString(CultureInfo.InvariantCulture) : diff.ToString(CultureInfo.InvariantCulture) - let value = new NoteAndDesc(n, $"Note ID #{n.Id} ({n.HitTiming}, {diffDesc})") - select value).ToArray(); - cboNotes.DataSource = dataSource; - cboNotes.DisplayMember = "Description"; - cboNotes.ValueMember = "Note"; - if (cboNotes.Items.Count > 0) { - var index = -1; - double? lastAbs = null; - foreach (var n in notes) { - ++index; - var abs = Math.Abs(n.HitTiming - note.HitTiming); - if (lastAbs == null) { - lastAbs = abs; - continue; - } - if (lastAbs.Value >= abs) { - lastAbs = abs; - } else { - --index; - break; - } - } - if (index >= 0) { - cboNotes.SelectedIndex = index; - } - } - } - - private Note GetTheOtherNote() { - var value = cboNotes.SelectedItem as NoteAndDesc; - return value?.Note; - } - - private void UnregisterEventHandlers() { - btnOK.Click -= BtnOK_Click; - btnCancel.Click -= BtnCancel_Click; - Load -= FMakeSync_Load; - FormClosing -= FMakeSync_FormClosing; - cboNotes.SelectedIndexChanged -= CboNotes_SelectedIndexChanged; - } - - private void RegisterEventHandlers() { - btnOK.Click += BtnOK_Click; - btnCancel.Click += BtnCancel_Click; - Load += FMakeSync_Load; - FormClosing += FMakeSync_FormClosing; - cboNotes.SelectedIndexChanged += CboNotes_SelectedIndexChanged; - } - - private void CboNotes_SelectedIndexChanged(object sender, EventArgs e) { - var value = cboNotes.SelectedItem as NoteAndDesc; - if (value != null) { - var equals = value.Note.HitTiming.Equals(_initNote.HitTiming); - label3.Enabled = radUseFirst.Enabled = radUseSecond.Enabled = !equals; - if (_selectedNote != null) { - _selectedNote.EditorSelected2 = false; - } - value.Note.EditorSelected2 = true; - _selectedNote = value.Note; - } - } - - private void FMakeSync_FormClosing(object sender, FormClosingEventArgs e) { - if (_selectedNote != null) { - _selectedNote.EditorSelected2 = false; - } - } - - private void FMakeSync_Load(object sender, EventArgs e) { - radUseFirst.Checked = true; - } - - private void BtnCancel_Click(object sender, EventArgs e) { - DialogResult = DialogResult.Cancel; - Close(); - } - - private void BtnOK_Click(object sender, EventArgs e) { - DialogResult = DialogResult.OK; - if (radUseFirst.Enabled || radUseSecond.Enabled) { - if (radUseFirst.Checked) { - _basis = MakeSyncBasis.SelectedNote; - } else if (radUseSecond.Checked) { - _basis = MakeSyncBasis.SyncPair; - } - } - Close(); - } - - private MakeSyncBasis _basis; - private Note _initNote; - private Note _selectedNote; - - private sealed class NoteAndDesc { - - public NoteAndDesc(Note note, string description) { - Note = note; - Description = description; - } - - public Note Note { get; } - - public string Description { get; } - } - - } - -} diff --git a/DereTore.Applications.ScoreEditor/Forms/FMakeSync.resx b/DereTore.Applications.ScoreEditor/Forms/FMakeSync.resx deleted file mode 100644 index 7080a7d..0000000 --- a/DereTore.Applications.ScoreEditor/Forms/FMakeSync.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/DereTore.Applications.ScoreEditor/Model/NoteEdition.cs b/DereTore.Applications.ScoreEditor/Model/NoteEdition.cs deleted file mode 100644 index b3c8ea2..0000000 --- a/DereTore.Applications.ScoreEditor/Model/NoteEdition.cs +++ /dev/null @@ -1,14 +0,0 @@ -namespace DereTore.Applications.ScoreEditor.Model { - public enum NoteEdition { - - Add, - Remove, - Edit, - MakeSync, - MakeFlick, - MakeHold, - ResetType, - ResetTiming - - } -} diff --git a/DereTore.Applications.ScoreEditor/Model/NoteManipulator.cs b/DereTore.Applications.ScoreEditor/Model/NoteManipulator.cs deleted file mode 100644 index 731516f..0000000 --- a/DereTore.Applications.ScoreEditor/Model/NoteManipulator.cs +++ /dev/null @@ -1,319 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; - -namespace DereTore.Applications.ScoreEditor.Model { - public static class NoteManipulator { - - public static void AddNote(this Score score, Note note) { - int newIndex, newId; - foreach (var adjustItem in FindNotesAfter(score, note, out newIndex, out newId)) { - ++adjustItem.Id; - } - var specialCase = JudgeSpecialCase(score, newIndex); - note.Id = newId; - var notes = score.EditableNotes; - switch (specialCase) { - case SpecialCase.ResultIsEmpty: - notes.Add(note); - break; - default: - notes.Insert(newIndex, note); - break; - } - score.RaiseScoreChanged(score, new ScoreChangedEventArgs(ScoreChangeReason.Adding, note)); - // No need to sort the flick notes, since the new note is always a tap note. - } - - public static void EditNote(this Score score, Note note, Note newValue) { - EnsureNoteInScore(score, note); - var oldNote = note.Clone(); - // ATTENTION! Changing the time of the note may cause reordering of flicking, if the note is a flick note. - SortFlickNotes(score, note, oldNote); - note.CopyFrom(newValue); - UpdateNoteIDs(score); - UpdateSyncAndHoldStatus(note, newValue); - score.RaiseScoreChanged(score, new ScoreChangedEventArgs(ScoreChangeReason.Modifying, note)); - } - - public static void RemoveNote(this Score score, Note note) { - foreach (var adjustItem in FindNotesAfter(score, note)) { - --adjustItem.Id; - } - var notes = score.EditableNotes; - notes.Remove(note); - // No need to sort, calculate group IDs or do anything else. I would say the code from the Cygames guys may also be like this, - // otherwise what is the explanation for those tons of ungrouped flick notes in song_3034 (Hotel Moonside)? - SortFlickNotes(score, null, note); - UpdateSyncAndHoldStatus(note, null); - score.RaiseScoreChanged(score, new ScoreChangedEventArgs(ScoreChangeReason.Removing, note)); - } - - public static void MakeSync(this Score score, Note note, Note syncWith, MakeSyncBasis syncBasis) { - EnsureNoteInScore(score, note); - EnsureNoteInScore(score, syncWith); - if (note.IsSync || syncWith.IsSync) { - throw new InvalidOperationException("At least one of the two notes is already synced."); - } - if (!note.HitTiming.Equals(syncWith.HitTiming)) { - if (syncBasis == MakeSyncBasis.None) { - throw new InvalidOperationException("The time of notes are not the same."); - } - switch (syncBasis) { - case MakeSyncBasis.SelectedNote: - ResetTimingTo(score, syncWith, note.HitTiming); - break; - case MakeSyncBasis.SyncPair: - ResetTimingTo(score, note, syncWith.HitTiming); - break; - } - } - note.IsSync = syncWith.IsSync = true; - note.SyncPairNote = syncWith; - syncWith.SyncPairNote = note; - } - - public static void MakeHolding(this Score score, Note note, Note holdTo) { - EnsureNoteInScore(score, note); - EnsureNoteInScore(score, holdTo); - throw new NotImplementedException(); - } - - public static void MakeFlick(this Score score, Note note, Note groupMember) { - EnsureNoteInScore(score, note); - EnsureNoteInScore(score, groupMember); - // ATTENTION! Changing the time of the note may cause reordering of flicking, if the note is a flick note. - var oldNote1 = note.Clone(); - var oldNote2 = groupMember.Clone(); - SortFlickNotes(score, note, oldNote1); - SortFlickNotes(score, groupMember, oldNote2); - throw new NotImplementedException(); - } - - public static void ResetToTap(this Score score, Note note) { - EnsureNoteInScore(score, note); - var oldNote = note.Clone(); - // ATTENTION! Changing the time of the note may cause reordering of flicking, if the note is a flick note. - SortFlickNotes(score, note, oldNote); - throw new NotImplementedException(); - } - - public static void ResetTimingTo(this Score score, Note note, double timing) { - var temp = note.Clone(); - temp.HitTiming = timing; - EditNote(score, note, temp); - } - - public static void InitializeAsTap(this Note note) { - note.Type = NoteType.TapOrFlick; - } - - public static void AddTiming(this Score score, Note note) { - ResetTimingTo(score, note, GetAddTimingResult(note)); - } - - public static void SubtractTiming(this Score score, Note note) { - var newTiming = GetSubtractTimingResult(note); - if (!newTiming.Equals(note.HitTiming)) { - ResetTimingTo(score, note, newTiming); - } - } - - public static double GetAddTimingResult(this Note note) { - return note.HitTiming + NoteTimingStep; - } - - public static double GetSubtractTimingResult(this Note note) { - var timing = note.HitTiming - NoteTimingStep; - if (timing < 0) { - timing = 0; - } - return timing; - } - - private static void SortFlickNotes(this Score score, Note note, Note oldNote) { - // Note == null means we just removed the note from score, and then requested sorting the notes. - if (note != null) { - EnsureNoteInScore(score, note); - } else { - note = oldNote; - } - if (!note.IsFlick) { - return; - } - // Search for the flick group - var flickGroupId = -1; - if (note.IsFlick) { - flickGroupId = note.FlickGroupId; - } - if (flickGroupId < 0 && oldNote.IsFlick) { - flickGroupId = oldNote.FlickGroupId; - } - // < 0: truly an exception - // == 0: this is a single flick note - if (flickGroupId <= 0) { - return; - } - var flickGroupNotes = (from n in score.Notes - where n.IsFlick && n.FlickGroupId == flickGroupId - select n).ToList(); - // Another kind of exception? - if (flickGroupNotes.Count < 2) { - if (flickGroupNotes.Count > 0) { - var onlyNote = flickGroupNotes[0]; - onlyNote.PrevFlickNote = onlyNote.NextFlickNote = null; - onlyNote.FlickGroupId = 0; - } - return; - } - if (!flickGroupNotes.Contains(note)) { - note.PrevFlickNote = note.NextFlickNote = null; - } - flickGroupNotes.Sort(TimeBasedNoteComparison); - var index = 0; - foreach (var flickNote in flickGroupNotes) { - if (index == 0) { - if (flickNote.PrevFlickNote != null) { - flickNote.PrevFlickNote = null; - } - } - if (index == flickGroupNotes.Count - 1) { - if (flickNote.NextFlickNote != null) { - flickNote.NextFlickNote = null; - } - } - var nextFlickNote = index < flickGroupNotes.Count - 1 ? flickGroupNotes[index + 1] : null; - if (flickNote.NextFlickNote != nextFlickNote) { - flickNote.NextFlickNote = nextFlickNote; - if (nextFlickNote != null) { - nextFlickNote.PrevFlickNote = flickNote; - } - } - ++index; - } - UpdateNoteIDs(score); - } - - private static void UpdateNoteIDs(this Score score) { - var notes = score.EditableNotes; - notes.Sort(TimeBasedNoteComparison); - var i = 1; - foreach (var note in notes) { - note.Id = i; - ++i; - } - } - - private static void EnsureNoteInScore(Score score, Note note) { - if (score == null) { - throw new ArgumentNullException(nameof(score)); - } - if (note == null) { - throw new ArgumentNullException(nameof(note)); - } - if (!score.Notes.Contains(note)) { - throw new InvalidOperationException(); - } - } - - private static IEnumerable FindNotesAfter(this Score score, Note note, out int newIndex, out int newId) { - var notes = score.Notes; - // pivot is the first note that will be moved backwards. - var pivot = notes.FirstOrDefault(n => n.HitTiming >= note.HitTiming); - if (pivot == null) { - newIndex = 0; - newId = 0; - } else { - newIndex = notes.IndexOf(pivot); - newId = pivot.Id; - } - var pivotId = newId; - var notesWillBeAdjusted = notes.Where(n => n.Id >= pivotId); - return notesWillBeAdjusted; - } - - private static IEnumerable FindNotesAfter(this Score score, Note note) { - int newIndex, newId; - return FindNotesAfter(score, note, out newIndex, out newId); - } - - private static SpecialCase JudgeSpecialCase(Score score, int newIndex) { - SpecialCase specialCase; - if (newIndex < 0) { - specialCase = SpecialCase.ResultIsEntireSeries; - } else if (newIndex == score.Notes.Count - 1) { - specialCase = SpecialCase.ResultIsEmpty; - } else { - specialCase = SpecialCase.None; - } - return specialCase; - } - - private static Note GetNoteItem(Score score, int newIndex) { - return score.Notes[newIndex]; - } - - private static void UpdateSyncAndHoldStatus(Note note, Note newValue) { - if (note.IsSync && note.SyncPairNote != null) { - var syncNote = note.SyncPairNote; - if (newValue == null) { - // Removing - syncNote.IsSync = false; - syncNote.SyncPairNote = null; - } else { - if (!note.HitTiming.Equals(syncNote.HitTiming)) { - note.IsSync = syncNote.IsSync = false; - note.SyncPairNote = syncNote.SyncPairNote = null; - } - } - } - if (note.IsHold) { - Note holdNote; - if (newValue == null) { - if (note.HasNextHold) { - holdNote = note.NextHoldNote; - holdNote.Type = NoteType.TapOrFlick; - holdNote.PrevHoldNote = null; - } else if (note.HasPrevHold) { - holdNote = note.PrevHoldNote; - holdNote.Type = NoteType.TapOrFlick; - holdNote.NextHoldNote = null; - } - note.Type = NoteType.TapOrFlick; - } else { - if (note.HasNextHold) { - holdNote = note.NextHoldNote; - holdNote.StartPosition = newValue.StartPosition; - holdNote.FinishPosition = newValue.FinishPosition; - if (note.HitTiming > note.NextHoldNote.HitTiming) { - note.PrevHoldNote = note.NextHoldNote; - note.NextHoldNote = null; - note.PrevHoldNote.NextHoldNote = note; - note.PrevHoldNote.PrevHoldNote = null; - } - } else if (note.HasPrevHold) { - holdNote = note.PrevHoldNote; - newValue.StartPosition = holdNote.StartPosition; - newValue.FinishPosition = holdNote.FinishPosition; - if (note.HitTiming < note.PrevHoldNote.HitTiming) { - note.NextHoldNote = note.PrevHoldNote; - note.PrevHoldNote = null; - note.NextHoldNote.PrevHoldNote = note; - note.NextFlickNote.NextHoldNote = null; - } - } - } - } - } - - private static readonly Comparison TimeBasedNoteComparison = (n1, n2) => n1.HitTiming.CompareTo(n2.HitTiming); - - public static readonly double NoteTimingStep = 0.1f; - - private enum SpecialCase { - None, - ResultIsEntireSeries, - ResultIsEmpty - } - } -} diff --git a/DereTore.Applications.ScoreEditor/packages.config b/DereTore.Applications.ScoreEditor/packages.config deleted file mode 100644 index d12d5f6..0000000 --- a/DereTore.Applications.ScoreEditor/packages.config +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/DereTore.Applications.ScoreEditor/sv-screenshot-1.jpg b/DereTore.Applications.ScoreEditor/sv-screenshot-1.jpg deleted file mode 100644 index 494e70e..0000000 Binary files a/DereTore.Applications.ScoreEditor/sv-screenshot-1.jpg and /dev/null differ diff --git a/DereTore.Applications.ScoreEditor/Controls/DoubleBufferedPictureBox.cs b/DereTore.Applications.ScoreViewer/Controls/DoubleBufferedPictureBox.cs similarity index 74% rename from DereTore.Applications.ScoreEditor/Controls/DoubleBufferedPictureBox.cs rename to DereTore.Applications.ScoreViewer/Controls/DoubleBufferedPictureBox.cs index 0a89b40..c7a50be 100644 --- a/DereTore.Applications.ScoreEditor/Controls/DoubleBufferedPictureBox.cs +++ b/DereTore.Applications.ScoreViewer/Controls/DoubleBufferedPictureBox.cs @@ -1,11 +1,11 @@ using System.Windows.Forms; -namespace DereTore.Applications.ScoreEditor.Controls { +namespace DereTore.Applications.ScoreViewer.Controls { public class DoubleBufferedPictureBox : PictureBox { - + public DoubleBufferedPictureBox() { SetStyle(ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer | ControlStyles.ResizeRedraw, true); - SetStyle(ControlStyles.Opaque, false); + SetStyle(ControlStyles.Opaque, true); UpdateStyles(); } diff --git a/DereTore.Applications.ScoreEditor/Controls/NoteEnteringOrExitingStageEventArgs.cs b/DereTore.Applications.ScoreViewer/Controls/NoteEnteringOrExitingStageEventArgs.cs similarity index 76% rename from DereTore.Applications.ScoreEditor/Controls/NoteEnteringOrExitingStageEventArgs.cs rename to DereTore.Applications.ScoreViewer/Controls/NoteEnteringOrExitingStageEventArgs.cs index 48d6aff..455ad4d 100644 --- a/DereTore.Applications.ScoreEditor/Controls/NoteEnteringOrExitingStageEventArgs.cs +++ b/DereTore.Applications.ScoreViewer/Controls/NoteEnteringOrExitingStageEventArgs.cs @@ -1,7 +1,7 @@ using System; -using DereTore.Applications.ScoreEditor.Model; +using DereTore.Applications.ScoreViewer.Model; -namespace DereTore.Applications.ScoreEditor.Controls { +namespace DereTore.Applications.ScoreViewer.Controls { public sealed class NoteEnteringOrExitingStageEventArgs : EventArgs { public NoteEnteringOrExitingStageEventArgs(Note note, bool isEntering) { diff --git a/DereTore.Applications.ScoreEditor/Controls/RenderHelper.cs b/DereTore.Applications.ScoreViewer/Controls/RenderHelper.cs similarity index 53% rename from DereTore.Applications.ScoreEditor/Controls/RenderHelper.cs rename to DereTore.Applications.ScoreViewer/Controls/RenderHelper.cs index 9ce1526..24570b4 100644 --- a/DereTore.Applications.ScoreEditor/Controls/RenderHelper.cs +++ b/DereTore.Applications.ScoreViewer/Controls/RenderHelper.cs @@ -1,10 +1,12 @@ using System; using System.Collections.Generic; +using System.Diagnostics; using System.Drawing; +using System.Drawing.Drawing2D; using System.Linq; -using DereTore.Applications.ScoreEditor.Model; +using DereTore.Applications.ScoreViewer.Model; -namespace DereTore.Applications.ScoreEditor.Controls { +namespace DereTore.Applications.ScoreViewer.Controls { internal static class RenderHelper { public static void DrawAvatars(RenderParams renderParams) { @@ -12,7 +14,7 @@ public static void DrawAvatars(RenderParams renderParams) { var centerY = clientSize.Height * BaseLineYPosition; foreach (var position in AvatarCenterXEndPositions) { var centerX = clientSize.Width * position; - renderParams.Graphics.FillEllipse(Brushes.Firebrick, centerX - AvatarCircleRadius, centerY - AvatarCircleRadius, AvatarCircleDiameter, AvatarCircleDiameter); + renderParams.Graphics.FillEllipse(AvatarBrush, centerX - AvatarCircleRadius, centerY - AvatarCircleRadius, AvatarCircleDiameter, AvatarCircleDiameter); } } @@ -21,7 +23,7 @@ public static void DrawCeilingLine(RenderParams renderParams) { float p1 = AvatarCenterXStartPositions[0], p5 = AvatarCenterXStartPositions[AvatarCenterXStartPositions.Length - 1]; float x1 = clientSize.Width * p1, x2 = clientSize.Width * p5; var ceilingY = FutureNoteCeiling * clientSize.Height; - renderParams.Graphics.DrawLine(Pens.Red, x1, ceilingY, x2, ceilingY); + renderParams.Graphics.DrawLine(CeilingPen, x1, ceilingY, x2, ceilingY); } public static void GetVisibleNotes(double now, List notes, out int startIndex, out int endIndex) { @@ -50,6 +52,7 @@ public static void DrawNotes(RenderParams renderParams, IList notes, int s switch (note.Type) { case NoteType.TapOrFlick: case NoteType.Hold: + case NoteType.Slide: if (IsNoteOnStage(note, renderParams.Now)) { if (note.EditorSelected) { DrawSelectedRect(renderParams, note, Pens.White); @@ -80,11 +83,30 @@ public static void DrawNotes(RenderParams renderParams, IList notes, int s } } break; + case NoteType.Slide: + if (note.HasNextSlide) { + DrawSlideLine(renderParams, note, note.NextSlideNote); + } + if (note.HasPrevSlide) { + if (!IsNoteOnStage(note.PrevSlideNote, renderParams.Now)) { + DrawSlideLine(renderParams, note.PrevSlideNote, note); + } + } + break; } switch (note.Type) { case NoteType.TapOrFlick: + if (note.FlickType == NoteStatus.Tap) { + DrawTapNote(renderParams, note); + } else { + DrawFlickNote(renderParams, note); + } + break; case NoteType.Hold: - DrawSimpleNote(renderParams, note); + DrawHoldNote(renderParams, note); + break; + case NoteType.Slide: + DrawSlideNote(renderParams, note); break; } } @@ -106,10 +128,14 @@ public static void DrawSyncLine(RenderParams renderParams, Note note1, Note note x2 = GetNoteXPosition(renderParams, note2); float r = GetNoteRadius(renderParams, note2); float xLeft = Math.Min(x1, x2), xRight = Math.Max(x1, x2); - renderParams.Graphics.DrawLine(Pens.DodgerBlue, xLeft + r, y, xRight - r, y); + renderParams.Graphics.DrawLine(SyncLinePen, xLeft + r, y, xRight - r, y); } public static void DrawHoldLine(RenderParams renderParams, Note startNote, Note endNote) { + DrawHoldLine(renderParams, startNote, endNote, HoldLinePen); + } + + public static void DrawHoldLine(RenderParams renderParams, Note startNote, Note endNote, Pen pen) { var graphics = renderParams.Graphics; var now = renderParams.Now; OnStageStatus s1 = GetNoteOnStageStatus(startNote, now), s2 = GetNoteOnStageStatus(endNote, now); @@ -128,11 +154,49 @@ public static void DrawHoldLine(RenderParams renderParams, Note startNote, Note float xcontrol1, xcontrol2, ycontrol1, ycontrol2; GetBezierFromQuadratic(x1, xmid, x2, out xcontrol1, out xcontrol2); GetBezierFromQuadratic(y1, ymid, y2, out ycontrol1, out ycontrol2); - graphics.DrawBezier(Pens.Yellow, x1, y1, xcontrol1, ycontrol1, xcontrol2, ycontrol2, x2, y2); + graphics.DrawBezier(pen, x1, y1, xcontrol1, ycontrol1, xcontrol2, ycontrol2, x2, y2); + } + + public static void DrawSlideLine(RenderParams renderParams, Note startNote, Note endNote) { + if (endNote.IsFlick) { + DrawFlickLine(renderParams, startNote, endNote); + return; + } + var now = renderParams.Now; + if (startNote.IsSlideEnd || IsNoteOnStage(startNote, now)) { + DrawHoldLine(renderParams, startNote, endNote, SlideLinePen); + return; + } + if (IsNotePassed(startNote, now)) { + var nextSlideNote = startNote.NextSlideNote; + if (nextSlideNote == null) { + // Actually, here is an example of invalid format. :) + DrawHoldLine(renderParams, startNote, endNote, SlideLinePen); + return; + } + if (IsNotePassed(nextSlideNote, now)) { + return; + } + var startX = GetEndXByNotePosition(renderParams.ClientSize, startNote.FinishPosition); + var endX = GetEndXByNotePosition(renderParams.ClientSize, nextSlideNote.FinishPosition); + var y1 = GetAvatarYPosition(renderParams.ClientSize); + var x1 = (float)((now - startNote.HitTiming) / (nextSlideNote.HitTiming - startNote.HitTiming)) * (endX - startX) + startX; + float t1 = GetNoteTransformedTime(renderParams, startNote, true, true); + float t2 = GetNoteTransformedTime(renderParams, endNote, true, true); + float tmid = (t1 + t2) * 0.5f; + float x2 = GetNoteXPosition(renderParams, endNote.FinishPosition, endNote.StartPosition, t2); + float xmid = GetNoteXPosition(renderParams, endNote.FinishPosition, endNote.StartPosition, tmid); + float y2 = GetNoteYPosition(renderParams, t2); + float ymid = GetNoteYPosition(renderParams, tmid); + float xcontrol1, xcontrol2, ycontrol1, ycontrol2; + GetBezierFromQuadratic(x1, xmid, x2, out xcontrol1, out xcontrol2); + GetBezierFromQuadratic(y1, ymid, y2, out ycontrol1, out ycontrol2); + renderParams.Graphics.DrawBezier(SlideLinePen, x1, y1, xcontrol1, ycontrol1, xcontrol2, ycontrol2, x2, y2); + } } public static void DrawFlickLine(RenderParams renderParams, Note startNote, Note endNote) { - DrawSimpleLine(renderParams, startNote, endNote, Pens.OliveDrab); + DrawSimpleLine(renderParams, startNote, endNote, FlickLinePen); } public static void DrawSimpleLine(RenderParams renderParams, Note startNote, Note endNote, Pen pen) { @@ -147,24 +211,125 @@ public static void DrawSimpleLine(RenderParams renderParams, Note startNote, Not graphics.DrawLine(pen, x1, y1, x2, y2); } - public static void DrawSimpleNote(RenderParams renderParams, Note note) { + public static void DrawCommonNoteOutline(RenderParams renderParams, float x, float y, float r) { + renderParams.Graphics.FillEllipse(NoteCommonFill, x - r, y - r, r * 2, r * 2); + renderParams.Graphics.DrawEllipse(NoteCommonStroke, x - r, y - r, r * 2, r * 2); + } + + public static void DrawTapNote(RenderParams renderParams, Note note) { if (!IsNoteOnStage(note, renderParams.Now)) { return; } + float x = GetNoteXPosition(renderParams, note), + y = GetNoteYPosition(renderParams, note), + r = GetNoteRadius(renderParams, note); + DrawCommonNoteOutline(renderParams, x, y, r); + var graphics = renderParams.Graphics; - float x = GetNoteXPosition(renderParams, note), y = GetNoteYPosition(renderParams, note); - float r = GetNoteRadius(renderParams, note); - graphics.FillEllipse(Brushes.DarkMagenta, x - r, y - r, r * 2f, r * 2f); - if (note.IsFlick) { - switch (note.FlickType) { - case NoteStatus.FlickLeft: - graphics.FillPie(Brushes.DarkOrange, x - r, y - r, r * 2f, r * 2f, 135, 90); - break; - case NoteStatus.FlickRight: - graphics.FillPie(Brushes.DarkOrange, x - r, y - r, r * 2f, r * 2f, -45, 90); - break; + var r1 = r * ScaleFactor1; + using (var fill = GetFillBrush(x, y, r, TapNoteShapeFillColors)) { + graphics.FillEllipse(fill, x - r1, y - r1, r1 * 2, r1 * 2); + } + graphics.DrawEllipse(TapNoteShapeStroke, x - r1, y - r1, r1 * 2, r1 * 2); + } + + public static void DrawFlickNote(RenderParams renderParams, Note note) { + if (!IsNoteOnStage(note, renderParams.Now)) { + return; + } + if (note.FlickType == NoteStatus.Tap) { + Debug.Print("WARNING: Tap/hold/slide note requested in DrawFlickNote."); + return; + } + float x = GetNoteXPosition(renderParams, note), + y = GetNoteYPosition(renderParams, note), + r = GetNoteRadius(renderParams, note); + DrawCommonNoteOutline(renderParams, x, y, r); + + var graphics = renderParams.Graphics; + var r1 = r * ScaleFactor1; + // Triangle + var polygon = new PointF[3]; + if (note.FlickType == NoteStatus.FlickLeft) { + polygon[0] = new PointF(x - r1, y); + polygon[1] = new PointF(x + r1 / 2, y + r1 / 2 * Sqrt3); + polygon[2] = new PointF(x + r1 / 2, y - r1 / 2 * Sqrt3); + + } else if (note.FlickType == NoteStatus.FlickRight) { + polygon[0] = new PointF(x + r1, y); + polygon[1] = new PointF(x - r1 / 2, y - r1 / 2 * Sqrt3); + polygon[2] = new PointF(x - r1 / 2, y + r1 / 2 * Sqrt3); + } + using (var fill = GetFillBrush(x, y, r, FlickNoteShapeFillOuterColors)) { + graphics.FillPolygon(fill, polygon); + } + graphics.DrawPolygon(FlickNoteShapeStroke, polygon); + } + + public static void DrawHoldNote(RenderParams renderParams, Note note) { + if (!IsNoteOnStage(note, renderParams.Now)) { + return; + } + float x = GetNoteXPosition(renderParams, note), + y = GetNoteYPosition(renderParams, note), + r = GetNoteRadius(renderParams, note); + DrawCommonNoteOutline(renderParams, x, y, r); + + var graphics = renderParams.Graphics; + var r1 = r * ScaleFactor1; + using (var fill = GetFillBrush(x, y, r, HoldNoteShapeFillOuterColors)) { + graphics.FillEllipse(fill, x - r1, y - r1, r1 * 2, r1 * 2); + } + graphics.DrawEllipse(HoldNoteShapeStroke, x - r1, y - r1, r1 * 2, r1 * 2); + var r2 = r * ScaleFactor3; + graphics.FillEllipse(HoldNoteShapeFillInner, x - r2, y - r2, r2 * 2, r2 * 2); + } + + public static void DrawSlideNote(RenderParams renderParams, Note note) { + if (note.FlickType != NoteStatus.Tap) { + DrawFlickNote(renderParams, note); + return; + } + + float x, y, r; + Color[] fillColors; + var now = renderParams.Now; + if (note.IsSlideEnd || IsNoteOnStage(note, now)) { + x = GetNoteXPosition(renderParams, note); + y = GetNoteYPosition(renderParams, note); + r = GetNoteRadius(renderParams, note); + fillColors = note.IsSlideMiddle ? SlideNoteShapeFillOuterTranslucentColors : SlideNoteShapeFillOuterColors; + } else if (IsNotePassed(note, now)) { + if (!note.HasNextSlide || IsNotePassed(note.NextSlideNote, now)) { + return; } + var nextSlideNote = note.NextSlideNote; + if (nextSlideNote == null) { + // Actually, here is an example of invalid format. :) + DrawTapNote(renderParams, note); + return; + } else { + var startX = GetEndXByNotePosition(renderParams.ClientSize, note.FinishPosition); + var endX = GetEndXByNotePosition(renderParams.ClientSize, nextSlideNote.FinishPosition); + y = GetAvatarYPosition(renderParams.ClientSize); + x = (float)((now - note.HitTiming) / (nextSlideNote.HitTiming - note.HitTiming)) * (endX - startX) + startX; + r = AvatarCircleRadius; + fillColors = SlideNoteShapeFillOuterColors; + } + } else { + return; } + + DrawCommonNoteOutline(renderParams, x, y, r); + var graphics = renderParams.Graphics; + var r1 = r * ScaleFactor1; + using (var fill = GetFillBrush(x, y, r, fillColors)) { + graphics.FillEllipse(fill, x - r1, y - r1, r1 * 2, r1 * 2); + } + var r2 = r * ScaleFactor3; + graphics.FillEllipse(SlideNoteShapeFillInner, x - r2, y - r2, r2 * 2, r2 * 2); + var l = r * SlideNoteStrikeHeightFactor; + graphics.FillRectangle(SlideNoteShapeFillInner, x - r1 - 1, y - l, r1 * 2 + 2, l * 2); } public static void GetBezierFromQuadratic(float x1, float xmid, float x4, out float x2, out float x3) { @@ -313,6 +478,13 @@ public enum OnStageStatus { Passed } + public static readonly Brush AvatarBrush = Brushes.Firebrick; + public static readonly Pen CeilingPen = Pens.Red; + public static readonly Pen HoldLinePen = Pens.Yellow; + public static readonly Pen SyncLinePen = Pens.DodgerBlue; + public static readonly Pen FlickLinePen = Pens.OliveDrab; + public static readonly Pen SlideLinePen = Pens.LightPink; + public static float FutureTimeWindow = 1f; public static readonly float PastTimeWindow = 0.2f; public static readonly float AvatarCircleDiameter = 50; @@ -323,5 +495,37 @@ public enum OnStageStatus { // Then we know the bottom is . public static readonly float FutureNoteCeiling = 0.21875f; + private static readonly float NoteShapeStrokeWidth = 1; + + private static readonly float ScaleFactor1 = 0.8f; + private static readonly float ScaleFactor2 = 0.5f; + private static readonly float ScaleFactor3 = (float)1 / 3f; + private static readonly float SlideNoteStrikeHeightFactor = (float)4 / 30; + private static readonly PointF FillGradientTop = new PointF(0, 0); + private static readonly PointF FillGradientBottom = new PointF(0, AvatarCircleDiameter * ScaleFactor1); + + public static readonly Pen NoteCommonStroke = new Pen(Color.FromArgb(0x22, 0x22, 0x22), NoteShapeStrokeWidth); + public static readonly Brush NoteCommonFill = Brushes.White; + public static readonly Pen TapNoteShapeStroke = new Pen(Color.FromArgb(0xFF, 0x33, 0x66), NoteShapeStrokeWidth); + public static readonly Color[] TapNoteShapeFillColors = { Color.FromArgb(0xFF, 0x99, 0xBB), Color.FromArgb(0xFF, 0x33, 0x66) }; + public static readonly Pen HoldNoteShapeStroke = new Pen(Color.FromArgb(0xFF, 0xBB, 0x22), NoteShapeStrokeWidth); + public static readonly Color[] HoldNoteShapeFillOuterColors = { Color.FromArgb(0xFF, 0xDD, 0x66), Color.FromArgb(0xFF, 0xBB, 0x22) }; + public static readonly Brush HoldNoteShapeFillInner = Brushes.White; + public static readonly Pen FlickNoteShapeStroke = new Pen(Color.FromArgb(0x22, 0x55, 0xBB), NoteShapeStrokeWidth); + public static readonly Color[] FlickNoteShapeFillOuterColors = { Color.FromArgb(0x88, 0xBB, 0xFF), Color.FromArgb(0x22, 0x55, 0xBB) }; + public static readonly Brush FlickNoteShapeFillInner = Brushes.White; + public static readonly Color[] SlideNoteShapeFillOuterColors = { Color.FromArgb(0xA5, 0x46, 0xDA), Color.FromArgb(0xE1, 0xA8, 0xFB) }; + public static readonly Color[] SlideNoteShapeFillOuterTranslucentColors = { Color.FromArgb(0x80, 0xA5, 0x46, 0xDA), Color.FromArgb(0x80, 0xE1, 0xA8, 0xFB) }; + public static readonly Brush SlideNoteShapeFillInner = Brushes.White; + + private static LinearGradientBrush GetFillBrush(float x, float y, float r, Color[] colors) { + var r1 = r * ScaleFactor1; + var top = new PointF(0, y - r1); + var bottom = new PointF(0, y + r1); + return new LinearGradientBrush(top, bottom, colors[0], colors[1]); + } + + private static readonly float Sqrt3 = (float)Math.Sqrt(3); + } } diff --git a/DereTore.Applications.ScoreEditor/Controls/RenderParams.cs b/DereTore.Applications.ScoreViewer/Controls/RenderParams.cs similarity index 89% rename from DereTore.Applications.ScoreEditor/Controls/RenderParams.cs rename to DereTore.Applications.ScoreViewer/Controls/RenderParams.cs index c2f8a49..77b1af6 100644 --- a/DereTore.Applications.ScoreEditor/Controls/RenderParams.cs +++ b/DereTore.Applications.ScoreViewer/Controls/RenderParams.cs @@ -1,6 +1,6 @@ using System.Drawing; -namespace DereTore.Applications.ScoreEditor.Controls { +namespace DereTore.Applications.ScoreViewer.Controls { public sealed class RenderParams { public RenderParams(Graphics graphics, Size clientSize, double now, bool isPreview) { diff --git a/DereTore.Applications.ScoreEditor/Controls/Renderer.cs b/DereTore.Applications.ScoreViewer/Controls/Renderer.cs similarity index 92% rename from DereTore.Applications.ScoreEditor/Controls/Renderer.cs rename to DereTore.Applications.ScoreViewer/Controls/Renderer.cs index 7f71911..b33c800 100644 --- a/DereTore.Applications.ScoreEditor/Controls/Renderer.cs +++ b/DereTore.Applications.ScoreViewer/Controls/Renderer.cs @@ -1,7 +1,7 @@ using System.Collections.Generic; -using DereTore.Applications.ScoreEditor.Model; +using DereTore.Applications.ScoreViewer.Model; -namespace DereTore.Applications.ScoreEditor.Controls { +namespace DereTore.Applications.ScoreViewer.Controls { public sealed class Renderer { public bool IsRendering { diff --git a/DereTore.Applications.ScoreEditor/Controls/ScoreEditorControl.cs b/DereTore.Applications.ScoreViewer/Controls/ScoreEditorControl.cs similarity index 90% rename from DereTore.Applications.ScoreEditor/Controls/ScoreEditorControl.cs rename to DereTore.Applications.ScoreViewer/Controls/ScoreEditorControl.cs index c7861b6..f67cce3 100644 --- a/DereTore.Applications.ScoreEditor/Controls/ScoreEditorControl.cs +++ b/DereTore.Applications.ScoreViewer/Controls/ScoreEditorControl.cs @@ -1,15 +1,23 @@ using System; using System.ComponentModel; using System.Drawing; +using System.Drawing.Drawing2D; using System.Linq; using System.Windows.Forms; -using DereTore.Applications.ScoreEditor.Model; +using DereTore.Applications.ScoreViewer.Model; +using Timer = System.Threading.Timer; -namespace DereTore.Applications.ScoreEditor.Controls { +namespace DereTore.Applications.ScoreViewer.Controls { public sealed class ScoreEditorControl : DoubleBufferedPictureBox { public ScoreEditorControl() { MouseEventsEnabled = true; + _timer = new Timer(OnTimer, null, 1000, 1000); + } + + ~ScoreEditorControl() { + _timer.Dispose(); + _timer = null; } [Browsable(false)] @@ -96,6 +104,8 @@ private set { /// public bool IsPreview { get; set; } + public uint FPS => _fps; + protected override void OnPaint(PaintEventArgs e) { base.OnPaint(e); if (_isPainting || Renderer.Instance.IsRendering) { @@ -103,8 +113,10 @@ protected override void OnPaint(PaintEventArgs e) { } _isPainting = true; e.Graphics.Clear(MouseEventsEnabled ? MouseEventAcceptedColor : MouseEventIgnoredColor); + e.Graphics.SmoothingMode = SmoothingMode.AntiAlias; var renderParams = new RenderParams(e.Graphics, ClientSize, _elapsed.TotalSeconds, IsPreview); Renderer.Instance.RenderFrame(renderParams, Score?.Notes); + ++_frameCount; _isPainting = false; } @@ -194,10 +206,18 @@ private void Score_ScoreChanged(object sender, ScoreChangedEventArgs e) { } } + private void OnTimer(object state) { + _fps = _frameCount; + _frameCount = 0; + } + private bool _isPainting; private TimeSpan _elapsed; private Note _selectedNote; private Score _score; + private uint _fps; + private uint _frameCount; + private Timer _timer; private static readonly Color MouseEventAcceptedColor = Color.FromArgb(0x20, 0x20, 0x20); private static readonly Color MouseEventIgnoredColor = Color.Black; diff --git a/DereTore.Applications.ScoreEditor/DereTore.Application.ScoreEditor.csproj.DotSettings b/DereTore.Applications.ScoreViewer/DereTore.Application.ScoreEditor.csproj.DotSettings similarity index 100% rename from DereTore.Applications.ScoreEditor/DereTore.Application.ScoreEditor.csproj.DotSettings rename to DereTore.Applications.ScoreViewer/DereTore.Application.ScoreEditor.csproj.DotSettings diff --git a/DereTore.Applications.ScoreEditor/DereTore.Application.ScoreViewer.csproj.DotSettings b/DereTore.Applications.ScoreViewer/DereTore.Application.ScoreViewer.csproj.DotSettings similarity index 100% rename from DereTore.Applications.ScoreEditor/DereTore.Application.ScoreViewer.csproj.DotSettings rename to DereTore.Applications.ScoreViewer/DereTore.Application.ScoreViewer.csproj.DotSettings diff --git a/DereTore.Applications.ScoreEditor/DereTore.Applications.ScoreEditor.csproj.DotSettings b/DereTore.Applications.ScoreViewer/DereTore.Applications.ScoreEditor.csproj.DotSettings similarity index 100% rename from DereTore.Applications.ScoreEditor/DereTore.Applications.ScoreEditor.csproj.DotSettings rename to DereTore.Applications.ScoreViewer/DereTore.Applications.ScoreEditor.csproj.DotSettings diff --git a/DereTore.Applications.ScoreEditor/DereTore.Applications.ScoreEditor.csproj b/DereTore.Applications.ScoreViewer/DereTore.Applications.ScoreViewer.csproj similarity index 86% rename from DereTore.Applications.ScoreEditor/DereTore.Applications.ScoreEditor.csproj rename to DereTore.Applications.ScoreViewer/DereTore.Applications.ScoreViewer.csproj index cd58a56..0004109 100644 --- a/DereTore.Applications.ScoreEditor/DereTore.Applications.ScoreEditor.csproj +++ b/DereTore.Applications.ScoreViewer/DereTore.Applications.ScoreViewer.csproj @@ -7,8 +7,8 @@ {31E86FB4-68DE-4DD6-8F03-D8E2DAAE07FA} WinExe Properties - DereTore.Applications.ScoreEditor - CgssScoreEditor + DereTore.Applications.ScoreViewer + ScoreViewer v4.0 512 @@ -56,19 +56,19 @@ ..\packages\CsvHelper.2.16.3.0\lib\net40\CsvHelper.dll True - - ..\packages\NAudio.1.7.3\lib\net35\NAudio.dll + + ..\packages\NAudio.1.8.0\lib\net35\NAudio.dll True - - ..\packages\System.Data.SQLite.Core.1.0.103\lib\net40\System.Data.SQLite.dll + + ..\packages\System.Data.SQLite.Core.1.0.104.0\lib\net40\System.Data.SQLite.dll True - - ..\packages\System.Data.SQLite.Linq.1.0.103\lib\net40\System.Data.SQLite.Linq.dll + + ..\packages\System.Data.SQLite.Linq.1.0.104.0\lib\net40\System.Data.SQLite.Linq.dll True @@ -85,18 +85,6 @@ Component - - Form - - - FEditNote.cs - - - Form - - - FMakeSync.cs - Form @@ -111,7 +99,6 @@ - @@ -129,12 +116,6 @@ - - FEditNote.cs - - - FMakeSync.cs - FViewer.cs @@ -160,6 +141,12 @@ True + + Always + + + Always + Always @@ -259,12 +246,12 @@ - + 这台计算机上缺少此项目引用的 NuGet 程序包。使用“NuGet 程序包还原”可下载这些程序包。有关更多信息,请参见 http://go.microsoft.com/fwlink/?LinkID=322105。缺少的文件是 {0}。 - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/DereTore.Applications.StarlightDirector/UI/Controls/Primitives/ScrollViewerThumbnail.xaml b/DereTore.Applications.StarlightDirector/UI/Controls/Primitives/ScrollViewerThumbnail.xaml deleted file mode 100644 index 8bf34e1..0000000 --- a/DereTore.Applications.StarlightDirector/UI/Controls/Primitives/ScrollViewerThumbnail.xaml +++ /dev/null @@ -1,46 +0,0 @@ - - - - - - - - - - - - - diff --git a/DereTore.Common.Interop/NativeConstants.cs b/DereTore.Common.Interop/NativeConstants.cs index 90f2e76..747c9f2 100644 --- a/DereTore.Common.Interop/NativeConstants.cs +++ b/DereTore.Common.Interop/NativeConstants.cs @@ -3,5 +3,11 @@ public static class NativeConstants { public const int WM_DWMCOLORIZATIONCOLORCHANGED = 0x320; + public const int CCHDEVICENAME = 32; + + public const int CCHFORMNAME = 32; + + public const int ENUM_CURRENT_SETTINGS = -1; + } } diff --git a/DereTore.Common.Interop/NativeMethods.cs b/DereTore.Common.Interop/NativeMethods.cs index a46741d..3400835 100644 --- a/DereTore.Common.Interop/NativeMethods.cs +++ b/DereTore.Common.Interop/NativeMethods.cs @@ -31,5 +31,12 @@ public static class NativeMethods { [DllImport("winmm.dll")] public static extern uint timeEndPeriod(uint uMilliseconds); + [DllImport("winmm.dll")] + public static extern uint timeGetTime(); + + [DllImport("user32.dll", CharSet = CharSet.Auto)] + [return: MarshalAs(UnmanagedType.Bool)] + public static extern bool EnumDisplaySettings([MarshalAs(UnmanagedType.LPTStr)]string lpszDeviceName, int iModeNum, out NativeStructures.DEVMODE lpDevMode); + } } diff --git a/DereTore.Common.Interop/NativeStructures.cs b/DereTore.Common.Interop/NativeStructures.cs index 47ffb8c..0f9dfd1 100644 --- a/DereTore.Common.Interop/NativeStructures.cs +++ b/DereTore.Common.Interop/NativeStructures.cs @@ -1,6 +1,8 @@ -namespace DereTore.Interop { - public static class NativeStructures { +using System.Runtime.InteropServices; +namespace DereTore.Interop { + public static class NativeStructures { + [StructLayout(LayoutKind.Sequential)] public struct DWMCOLORIZATIONPARAMS { public uint ColorizationColor; public uint ColorizationAfterglow; @@ -11,5 +13,45 @@ public struct DWMCOLORIZATIONPARAMS { public uint ColorizationOpaqueBlend; } + [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)] + public struct DEVMODE { + [MarshalAs(UnmanagedType.ByValArray, SizeConst = NativeConstants.CCHDEVICENAME)] + public char[] dmDeviceName; + public short dmSpecVersion; + public short dmDriverVersion; + public short dmSize; + public short dmDriverExtra; + public uint dmFields; + public short dmOrientation; + public short dmPaperSize; + public short dmPaperLength; + public short dmPaperWidth; + public short dmScale; + public short dmCopies; + public short dmDefaultSource; + public short dmPrintQuality; + public short dmColor; + public short dmDuplex; + public short dmYResolution; + public short dmTTOption; + public short dmCollate; + [MarshalAs(UnmanagedType.ByValArray, SizeConst = NativeConstants.CCHFORMNAME)] + public char[] dmFormName; + public short dmUnusedPadding; + public uint dmBitsPerPel; + public uint dmPelsWidth; + public uint dmPelsHeight; + public uint dmDisplayFlags; + public uint dmDisplayFrequency; + public uint dmICMMethod; + public uint dmICMIntent; + public uint dmMediaType; + public uint dmDitherType; + public uint dmReserved1; + public uint dmReserved2; + public uint dmPanningWidth; + public uint dmPanningHeight; + } + } } diff --git a/DereTore.HCA/DecodeParams.cs b/DereTore.HCA/DecodeParams.cs index 296fc73..27045a6 100644 --- a/DereTore.HCA/DecodeParams.cs +++ b/DereTore.HCA/DecodeParams.cs @@ -19,6 +19,17 @@ public static DecodeParams CreateDefault() { }; } + public static DecodeParams CreateDefault(uint key1, uint key2) { + return new DecodeParams { + Key1 = key1, + Key2 = key2, + Mode = SamplingMode.S16, + Volume = 1.0f, + CipherTypeOverrideEnabled = false, + OverriddenCipherType = CipherType.NoChipher + }; + } + public static readonly DecodeParams Default = CreateDefault(); } diff --git a/DereTore.HCA/HcaDecoder.Private.cs b/DereTore.HCA/HcaDecoder.Private.cs index a414173..133e998 100644 --- a/DereTore.HCA/HcaDecoder.Private.cs +++ b/DereTore.HCA/HcaDecoder.Private.cs @@ -100,24 +100,29 @@ private int DecodeToWaveR32(byte[] blockData) { var a = (d.GetBit(9) << 8) - d.GetBit(7); var channels = _channels; var ath = _ath; - for (var i = 0; i < hcaInfo.ChannelCount; ++i) { - channels[i].Decode1(d, hcaInfo.CompR09, a, ath.Table); - } - for (var i = 0; i < 8; ++i) { - for (var j = 0; j < hcaInfo.ChannelCount; ++j) { - channels[j].Decode2(d); - } - for (var j = 0; j < hcaInfo.ChannelCount; ++j) { - channels[j].Decode3(hcaInfo.CompR09, hcaInfo.CompR08, (uint)(hcaInfo.CompR07 + hcaInfo.CompR06), hcaInfo.CompR05); + try { + for (var i = 0; i < hcaInfo.ChannelCount; ++i) { + channels[i].Decode1(d, hcaInfo.CompR09, a, ath.Table); } - for (var j = 0; j < hcaInfo.ChannelCount - 1; ++j) { - Channel.Decode4(ref channels[j], ref channels[j + 1], i, (uint)(hcaInfo.CompR05 - hcaInfo.CompR06), hcaInfo.CompR06, hcaInfo.CompR07); - } - for (var j = 0; j < hcaInfo.ChannelCount; ++j) { - channels[j].Decode5(i); + for (var i = 0; i < 8; ++i) { + for (var j = 0; j < hcaInfo.ChannelCount; ++j) { + channels[j].Decode2(d); + } + for (var j = 0; j < hcaInfo.ChannelCount; ++j) { + channels[j].Decode3(hcaInfo.CompR09, hcaInfo.CompR08, (uint)(hcaInfo.CompR07 + hcaInfo.CompR06), hcaInfo.CompR05); + } + for (var j = 0; j < hcaInfo.ChannelCount - 1; ++j) { + Channel.Decode4(ref channels[j], ref channels[j + 1], i, (uint)(hcaInfo.CompR05 - hcaInfo.CompR06), hcaInfo.CompR06, hcaInfo.CompR07); + } + for (var j = 0; j < hcaInfo.ChannelCount; ++j) { + channels[j].Decode5(i); + } } + return blockData.Length; + } catch (IndexOutOfRangeException ex) { + const string message = "Index access exception detected. It is probably because you are using an incorrect HCA key pair while decoding a type 56 HCA file."; + throw new HcaException(message, ActionResult.DecodeFailed, ex); } - return blockData.Length; } private void TransformWaveDataBlocks(Stream source, byte[] destination, uint startBlockIndex, uint blockCount, IWaveWriter waveWriter) { diff --git a/DereTore.HCA/HcaException.cs b/DereTore.HCA/HcaException.cs index 0bc5f63..6ccf2d8 100644 --- a/DereTore.HCA/HcaException.cs +++ b/DereTore.HCA/HcaException.cs @@ -8,6 +8,11 @@ public HcaException(string message, ActionResult actionResult) _actionResult = actionResult; } + public HcaException(string message, ActionResult actionResult, Exception innerException) + : base(message, innerException) { + _actionResult = actionResult; + } + public ActionResult ActionResult => _actionResult; private readonly ActionResult _actionResult; diff --git a/DereTore.HCA/SamplingMode.cs b/DereTore.HCA/SamplingMode.cs index 9de0b13..bb1ba57 100644 --- a/DereTore.HCA/SamplingMode.cs +++ b/DereTore.HCA/SamplingMode.cs @@ -1,11 +1,11 @@ namespace DereTore.HCA { public enum SamplingMode { - U8, S16, + R32, + U8, S24, - S32, - R32 + S32 } } diff --git a/DereTore.sln b/DereTore.sln index 9b3f66d..9331869 100644 --- a/DereTore.sln +++ b/DereTore.sln @@ -36,18 +36,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DereTore.Applications.Hca2W EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DereTore.Applications.MusicToolchain", "DereTore.Applications.MusicToolchain\DereTore.Applications.MusicToolchain.csproj", "{1D5FB1F1-D4C9-4B4D-9225-73F4C459B875}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DereTore.Applications.ScoreEditor", "DereTore.Applications.ScoreEditor\DereTore.Applications.ScoreEditor.csproj", "{31E86FB4-68DE-4DD6-8F03-D8E2DAAE07FA}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DereTore.Applications.StarlightDirector", "DereTore.Applications.StarlightDirector\DereTore.Applications.StarlightDirector.csproj", "{EA6039D9-CFDA-44B5-BE32-F1256A649E18}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DereTore.Utilities.LZ4", "DereTore.Utilities.LZ4\DereTore.Utilities.LZ4.csproj", "{C6BC3FE0-8333-4DFF-8284-07431E151B44}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DereTore.Applications.StarlightDirector.Entities", "DereTore.Applications.StarlightDirector.Entities\DereTore.Applications.StarlightDirector.Entities.csproj", "{D78A4080-34F4-45EC-A8EF-87F95815E3BD}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DereTore.Applications.StarlightDirector.Core", "DereTore.Applications.StarlightDirector.Core\DereTore.Applications.StarlightDirector.Core.csproj", "{7FB2A631-88C4-4C6B-9E8B-8EEEB40575D0}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DereTore.Applications.StarlightDirector.Exchange", "DereTore.Applications.StarlightDirector.Exchange\DereTore.Applications.StarlightDirector.Exchange.csproj", "{3ECDD0BB-215A-4437-B162-FC9D9285303D}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DereTore.Common.Interop", "DereTore.Common.Interop\DereTore.Common.Interop.csproj", "{3A0D1281-A503-4E5D-9765-D7BF56F89266}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DereTore.Interop.PVRTexLib", "DereTore.Interop.PVRTexLib\DereTore.Interop.PVRTexLib.vcxproj", "{4F31A3B6-D304-4D38-9D2B-3794281CB787}" @@ -60,6 +50,16 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DereTore.Applications.Jacke EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DereTore.Common.Compression.LZ4", "DereTore.Common.Compression.LZ4\DereTore.Common.Compression.LZ4.csproj", "{BEA07A30-C611-4D1C-9632-6CC103722BAA}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DereTore.Applications.ScoreViewer", "DereTore.Applications.ScoreViewer\DereTore.Applications.ScoreViewer.csproj", "{31E86FB4-68DE-4DD6-8F03-D8E2DAAE07FA}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StarlightDirector.Core", "StarlightDirector.Core\StarlightDirector.Core.csproj", "{7FB2A631-88C4-4C6B-9E8B-8EEEB40575D0}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StarlightDirector.Entities", "StarlightDirector.Entities\StarlightDirector.Entities.csproj", "{D78A4080-34F4-45EC-A8EF-87F95815E3BD}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StarlightDirector.Exchange", "StarlightDirector.Exchange\StarlightDirector.Exchange.csproj", "{3ECDD0BB-215A-4437-B162-FC9D9285303D}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StarlightDirector", "StarlightDirector\StarlightDirector.csproj", "{EA6039D9-CFDA-44B5-BE32-F1256A649E18}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|x64 = Debug|x64 @@ -156,22 +156,6 @@ Global {1D5FB1F1-D4C9-4B4D-9225-73F4C459B875}.Release|x64.Build.0 = Release|x64 {1D5FB1F1-D4C9-4B4D-9225-73F4C459B875}.Release|x86.ActiveCfg = Release|x86 {1D5FB1F1-D4C9-4B4D-9225-73F4C459B875}.Release|x86.Build.0 = Release|x86 - {31E86FB4-68DE-4DD6-8F03-D8E2DAAE07FA}.Debug|x64.ActiveCfg = Debug|x64 - {31E86FB4-68DE-4DD6-8F03-D8E2DAAE07FA}.Debug|x64.Build.0 = Debug|x64 - {31E86FB4-68DE-4DD6-8F03-D8E2DAAE07FA}.Debug|x86.ActiveCfg = Debug|x86 - {31E86FB4-68DE-4DD6-8F03-D8E2DAAE07FA}.Debug|x86.Build.0 = Debug|x86 - {31E86FB4-68DE-4DD6-8F03-D8E2DAAE07FA}.Release|x64.ActiveCfg = Release|x64 - {31E86FB4-68DE-4DD6-8F03-D8E2DAAE07FA}.Release|x64.Build.0 = Release|x64 - {31E86FB4-68DE-4DD6-8F03-D8E2DAAE07FA}.Release|x86.ActiveCfg = Release|x86 - {31E86FB4-68DE-4DD6-8F03-D8E2DAAE07FA}.Release|x86.Build.0 = Release|x86 - {EA6039D9-CFDA-44B5-BE32-F1256A649E18}.Debug|x64.ActiveCfg = Debug|x64 - {EA6039D9-CFDA-44B5-BE32-F1256A649E18}.Debug|x64.Build.0 = Debug|x64 - {EA6039D9-CFDA-44B5-BE32-F1256A649E18}.Debug|x86.ActiveCfg = Debug|x86 - {EA6039D9-CFDA-44B5-BE32-F1256A649E18}.Debug|x86.Build.0 = Debug|x86 - {EA6039D9-CFDA-44B5-BE32-F1256A649E18}.Release|x64.ActiveCfg = Release|x64 - {EA6039D9-CFDA-44B5-BE32-F1256A649E18}.Release|x64.Build.0 = Release|x64 - {EA6039D9-CFDA-44B5-BE32-F1256A649E18}.Release|x86.ActiveCfg = Release|x86 - {EA6039D9-CFDA-44B5-BE32-F1256A649E18}.Release|x86.Build.0 = Release|x86 {C6BC3FE0-8333-4DFF-8284-07431E151B44}.Debug|x64.ActiveCfg = Debug|x64 {C6BC3FE0-8333-4DFF-8284-07431E151B44}.Debug|x64.Build.0 = Debug|x64 {C6BC3FE0-8333-4DFF-8284-07431E151B44}.Debug|x86.ActiveCfg = Debug|x86 @@ -180,30 +164,6 @@ Global {C6BC3FE0-8333-4DFF-8284-07431E151B44}.Release|x64.Build.0 = Release|x64 {C6BC3FE0-8333-4DFF-8284-07431E151B44}.Release|x86.ActiveCfg = Release|x86 {C6BC3FE0-8333-4DFF-8284-07431E151B44}.Release|x86.Build.0 = Release|x86 - {D78A4080-34F4-45EC-A8EF-87F95815E3BD}.Debug|x64.ActiveCfg = Debug|x64 - {D78A4080-34F4-45EC-A8EF-87F95815E3BD}.Debug|x64.Build.0 = Debug|x64 - {D78A4080-34F4-45EC-A8EF-87F95815E3BD}.Debug|x86.ActiveCfg = Debug|x86 - {D78A4080-34F4-45EC-A8EF-87F95815E3BD}.Debug|x86.Build.0 = Debug|x86 - {D78A4080-34F4-45EC-A8EF-87F95815E3BD}.Release|x64.ActiveCfg = Release|x64 - {D78A4080-34F4-45EC-A8EF-87F95815E3BD}.Release|x64.Build.0 = Release|x64 - {D78A4080-34F4-45EC-A8EF-87F95815E3BD}.Release|x86.ActiveCfg = Release|x86 - {D78A4080-34F4-45EC-A8EF-87F95815E3BD}.Release|x86.Build.0 = Release|x86 - {7FB2A631-88C4-4C6B-9E8B-8EEEB40575D0}.Debug|x64.ActiveCfg = Debug|x64 - {7FB2A631-88C4-4C6B-9E8B-8EEEB40575D0}.Debug|x64.Build.0 = Debug|x64 - {7FB2A631-88C4-4C6B-9E8B-8EEEB40575D0}.Debug|x86.ActiveCfg = Debug|x86 - {7FB2A631-88C4-4C6B-9E8B-8EEEB40575D0}.Debug|x86.Build.0 = Debug|x86 - {7FB2A631-88C4-4C6B-9E8B-8EEEB40575D0}.Release|x64.ActiveCfg = Release|x64 - {7FB2A631-88C4-4C6B-9E8B-8EEEB40575D0}.Release|x64.Build.0 = Release|x64 - {7FB2A631-88C4-4C6B-9E8B-8EEEB40575D0}.Release|x86.ActiveCfg = Release|x86 - {7FB2A631-88C4-4C6B-9E8B-8EEEB40575D0}.Release|x86.Build.0 = Release|x86 - {3ECDD0BB-215A-4437-B162-FC9D9285303D}.Debug|x64.ActiveCfg = Debug|x64 - {3ECDD0BB-215A-4437-B162-FC9D9285303D}.Debug|x64.Build.0 = Debug|x64 - {3ECDD0BB-215A-4437-B162-FC9D9285303D}.Debug|x86.ActiveCfg = Debug|x86 - {3ECDD0BB-215A-4437-B162-FC9D9285303D}.Debug|x86.Build.0 = Debug|x86 - {3ECDD0BB-215A-4437-B162-FC9D9285303D}.Release|x64.ActiveCfg = Release|x64 - {3ECDD0BB-215A-4437-B162-FC9D9285303D}.Release|x64.Build.0 = Release|x64 - {3ECDD0BB-215A-4437-B162-FC9D9285303D}.Release|x86.ActiveCfg = Release|x86 - {3ECDD0BB-215A-4437-B162-FC9D9285303D}.Release|x86.Build.0 = Release|x86 {3A0D1281-A503-4E5D-9765-D7BF56F89266}.Debug|x64.ActiveCfg = Debug|x64 {3A0D1281-A503-4E5D-9765-D7BF56F89266}.Debug|x64.Build.0 = Debug|x64 {3A0D1281-A503-4E5D-9765-D7BF56F89266}.Debug|x86.ActiveCfg = Debug|x86 @@ -252,6 +212,46 @@ Global {BEA07A30-C611-4D1C-9632-6CC103722BAA}.Release|x64.Build.0 = Release|x64 {BEA07A30-C611-4D1C-9632-6CC103722BAA}.Release|x86.ActiveCfg = Release|x86 {BEA07A30-C611-4D1C-9632-6CC103722BAA}.Release|x86.Build.0 = Release|x86 + {31E86FB4-68DE-4DD6-8F03-D8E2DAAE07FA}.Debug|x64.ActiveCfg = Debug|x64 + {31E86FB4-68DE-4DD6-8F03-D8E2DAAE07FA}.Debug|x64.Build.0 = Debug|x64 + {31E86FB4-68DE-4DD6-8F03-D8E2DAAE07FA}.Debug|x86.ActiveCfg = Debug|x86 + {31E86FB4-68DE-4DD6-8F03-D8E2DAAE07FA}.Debug|x86.Build.0 = Debug|x86 + {31E86FB4-68DE-4DD6-8F03-D8E2DAAE07FA}.Release|x64.ActiveCfg = Release|x64 + {31E86FB4-68DE-4DD6-8F03-D8E2DAAE07FA}.Release|x64.Build.0 = Release|x64 + {31E86FB4-68DE-4DD6-8F03-D8E2DAAE07FA}.Release|x86.ActiveCfg = Release|x86 + {31E86FB4-68DE-4DD6-8F03-D8E2DAAE07FA}.Release|x86.Build.0 = Release|x86 + {7FB2A631-88C4-4C6B-9E8B-8EEEB40575D0}.Debug|x64.ActiveCfg = Debug|x64 + {7FB2A631-88C4-4C6B-9E8B-8EEEB40575D0}.Debug|x64.Build.0 = Debug|x64 + {7FB2A631-88C4-4C6B-9E8B-8EEEB40575D0}.Debug|x86.ActiveCfg = Debug|x86 + {7FB2A631-88C4-4C6B-9E8B-8EEEB40575D0}.Debug|x86.Build.0 = Debug|x86 + {7FB2A631-88C4-4C6B-9E8B-8EEEB40575D0}.Release|x64.ActiveCfg = Release|x64 + {7FB2A631-88C4-4C6B-9E8B-8EEEB40575D0}.Release|x64.Build.0 = Release|x64 + {7FB2A631-88C4-4C6B-9E8B-8EEEB40575D0}.Release|x86.ActiveCfg = Release|x86 + {7FB2A631-88C4-4C6B-9E8B-8EEEB40575D0}.Release|x86.Build.0 = Release|x86 + {D78A4080-34F4-45EC-A8EF-87F95815E3BD}.Debug|x64.ActiveCfg = Debug|x64 + {D78A4080-34F4-45EC-A8EF-87F95815E3BD}.Debug|x64.Build.0 = Debug|x64 + {D78A4080-34F4-45EC-A8EF-87F95815E3BD}.Debug|x86.ActiveCfg = Debug|x86 + {D78A4080-34F4-45EC-A8EF-87F95815E3BD}.Debug|x86.Build.0 = Debug|x86 + {D78A4080-34F4-45EC-A8EF-87F95815E3BD}.Release|x64.ActiveCfg = Release|x64 + {D78A4080-34F4-45EC-A8EF-87F95815E3BD}.Release|x64.Build.0 = Release|x64 + {D78A4080-34F4-45EC-A8EF-87F95815E3BD}.Release|x86.ActiveCfg = Release|x86 + {D78A4080-34F4-45EC-A8EF-87F95815E3BD}.Release|x86.Build.0 = Release|x86 + {3ECDD0BB-215A-4437-B162-FC9D9285303D}.Debug|x64.ActiveCfg = Debug|x64 + {3ECDD0BB-215A-4437-B162-FC9D9285303D}.Debug|x64.Build.0 = Debug|x64 + {3ECDD0BB-215A-4437-B162-FC9D9285303D}.Debug|x86.ActiveCfg = Debug|x86 + {3ECDD0BB-215A-4437-B162-FC9D9285303D}.Debug|x86.Build.0 = Debug|x86 + {3ECDD0BB-215A-4437-B162-FC9D9285303D}.Release|x64.ActiveCfg = Release|x64 + {3ECDD0BB-215A-4437-B162-FC9D9285303D}.Release|x64.Build.0 = Release|x64 + {3ECDD0BB-215A-4437-B162-FC9D9285303D}.Release|x86.ActiveCfg = Release|x86 + {3ECDD0BB-215A-4437-B162-FC9D9285303D}.Release|x86.Build.0 = Release|x86 + {EA6039D9-CFDA-44B5-BE32-F1256A649E18}.Debug|x64.ActiveCfg = Debug|x64 + {EA6039D9-CFDA-44B5-BE32-F1256A649E18}.Debug|x64.Build.0 = Debug|x64 + {EA6039D9-CFDA-44B5-BE32-F1256A649E18}.Debug|x86.ActiveCfg = Debug|x86 + {EA6039D9-CFDA-44B5-BE32-F1256A649E18}.Debug|x86.Build.0 = Debug|x86 + {EA6039D9-CFDA-44B5-BE32-F1256A649E18}.Release|x64.ActiveCfg = Release|x64 + {EA6039D9-CFDA-44B5-BE32-F1256A649E18}.Release|x64.Build.0 = Release|x64 + {EA6039D9-CFDA-44B5-BE32-F1256A649E18}.Release|x86.ActiveCfg = Release|x86 + {EA6039D9-CFDA-44B5-BE32-F1256A649E18}.Release|x86.Build.0 = Release|x86 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/README.md b/README.md index cd04218..4ca4b95 100644 --- a/README.md +++ b/README.md @@ -56,7 +56,7 @@ See it for yourself. **DereTore.HCA** -The pure C# implementation of CRI HCA v2.0 decoder, based on [kawashima](https://github.com/Hozuki/kawashima). +The pure C# implementation of CRI HCA v2.0 decoder, based on [kawashima](https://github.com/hozuki/kawashima). Here is its [readme](DereTore.HCA/README.md). **DereTore.ACB** @@ -65,45 +65,46 @@ CRI ACB/AWB package manipulation library. Only necessary parts are implemented. ### Applications +Applications can be found in their own directories. + **CipherConverter** -The C# version of HCA cipher conversion utility. See **hcacc** in [hcatools](https://github.com/Hozuki/hcatools). +The C# version of HCA cipher conversion utility. See **hcacc** in [hcatools](https://github.com/hozuki/libcgss). **Encoder** -The C# version of HCA encoding utility. See **hcaenc** in [hcatools](https://github.com/Hozuki/hcatools). +The C# version of HCA encoding utility. See **hcaenc** in [hcatools](https://github.com/hozuki/libcgss). **Hca2Wav** -A console appilcation that converts HCA audio to WAVE audio. It is similar to DereTore.HCA.Test, -but it outputs to a stream, in fixed linear sequence. It can be used as a clearer demo to integrate -DereTore.HCA. +A console appilcation that converts HCA audio to wave audio. It can be used as a demo to integrate +*DereTore.HCA*. -**AcbMaker** +**ACB Maker** A tool for creating CGSS-compatible ACB archives. Here is its [readme](DereTore.Applications.AcbMaker/README.md). -**MusicToolchain** +**Music Toolchain** The utility that integrates **Encoder**, **CipherConverter** and **AcbMaker** into a streamline. Here is its [readme](DereTore.Applications.MusicToolchain/README.md). -**ScoreEditor** +**Score Viewer** -Viewing and editing scores (collections of notes) of live music. Here is its [readme](DereTore.Applications.ScoreEditor/README.md). +Viewing scores (beatmaps) of live music. Here is its [readme](DereTore.Applications.ScoreViewer/README.md). -**StarlightDirector** +**Starlight Director** The new score composer (still in alpha phase), the successor of ScoreEditor. Detailed readme and user manual will be written in the future. Let's celebrate its alpha release! -**AcbUnzip** +**ACB Unzip** -An application that unpacks ACB archives. +An application for unpacking ACB archives. -**JacketCreator** +**Jacket Creator** -A utility for creating CD jackets. +A utility for creating CD jackets. Used with score and music makers. ### Other diff --git a/DereTore.Applications.StarlightDirector.Core/DescribedEnumReader.cs b/StarlightDirector.Core/DescribedEnumReader.cs similarity index 93% rename from DereTore.Applications.StarlightDirector.Core/DescribedEnumReader.cs rename to StarlightDirector.Core/DescribedEnumReader.cs index 3bdb2bd..a23c883 100644 --- a/DereTore.Applications.StarlightDirector.Core/DescribedEnumReader.cs +++ b/StarlightDirector.Core/DescribedEnumReader.cs @@ -1,10 +1,9 @@ using System; using System.Collections.Generic; using System.ComponentModel; -using System.Linq; -using System.Reflection; +using DereTore; -namespace DereTore.Applications.StarlightDirector { +namespace StarlightDirector { internal static class DescribedEnumReader { public static string Read(Enum value, Type enumType) { diff --git a/DereTore.Applications.StarlightDirector.Core/DirectorHelper.cs b/StarlightDirector.Core/DirectorHelper.cs similarity index 96% rename from DereTore.Applications.StarlightDirector.Core/DirectorHelper.cs rename to StarlightDirector.Core/DirectorHelper.cs index 56bd62d..5aabe4f 100644 --- a/DereTore.Applications.StarlightDirector.Core/DirectorHelper.cs +++ b/StarlightDirector.Core/DirectorHelper.cs @@ -3,7 +3,7 @@ using System.IO; using System.Windows; -namespace DereTore.Applications.StarlightDirector { +namespace StarlightDirector { public static class DirectorHelper { public static double BpmToSeconds(double bpm) { diff --git a/DereTore.Applications.StarlightDirector.Core/IntegerIDGenerator.cs b/StarlightDirector.Core/IntegerIDGenerator.cs similarity index 89% rename from DereTore.Applications.StarlightDirector.Core/IntegerIDGenerator.cs rename to StarlightDirector.Core/IntegerIDGenerator.cs index fefba76..a084bbf 100644 --- a/DereTore.Applications.StarlightDirector.Core/IntegerIDGenerator.cs +++ b/StarlightDirector.Core/IntegerIDGenerator.cs @@ -1,4 +1,4 @@ -namespace DereTore.Applications.StarlightDirector { +namespace StarlightDirector { public sealed class IntegerIDGenerator { public int Next() { diff --git a/DereTore.Applications.StarlightDirector.Core/InternalList.cs b/StarlightDirector.Core/InternalList.cs similarity index 99% rename from DereTore.Applications.StarlightDirector.Core/InternalList.cs rename to StarlightDirector.Core/InternalList.cs index 1772143..fd504e7 100644 --- a/DereTore.Applications.StarlightDirector.Core/InternalList.cs +++ b/StarlightDirector.Core/InternalList.cs @@ -3,7 +3,7 @@ using System.Collections.Generic; using System.Collections.ObjectModel; -namespace DereTore.Applications.StarlightDirector { +namespace StarlightDirector { public class InternalList : IList { public InternalList() { diff --git a/DereTore.Applications.StarlightDirector.Core/ObservableDictionary.cs b/StarlightDirector.Core/ObservableDictionary.cs similarity index 99% rename from DereTore.Applications.StarlightDirector.Core/ObservableDictionary.cs rename to StarlightDirector.Core/ObservableDictionary.cs index eebfd89..6225436 100644 --- a/DereTore.Applications.StarlightDirector.Core/ObservableDictionary.cs +++ b/StarlightDirector.Core/ObservableDictionary.cs @@ -3,7 +3,7 @@ using System.Collections.Specialized; using System.ComponentModel; -namespace DereTore.Applications.StarlightDirector { +namespace StarlightDirector { // https://richardwilburn.wordpress.com/2009/07/13/observable-dictionary/ // Modifications are made based on testing. public class ObservableDictionary : IDictionary, INotifyCollectionChanged, INotifyPropertyChanged { diff --git a/DereTore.Applications.StarlightDirector.Core/Properties/AssemblyInfo.cs b/StarlightDirector.Core/Properties/AssemblyInfo.cs similarity index 76% rename from DereTore.Applications.StarlightDirector.Core/Properties/AssemblyInfo.cs rename to StarlightDirector.Core/Properties/AssemblyInfo.cs index 104a53b..7c2f6ed 100644 --- a/DereTore.Applications.StarlightDirector.Core/Properties/AssemblyInfo.cs +++ b/StarlightDirector.Core/Properties/AssemblyInfo.cs @@ -5,11 +5,11 @@ // 有关程序集的一般信息由以下 // 控制。更改这些特性值可修改 // 与程序集关联的信息。 -[assembly: AssemblyTitle("DereTore.Applications.StarlightDirector.Core")] +[assembly: AssemblyTitle("StarlightDirector.Core")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("DereTore.Applications.StarlightDirector.Core")] +[assembly: AssemblyProduct("StarlightDirector.Core")] [assembly: AssemblyCopyright("Copyright © 2016")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] @@ -22,7 +22,7 @@ // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID [assembly: Guid("7fb2a631-88c4-4c6b-9e8b-8eeeb40575d0")] -// 程序集的版本信息由下列四个值组成: +// 程序集的版本信息由下列四个值组成: // // 主版本 // 次版本 @@ -36,5 +36,5 @@ [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: InternalsVisibleTo("StarlightDirector")] -[assembly: InternalsVisibleTo("DereTore.Applications.StarlightDirector.Entities")] -[assembly: InternalsVisibleTo("DereTore.Applications.StarlightDirector.Exchange")] +[assembly: InternalsVisibleTo("StarlightDirector.Entities")] +[assembly: InternalsVisibleTo("StarlightDirector.Exchange")] diff --git a/DereTore.Applications.StarlightDirector.Core/DereTore.Applications.StarlightDirector.Core.csproj b/StarlightDirector.Core/StarlightDirector.Core.csproj similarity index 96% rename from DereTore.Applications.StarlightDirector.Core/DereTore.Applications.StarlightDirector.Core.csproj rename to StarlightDirector.Core/StarlightDirector.Core.csproj index 9e73d19..335e188 100644 --- a/DereTore.Applications.StarlightDirector.Core/DereTore.Applications.StarlightDirector.Core.csproj +++ b/StarlightDirector.Core/StarlightDirector.Core.csproj @@ -7,8 +7,8 @@ {7FB2A631-88C4-4C6B-9E8B-8EEEB40575D0} Library Properties - DereTore.Applications.StarlightDirector - DereTore.Applications.StarlightDirector.Core + StarlightDirector + StarlightDirector.Core v4.0 512 diff --git a/DereTore.Applications.StarlightDirector.Core/StringHasher.cs b/StarlightDirector.Core/StringHasher.cs similarity index 96% rename from DereTore.Applications.StarlightDirector.Core/StringHasher.cs rename to StarlightDirector.Core/StringHasher.cs index 65b951d..636a856 100644 --- a/DereTore.Applications.StarlightDirector.Core/StringHasher.cs +++ b/StarlightDirector.Core/StringHasher.cs @@ -2,7 +2,7 @@ using System.Security.Cryptography; using System.Text; -namespace DereTore.Applications.StarlightDirector { +namespace StarlightDirector { public static class StringHasher { public static string GetHash(string source, HashAlgorithm algorithm) { diff --git a/DereTore.Applications.StarlightDirector.Core/ThreadingTimer.cs b/StarlightDirector.Core/ThreadingTimer.cs similarity index 97% rename from DereTore.Applications.StarlightDirector.Core/ThreadingTimer.cs rename to StarlightDirector.Core/ThreadingTimer.cs index d2d7457..db6f02c 100644 --- a/DereTore.Applications.StarlightDirector.Core/ThreadingTimer.cs +++ b/StarlightDirector.Core/ThreadingTimer.cs @@ -1,9 +1,10 @@ using System; using System.Diagnostics; using System.Threading; +using DereTore; using DereTore.Interop; -namespace DereTore.Applications.StarlightDirector { +namespace StarlightDirector { public sealed class ThreadingTimer : DisposableBase { public ThreadingTimer(double interval) { diff --git a/DereTore.Applications.StarlightDirector.Entities/Bar.cs b/StarlightDirector.Entities/Bar.cs similarity index 98% rename from DereTore.Applications.StarlightDirector.Entities/Bar.cs rename to StarlightDirector.Entities/Bar.cs index 1d70b3f..8e93290 100644 --- a/DereTore.Applications.StarlightDirector.Entities/Bar.cs +++ b/StarlightDirector.Entities/Bar.cs @@ -1,10 +1,10 @@ using System; +using System.Linq; +using DereTore; using Newtonsoft.Json; using Newtonsoft.Json.Serialization; -using System.Collections.Generic; -using System.Linq; -namespace DereTore.Applications.StarlightDirector.Entities { +namespace StarlightDirector.Entities { [JsonObject(NamingStrategyType = typeof(CamelCaseNamingStrategy), MemberSerialization = MemberSerialization.OptIn)] public sealed class Bar { diff --git a/DereTore.Applications.StarlightDirector.Entities/BarParams.cs b/StarlightDirector.Entities/BarParams.cs similarity index 91% rename from DereTore.Applications.StarlightDirector.Entities/BarParams.cs rename to StarlightDirector.Entities/BarParams.cs index 5f317c4..cd5d6a8 100644 --- a/DereTore.Applications.StarlightDirector.Entities/BarParams.cs +++ b/StarlightDirector.Entities/BarParams.cs @@ -2,7 +2,7 @@ using Newtonsoft.Json; using Newtonsoft.Json.Serialization; -namespace DereTore.Applications.StarlightDirector.Entities { +namespace StarlightDirector.Entities { [JsonObject(NamingStrategyType = typeof(CamelCaseNamingStrategy))] public sealed class BarParams { diff --git a/DereTore.Applications.StarlightDirector.Entities/CompiledNote.cs b/StarlightDirector.Entities/CompiledNote.cs similarity index 87% rename from DereTore.Applications.StarlightDirector.Entities/CompiledNote.cs rename to StarlightDirector.Entities/CompiledNote.cs index 949b505..b763e4a 100644 --- a/DereTore.Applications.StarlightDirector.Entities/CompiledNote.cs +++ b/StarlightDirector.Entities/CompiledNote.cs @@ -1,6 +1,6 @@ using System; -namespace DereTore.Applications.StarlightDirector.Entities { +namespace StarlightDirector.Entities { public sealed class CompiledNote { public int ID { get; set; } @@ -19,7 +19,7 @@ public sealed class CompiledNote { public bool IsSync { get; set; } - public int FlickGroupID { get; set; } + public int GroupID { get; set; } internal static readonly Comparison IDComparison = (n1, n2) => n1.ID.CompareTo(n2.ID); internal static readonly Comparison TimingComparison = (n1, n2) => n1.HitTiming.CompareTo(n2.HitTiming); diff --git a/DereTore.Applications.StarlightDirector.Entities/CompiledScore.cs b/StarlightDirector.Entities/CompiledScore.cs similarity index 87% rename from DereTore.Applications.StarlightDirector.Entities/CompiledScore.cs rename to StarlightDirector.Entities/CompiledScore.cs index 053eed5..89101a3 100644 --- a/DereTore.Applications.StarlightDirector.Entities/CompiledScore.cs +++ b/StarlightDirector.Entities/CompiledScore.cs @@ -3,9 +3,9 @@ using System.Text; using CsvHelper; using CsvHelper.Configuration; -using DereTore.Applications.StarlightDirector.Entities.Serialization; +using StarlightDirector.Entities.Serialization; -namespace DereTore.Applications.StarlightDirector.Entities { +namespace StarlightDirector.Entities { public sealed class CompiledScore { public CompiledScore() { diff --git a/DereTore.Applications.StarlightDirector.Entities/Difficulty.cs b/StarlightDirector.Entities/Difficulty.cs similarity index 84% rename from DereTore.Applications.StarlightDirector.Entities/Difficulty.cs rename to StarlightDirector.Entities/Difficulty.cs index 942112e..990df0a 100644 --- a/DereTore.Applications.StarlightDirector.Entities/Difficulty.cs +++ b/StarlightDirector.Entities/Difficulty.cs @@ -1,6 +1,6 @@ using System.ComponentModel; -namespace DereTore.Applications.StarlightDirector.Entities { +namespace StarlightDirector.Entities { public enum Difficulty { Invalid, diff --git a/DereTore.Applications.StarlightDirector.Entities/EntityID.cs b/StarlightDirector.Entities/EntityID.cs similarity index 59% rename from DereTore.Applications.StarlightDirector.Entities/EntityID.cs rename to StarlightDirector.Entities/EntityID.cs index eef85e7..d9a9297 100644 --- a/DereTore.Applications.StarlightDirector.Entities/EntityID.cs +++ b/StarlightDirector.Entities/EntityID.cs @@ -1,4 +1,4 @@ -namespace DereTore.Applications.StarlightDirector.Entities { +namespace StarlightDirector.Entities { public static class EntityID { public static readonly int Invalid = 0; diff --git a/StarlightDirector.Entities/Extensions/NoteExtensions.cs b/StarlightDirector.Entities/Extensions/NoteExtensions.cs new file mode 100644 index 0000000..ab352be --- /dev/null +++ b/StarlightDirector.Entities/Extensions/NoteExtensions.cs @@ -0,0 +1,80 @@ +using System.Collections.Generic; + +namespace StarlightDirector.Entities.Extensions { + public static class NoteExtensions { + + public static Note GetFirstNoteBetween(this IEnumerable notes, Note n1, Note n2) { + var first = n1 < n2 ? n1 : n2; + var second = first.Equals(n1) ? n2 : n1; + foreach (var n in notes) { + if (n.Equals(first) || n.Equals(second)) { + continue; + } + if (n.FinishPosition != first.FinishPosition || first.Bar.Index > n.Bar.Index || n.Bar.Index > second.Bar.Index) { + continue; + } + if (first.Bar.Index == second.Bar.Index) { + if (first.IndexInGrid <= n.IndexInGrid && n.IndexInGrid <= second.IndexInGrid) { + return n; + } + } else { + if (first.Bar.Index == n.Bar.Index) { + if (first.IndexInGrid <= n.IndexInGrid) { + return n; + } + } else if (second.Bar.Index == n.Bar.Index) { + if (n.IndexInGrid <= second.IndexInGrid) { + return n; + } + } else { + return n; + } + } + } + return null; + } + + public static bool AnyNoteBetween(this IEnumerable notes, Note start, Note end) { + return GetFirstNoteBetween(notes, start, end) != null; + } + + internal static bool TryGetFlickGroupID(this Note note, out FlickGroupModificationResult modificationResult, out int knownGroupID, out Note groupStart) { + if ((!note.IsFlick && !note.IsSlide) || (note.IsHoldEnd && !note.HasNextFlickOrSlide)) { + knownGroupID = EntityID.Invalid; + modificationResult = FlickGroupModificationResult.Declined; + groupStart = null; + return false; + } + var groupItemCount = 0; + var temp = note; + // Compiler trick. + groupStart = temp; + while (temp != null) { + groupStart = temp; + temp = temp.PrevFlickOrSlideNote; + ++groupItemCount; + } + temp = note; + ++groupItemCount; + while (temp.HasNextFlickOrSlide) { + temp = temp.NextFlickOrSlideNote; + ++groupItemCount; + } + if (groupItemCount < 2) { + // Actually, the flick group is not fully filled. We should throw an exception. + knownGroupID = EntityID.Invalid; + modificationResult = FlickGroupModificationResult.Declined; + return false; + } + if (groupStart.GroupID != EntityID.Invalid) { + knownGroupID = groupStart.GroupID; + modificationResult = FlickGroupModificationResult.Reused; + } else { + knownGroupID = EntityID.Invalid; + modificationResult = FlickGroupModificationResult.CreationPending; + } + return true; + } + + } +} diff --git a/DereTore.Applications.StarlightDirector.Entities/Extensions/ScoreExtensions.cs b/StarlightDirector.Entities/Extensions/ScoreExtensions.cs similarity index 84% rename from DereTore.Applications.StarlightDirector.Entities/Extensions/ScoreExtensions.cs rename to StarlightDirector.Entities/Extensions/ScoreExtensions.cs index dbde3a0..0378218 100644 --- a/DereTore.Applications.StarlightDirector.Entities/Extensions/ScoreExtensions.cs +++ b/StarlightDirector.Entities/Extensions/ScoreExtensions.cs @@ -1,6 +1,6 @@ using System.Linq; -namespace DereTore.Applications.StarlightDirector.Entities.Extensions { +namespace StarlightDirector.Entities.Extensions { public static class ScoreExtensions { public static CompiledScore Compile(this Score score) { @@ -27,11 +27,10 @@ public static void CompileTo(this Score score, CompiledScore compiledScore) { compiledNotes.Add(compiledNote); } } - + // The normal gaming notes. var noteId = 3; - foreach (var compiledNote in compiledNotes) - { + foreach (var compiledNote in compiledNotes) { compiledNote.ID = noteId++; } @@ -49,11 +48,17 @@ public static void CompileTo(this Score score, CompiledScore compiledScore) { compiledNotes.Insert(0, scoreInfoNote); compiledNotes.Insert(1, songStartNote); - var lastBar = score.Bars.Last(); + double endTiming; + if (score.Bars.Count > 0) { + var lastBar = score.Bars.Last(); + endTiming = lastBar.StartTime + lastBar.TimeLength; + } else { + endTiming = 0; + } var songEndNote = new CompiledNote { ID = noteId, Type = NoteType.MusicEnd, - HitTiming = lastBar.StartTime + lastBar.TimeLength + HitTiming = endTiming }; compiledNotes.Add(songEndNote); } @@ -68,22 +73,22 @@ private static void SetCommonNoteProperties(Note note, CompiledNote compiledNote private static void CalculateGroupID(Note note, CompiledNote compiledNote) { if (note.GroupID != EntityID.Invalid) { - compiledNote.FlickGroupID = note.GroupID; + compiledNote.GroupID = note.GroupID; } else { int groupID; FlickGroupModificationResult result; Note groupStart; if (!note.TryGetFlickGroupID(out result, out groupID, out groupStart)) { - // No need to set a group ID. E.g. the note is not a flick note. + // No need to set a group ID. E.g. the note is not a flick / slide note. return; } switch (result) { case FlickGroupModificationResult.Reused: - note.GroupID = compiledNote.FlickGroupID = groupID; + note.GroupID = compiledNote.GroupID = groupID; break; case FlickGroupModificationResult.CreationPending: groupID = FlickGroupIDGenerator.Next(); - groupStart.GroupID = note.GroupID = compiledNote.FlickGroupID = groupID; + groupStart.GroupID = note.GroupID = compiledNote.GroupID = groupID; break; } } diff --git a/DereTore.Applications.StarlightDirector.Entities/FlickGroupModificationResult.cs b/StarlightDirector.Entities/FlickGroupModificationResult.cs similarity index 64% rename from DereTore.Applications.StarlightDirector.Entities/FlickGroupModificationResult.cs rename to StarlightDirector.Entities/FlickGroupModificationResult.cs index 3ec4e1b..4b6ab62 100644 --- a/DereTore.Applications.StarlightDirector.Entities/FlickGroupModificationResult.cs +++ b/StarlightDirector.Entities/FlickGroupModificationResult.cs @@ -1,4 +1,4 @@ -namespace DereTore.Applications.StarlightDirector.Entities { +namespace StarlightDirector.Entities { internal enum FlickGroupModificationResult { Declined, diff --git a/DereTore.Applications.StarlightDirector.Entities/Gaming/MusicAttribute.cs b/StarlightDirector.Entities/Gaming/MusicAttribute.cs similarity index 86% rename from DereTore.Applications.StarlightDirector.Entities/Gaming/MusicAttribute.cs rename to StarlightDirector.Entities/Gaming/MusicAttribute.cs index 3358008..dca12c9 100644 --- a/DereTore.Applications.StarlightDirector.Entities/Gaming/MusicAttribute.cs +++ b/StarlightDirector.Entities/Gaming/MusicAttribute.cs @@ -1,7 +1,7 @@ using System; using System.ComponentModel; -namespace DereTore.Applications.StarlightDirector.Entities.Gaming { +namespace StarlightDirector.Entities.Gaming { [Flags] public enum MusicAttribute { diff --git a/DereTore.Applications.StarlightDirector.Entities/Note.cs b/StarlightDirector.Entities/Note.cs similarity index 70% rename from DereTore.Applications.StarlightDirector.Entities/Note.cs rename to StarlightDirector.Entities/Note.cs index 16e9db0..5903a5a 100644 --- a/DereTore.Applications.StarlightDirector.Entities/Note.cs +++ b/StarlightDirector.Entities/Note.cs @@ -1,9 +1,12 @@ using System; +using System.Diagnostics; +using System.Globalization; using System.Windows; +using DereTore; using Newtonsoft.Json; using Newtonsoft.Json.Serialization; -namespace DereTore.Applications.StarlightDirector.Entities { +namespace StarlightDirector.Entities { [JsonObject(NamingStrategyType = typeof(CamelCaseNamingStrategy), MemberSerialization = MemberSerialization.OptIn)] public sealed class Note : DependencyObject, IComparable { @@ -29,7 +32,7 @@ public int IndexInGrid { public NoteType Type { get { return (NoteType)GetValue(TypeProperty); } - private set { SetValue(TypeProperty, value); } + internal set { SetValue(TypeProperty, value); } } [JsonProperty] @@ -64,75 +67,35 @@ public bool IsFlick { private set { SetValue(IsFlickProperty, value); } } - [JsonProperty] - public int PrevFlickNoteID { get; internal set; } + [JsonProperty("prevFlickNoteID")] + public int PrevFlickOrSlideNoteID { get; internal set; } - public Note PrevFlickNote { - get { - return _prevFlickNote; - } + public Note PrevFlickOrSlideNote { + get { return _prevFlickOrSlideNote; } set { - Note n1 = PrevFlickNote, n2 = NextFlickNote; - if (n1 == null && n2 == null && value != null) { - FlickType = FinishPosition >= NotePosition.Center ? NoteFlickType.FlickRight : NoteFlickType.FlickLeft; - } - _prevFlickNote = value; - n1 = PrevFlickNote; - n2 = NextFlickNote; - if (n1 == null && n2 == null) { - if (!IsHoldStart) { - FlickType = NoteFlickType.Tap; - } - } else { - // Currently there isn't an example of quick 'Z' turn appeared in CGSS (as shown below), - // so the following completion method is good enough. - // --> - // ^ - // \ - // --> - if (n2 != null) { - FlickType = n2.FinishPosition > FinishPosition ? NoteFlickType.FlickRight : NoteFlickType.FlickLeft; - } else { - FlickType = n1.FinishPosition > FinishPosition ? NoteFlickType.FlickLeft : NoteFlickType.FlickRight; - } - } - PrevFlickNoteID = value?.ID ?? EntityID.Invalid; + UpdateFlickTypeStep1(value); + _prevFlickOrSlideNote = value; + UpdateFlickTypeStep2(); + PrevFlickOrSlideNoteID = value?.ID ?? EntityID.Invalid; } } - public bool HasPrevFlick => Type == NoteType.TapOrFlick && PrevFlickNote != null; + public bool HasPrevFlickOrSlide => (Type == NoteType.TapOrFlick || Type == NoteType.Slide) && PrevFlickOrSlideNote != null; - [JsonProperty] - public int NextFlickNoteID { get; internal set; } + [JsonProperty("nextFlickNoteID")] + public int NextFlickOrSlideNoteID { get; internal set; } - public Note NextFlickNote { - get { - return _nextFlickNote; - } + public Note NextFlickOrSlideNote { + get { return _nextFlickOrSlideNote; } set { - Note n1 = PrevFlickNote, n2 = NextFlickNote; - if (n1 == null && n2 == null && value != null) { - FlickType = FinishPosition >= NotePosition.Center ? NoteFlickType.FlickRight : NoteFlickType.FlickLeft; - } - _nextFlickNote = value; - n1 = PrevFlickNote; - n2 = NextFlickNote; - if (n1 == null && n2 == null) { - if (!IsHoldStart) { - FlickType = NoteFlickType.Tap; - } - } else { - if (n2 != null) { - FlickType = n2.FinishPosition > FinishPosition ? NoteFlickType.FlickRight : NoteFlickType.FlickLeft; - } else { - FlickType = n1.FinishPosition > FinishPosition ? NoteFlickType.FlickLeft : NoteFlickType.FlickRight; - } - } - NextFlickNoteID = value?.ID ?? EntityID.Invalid; + UpdateFlickTypeStep1(value); + _nextFlickOrSlideNote = value; + UpdateFlickTypeStep2(); + NextFlickOrSlideNoteID = value?.ID ?? EntityID.Invalid; } } - public bool HasNextFlick => Type == NoteType.TapOrFlick && NextFlickNote != null; + public bool HasNextFlickOrSlide => (Type == NoteType.TapOrFlick || Type == NoteType.Slide) && NextFlickOrSlideNote != null; [Obsolete("This property is provided for forward compatibility only.")] [JsonProperty] @@ -145,38 +108,31 @@ public int SyncTargetID { return EntityID.Invalid; } var final = PrevSyncTarget; - for (; final.HasPrevSync; final = final.PrevSyncTarget) - ; + while (final.HasPrevSync) { + final = final.PrevSyncTarget; + } return final.ID; } else { if (!HasNextSync) { return EntityID.Invalid; } var final = NextSyncTarget; - for (; final.HasNextSync; final = final.NextSyncTarget) - ; + while (final.HasNextSync) { + final = final.NextSyncTarget; + } return final.ID; } } - internal set { } } public Note PrevSyncTarget { - get { - return _prevSyncTarget; - } - internal set { - SetPrevSyncTargetInternal(value); - } + get { return _prevSyncTarget; } + internal set { SetPrevSyncTargetInternal(value); } } public Note NextSyncTarget { - get { - return _nextSyncTarget; - } - internal set { - SetNextSyncTargetInternal(value); - } + get { return _nextSyncTarget; } + internal set { SetNextSyncTargetInternal(value); } } public bool HasPrevSync => PrevSyncTarget != null; @@ -196,9 +152,7 @@ public bool IsHold { public int HoldTargetID { get; internal set; } public Note HoldTarget { - get { - return _holdTarget; - } + get { return _holdTarget; } set { var origHoldTarget = _holdTarget; _holdTarget = value; @@ -212,7 +166,21 @@ public Note HoldTarget { } } - public bool IsTap => Type == NoteType.TapOrFlick && FlickType == NoteFlickType.Tap; + public bool IsSlide { + get { return (bool)GetValue(IsSlideProperty); } + private set { SetValue(IsSlideProperty, value); } + } + + public bool IsSlideStart => Type == NoteType.Slide && !HasPrevFlickOrSlide && HasNextFlickOrSlide; + + public bool IsSlideContinuation => Type == NoteType.Slide && HasPrevFlickOrSlide && HasNextFlickOrSlide; + + public bool IsSlideEnd => Type == NoteType.Slide && !HasNextFlickOrSlide && HasPrevFlickOrSlide; + + public bool IsTap { + get { return (bool)GetValue(IsTapProperty); } + private set { SetValue(IsTapProperty, value); } + } public bool IsGamingNote => IsTypeGaming(Type); @@ -223,6 +191,16 @@ public NoteExtraParams ExtraParams { set { SetValue(ExtraParamsProperty, value); } } + public bool ShouldBeRenderedAsFlick { + get { return (bool)GetValue(ShouldBeRenderedAsFlickProperty); } + private set { SetValue(ShouldBeRenderedAsFlickProperty, value); } + } + + public bool ShouldBeRenderedAsSlide { + get { return (bool)GetValue(ShouldBeRenderedAsSlideProperty); } + private set { SetValue(ShouldBeRenderedAsSlideProperty, value); } + } + public static readonly DependencyProperty TypeProperty = DependencyProperty.Register(nameof(Type), typeof(NoteType), typeof(Note), new PropertyMetadata(NoteType.Invalid, OnTypeChanged)); @@ -238,6 +216,12 @@ public NoteExtraParams ExtraParams { public static readonly DependencyProperty IsHoldProperty = DependencyProperty.Register(nameof(IsHold), typeof(bool), typeof(Note), new PropertyMetadata(false)); + public static readonly DependencyProperty IsSlideProperty = DependencyProperty.Register(nameof(IsSlide), typeof(bool), typeof(Note), + new PropertyMetadata(false)); + + public static readonly DependencyProperty IsTapProperty = DependencyProperty.Register(nameof(IsTap), typeof(bool), typeof(Note), + new PropertyMetadata(true)); + public static readonly DependencyProperty StartPositionProperty = DependencyProperty.Register(nameof(StartPosition), typeof(NotePosition), typeof(Note), new PropertyMetadata(NotePosition.Nowhere)); @@ -247,6 +231,12 @@ public NoteExtraParams ExtraParams { public static readonly DependencyProperty ExtraParamsProperty = DependencyProperty.Register(nameof(ExtraParams), typeof(NoteExtraParams), typeof(Note), new PropertyMetadata(null, OnExtraParamsChanged)); + public static readonly DependencyProperty ShouldBeRenderedAsFlickProperty = DependencyProperty.Register(nameof(ShouldBeRenderedAsFlick), typeof(bool), typeof(Note), + new PropertyMetadata(false)); + + public static readonly DependencyProperty ShouldBeRenderedAsSlideProperty = DependencyProperty.Register(nameof(ShouldBeRenderedAsSlide), typeof(bool), typeof(Note), + new PropertyMetadata(false)); + public static readonly Comparison TimingThenPositionComparison = (x, y) => { var r = TimingComparison(x, y); return r == 0 ? TrackPositionComparison(x, y) : r; @@ -278,11 +268,7 @@ public int CompareTo(Note other) { if (other == null) { throw new ArgumentNullException(nameof(other)); } - if (Equals(other)) { - return 0; - } else { - return TimingComparison(this, other); - } + return Equals(other) ? 0 : TimingComparison(this, other); } public static readonly Comparison TrackPositionComparison = (n1, n2) => ((int)n1.FinishPosition).CompareTo((int)n2.FinishPosition); @@ -296,7 +282,7 @@ public int CompareTo(Note other) { } public static bool IsTypeGaming(NoteType type) { - return type == NoteType.TapOrFlick || type == NoteType.Hold; + return type == NoteType.TapOrFlick || type == NoteType.Hold || type == NoteType.Slide; } public static bool IsTypeSpecial(NoteType type) { @@ -372,10 +358,10 @@ public void FixSync() { public static void ConnectFlick(Note first, Note second) { if (first != null) { - first.NextFlickNote = second; + first.NextFlickOrSlideNote = second; } if (second != null) { - second.PrevFlickNote = first; + second.PrevFlickOrSlideNote = first; } } @@ -388,44 +374,6 @@ public static void ConnectHold(Note n1, Note n2) { } } - internal bool TryGetFlickGroupID(out FlickGroupModificationResult modificationResult, out int knownGroupID, out Note groupStart) { - if (!IsFlick || (IsHoldEnd && !HasNextFlick)) { - knownGroupID = EntityID.Invalid; - modificationResult = FlickGroupModificationResult.Declined; - groupStart = null; - return false; - } - var groupItemCount = 0; - var temp = this; - // Compiler trick. - groupStart = temp; - while (temp != null) { - groupStart = temp; - temp = temp.PrevFlickNote; - ++groupItemCount; - } - temp = this; - ++groupItemCount; - while (temp.HasNextFlick) { - temp = temp.NextFlickNote; - ++groupItemCount; - } - if (groupItemCount < 2) { - // Actually, the flick group is not fully filled. We should throw an exception. - knownGroupID = EntityID.Invalid; - modificationResult = FlickGroupModificationResult.Declined; - return false; - } - if (groupStart.GroupID != EntityID.Invalid) { - knownGroupID = groupStart.GroupID; - modificationResult = FlickGroupModificationResult.Reused; - } else { - knownGroupID = EntityID.Invalid; - modificationResult = FlickGroupModificationResult.CreationPending; - } - return true; - } - internal int GroupID { get; set; } [JsonConstructor] @@ -440,18 +388,18 @@ internal Note(int id, Bar bar) { } internal void Reset() { - if (NextFlickNote != null) { - NextFlickNote.PrevFlickNote = null; + if (NextFlickOrSlideNote != null) { + NextFlickOrSlideNote.PrevFlickOrSlideNote = null; } - NextFlickNote = null; - if (PrevFlickNote != null) { - PrevFlickNote.NextFlickNote = null; + NextFlickOrSlideNote = null; + if (PrevFlickOrSlideNote != null) { + PrevFlickOrSlideNote.NextFlickOrSlideNote = null; } - PrevFlickNote = null; + PrevFlickOrSlideNote = null; if (HoldTarget != null) { HoldTarget.HoldTarget = null; if (HoldTarget != null) { - if (!HoldTarget.HasNextFlick && !HoldTarget.HasPrevFlick && HoldTarget.FlickType != NoteFlickType.Tap) { + if (!HoldTarget.HasNextFlickOrSlide && !HoldTarget.HasPrevFlickOrSlide && HoldTarget.FlickType != NoteFlickType.Tap) { HoldTarget.FlickType = NoteFlickType.Tap; } } @@ -478,11 +426,16 @@ internal void SetIndexInGridWithoutSorting(int newIndex) { private static void OnTypeChanged(DependencyObject obj, DependencyPropertyChangedEventArgs e) { var note = (Note)obj; note.IsFlick = note.IsFlickInternal(); + note.IsTap = note.IsTapInternal(); + note.IsSlide = note.IsSlideInternal(); + note.UpdateFlickTypeStep2(); } private static void OnFlickTypeChanged(DependencyObject obj, DependencyPropertyChangedEventArgs e) { var note = (Note)obj; note.IsFlick = note.IsFlickInternal(); + note.IsTap = note.IsTapInternal(); + note.IsSlide = note.IsSlideInternal(); } private static void OnExtraParamsChanged(DependencyObject obj, DependencyPropertyChangedEventArgs e) { @@ -497,10 +450,62 @@ private static void OnExtraParamsChanged(DependencyObject obj, DependencyPropert } } - private bool IsFlickInternal() { - return Type == NoteType.TapOrFlick && (FlickType == NoteFlickType.FlickLeft || FlickType == NoteFlickType.FlickRight); + private void UpdateFlickTypeStep1(Note value) { + var n1 = PrevFlickOrSlideNote; + var n2 = NextFlickOrSlideNote; + if (IsSlide) { + FlickType = NoteFlickType.Tap; + } else { + if (n1 == null && n2 == null && value != null) { + FlickType = FinishPosition >= NotePosition.Center ? NoteFlickType.FlickRight : NoteFlickType.FlickLeft; + } + } + } + + private void UpdateFlickTypeStep2() { + var n1 = PrevFlickOrSlideNote; + var n2 = NextFlickOrSlideNote; + if (n1 == null && n2 == null) { + if (!IsHoldStart) { + FlickType = NoteFlickType.Tap; + } + } else { + // Currently there isn't an example of quick 'Z' turn appeared in CGSS (as shown below), + // so the following completion method is good enough. + // --> + // ^ + // \ + // --> + //Debug.Print(HitTiming.ToString(CultureInfo.InvariantCulture)); + if (IsSlide && (n2 == null || !n2.IsFlick)) { + FlickType = NoteFlickType.Tap; + } else { + if (n2 != null) { + FlickType = n2.FinishPosition > FinishPosition ? NoteFlickType.FlickRight : NoteFlickType.FlickLeft; + } else { + FlickType = n1.FinishPosition > FinishPosition ? NoteFlickType.FlickLeft : NoteFlickType.FlickRight; + } + } + } + + if (IsFlick || IsSlide) { + if (IsSlide) { + ShouldBeRenderedAsSlide = HasNextFlickOrSlide && !NextFlickOrSlideNote.IsFlick; + } else { + ShouldBeRenderedAsSlide = false; + } + ShouldBeRenderedAsFlick = !ShouldBeRenderedAsSlide; + } else { + ShouldBeRenderedAsFlick = ShouldBeRenderedAsSlide = false; + } } + private bool IsFlickInternal() => Type == NoteType.TapOrFlick && (FlickType == NoteFlickType.FlickLeft || FlickType == NoteFlickType.FlickRight); + + private bool IsTapInternal() => Type == NoteType.TapOrFlick && FlickType == NoteFlickType.Tap; + + private bool IsSlideInternal() => Type == NoteType.Slide; + private void ExtraParams_ParamsChanged(object sender, EventArgs e) { // if we a BPM note is changed, inform the Bar to update its timings Bar?.UpdateTimingsChain(); @@ -517,8 +522,8 @@ private void SetNextSyncTargetInternal(Note next) { IsSync = _prevSyncTarget != null || _nextSyncTarget != null; } - private Note _prevFlickNote; - private Note _nextFlickNote; + private Note _prevFlickOrSlideNote; + private Note _nextFlickOrSlideNote; private Note _prevSyncTarget; private Note _nextSyncTarget; private Note _holdTarget; diff --git a/DereTore.Applications.StarlightDirector.Entities/NoteExtraParams.cs b/StarlightDirector.Entities/NoteExtraParams.cs similarity index 97% rename from DereTore.Applications.StarlightDirector.Entities/NoteExtraParams.cs rename to StarlightDirector.Entities/NoteExtraParams.cs index acf654e..71df7ff 100644 --- a/DereTore.Applications.StarlightDirector.Entities/NoteExtraParams.cs +++ b/StarlightDirector.Entities/NoteExtraParams.cs @@ -1,8 +1,9 @@ using System; using System.Globalization; using System.Windows; +using DereTore; -namespace DereTore.Applications.StarlightDirector.Entities { +namespace StarlightDirector.Entities { public sealed class NoteExtraParams : DependencyObject { public event EventHandler ParamsChanged; diff --git a/DereTore.Applications.StarlightDirector.Entities/NoteFlickType.cs b/StarlightDirector.Entities/NoteFlickType.cs similarity index 62% rename from DereTore.Applications.StarlightDirector.Entities/NoteFlickType.cs rename to StarlightDirector.Entities/NoteFlickType.cs index d4970e3..a464573 100644 --- a/DereTore.Applications.StarlightDirector.Entities/NoteFlickType.cs +++ b/StarlightDirector.Entities/NoteFlickType.cs @@ -1,4 +1,4 @@ -namespace DereTore.Applications.StarlightDirector.Entities { +namespace StarlightDirector.Entities { public enum NoteFlickType { Tap = 0, diff --git a/DereTore.Applications.StarlightDirector.Entities/NotePosition.cs b/StarlightDirector.Entities/NotePosition.cs similarity index 69% rename from DereTore.Applications.StarlightDirector.Entities/NotePosition.cs rename to StarlightDirector.Entities/NotePosition.cs index c9d2386..e782581 100644 --- a/DereTore.Applications.StarlightDirector.Entities/NotePosition.cs +++ b/StarlightDirector.Entities/NotePosition.cs @@ -1,4 +1,4 @@ -namespace DereTore.Applications.StarlightDirector.Entities { +namespace StarlightDirector.Entities { public enum NotePosition { Nowhere, diff --git a/DereTore.Applications.StarlightDirector.Entities/NoteRelation.cs b/StarlightDirector.Entities/NoteRelation.cs similarity index 50% rename from DereTore.Applications.StarlightDirector.Entities/NoteRelation.cs rename to StarlightDirector.Entities/NoteRelation.cs index 76ff15d..5ba3ff9 100644 --- a/DereTore.Applications.StarlightDirector.Entities/NoteRelation.cs +++ b/StarlightDirector.Entities/NoteRelation.cs @@ -1,9 +1,9 @@ -namespace DereTore.Applications.StarlightDirector.Entities { +namespace StarlightDirector.Entities { public enum NoteRelation { None, Sync, - Flick, + FlickOrSlide, Hold } diff --git a/DereTore.Applications.StarlightDirector.Entities/NoteType.cs b/StarlightDirector.Entities/NoteType.cs similarity index 85% rename from DereTore.Applications.StarlightDirector.Entities/NoteType.cs rename to StarlightDirector.Entities/NoteType.cs index c5a419f..d2f6825 100644 --- a/DereTore.Applications.StarlightDirector.Entities/NoteType.cs +++ b/StarlightDirector.Entities/NoteType.cs @@ -1,4 +1,4 @@ -namespace DereTore.Applications.StarlightDirector.Entities { +namespace StarlightDirector.Entities { public enum NoteType { Invalid = 0, diff --git a/DereTore.Applications.StarlightDirector.Entities/Party.cs b/StarlightDirector.Entities/Party.cs similarity index 59% rename from DereTore.Applications.StarlightDirector.Entities/Party.cs rename to StarlightDirector.Entities/Party.cs index 1de510a..3ba5bd5 100644 --- a/DereTore.Applications.StarlightDirector.Entities/Party.cs +++ b/StarlightDirector.Entities/Party.cs @@ -1,4 +1,4 @@ -namespace DereTore.Applications.StarlightDirector.Entities { +namespace StarlightDirector.Entities { public enum Party { Neutral, diff --git a/DereTore.Applications.StarlightDirector.Entities/Project.cs b/StarlightDirector.Entities/Project.cs similarity index 96% rename from DereTore.Applications.StarlightDirector.Entities/Project.cs rename to StarlightDirector.Entities/Project.cs index 56fcf23..97d0173 100644 --- a/DereTore.Applications.StarlightDirector.Entities/Project.cs +++ b/StarlightDirector.Entities/Project.cs @@ -3,10 +3,11 @@ using System.Diagnostics; using System.IO; using System.Windows; -using DereTore.Applications.StarlightDirector.Entities.Extensions; +using DereTore; using Newtonsoft.Json; +using StarlightDirector.Entities.Extensions; -namespace DereTore.Applications.StarlightDirector.Entities { +namespace StarlightDirector.Entities { public sealed class Project : DependencyObject { public Project() { @@ -119,7 +120,7 @@ public Difficulty Difficulty { public static readonly DependencyProperty VersionProperty = DependencyProperty.Register(nameof(Version), typeof(string), typeof(Project), new PropertyMetadata(CurrentVersion)); - public static string CurrentVersion => "0.3"; + public static string CurrentVersion => ProjectVersion.Current.ToString(); private static void OnDifficultyChanged(DependencyObject obj, DependencyPropertyChangedEventArgs e) { var project = obj as Project; @@ -146,8 +147,7 @@ private static void OnSaveFileNameChanged(DependencyObject obj, DependencyProper private void OnSettingsChanged(object sender, EventArgs e) { IsChanged = true; - foreach (var score in Scores.Values) - { + foreach (var score in Scores.Values) { score.UpdateBarTimings(); } diff --git a/StarlightDirector.Entities/ProjectVersion.cs b/StarlightDirector.Entities/ProjectVersion.cs new file mode 100644 index 0000000..084b2b7 --- /dev/null +++ b/StarlightDirector.Entities/ProjectVersion.cs @@ -0,0 +1,15 @@ +namespace StarlightDirector.Entities { + + public static class ProjectVersion { + + public const int Unknown = 0; + public const int V0_1 = 100; + public const int V0_2 = 200; + public const int V0_3 = 300; + public const int V0_3_1 = 301; + + public static readonly int Current = V0_3_1; + + } + +} diff --git a/DereTore.Applications.StarlightDirector.Entities/Properties/AssemblyInfo.cs b/StarlightDirector.Entities/Properties/AssemblyInfo.cs similarity index 80% rename from DereTore.Applications.StarlightDirector.Entities/Properties/AssemblyInfo.cs rename to StarlightDirector.Entities/Properties/AssemblyInfo.cs index 51fba10..a730ae6 100644 --- a/DereTore.Applications.StarlightDirector.Entities/Properties/AssemblyInfo.cs +++ b/StarlightDirector.Entities/Properties/AssemblyInfo.cs @@ -5,11 +5,11 @@ // 有关程序集的一般信息由以下 // 控制。更改这些特性值可修改 // 与程序集关联的信息。 -[assembly: AssemblyTitle("DereTore.Applications.StarlightDirector.Entities")] +[assembly: AssemblyTitle("StarlightDirector.Entities")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("DereTore.Applications.StarlightDirector.Entities")] +[assembly: AssemblyProduct("StarlightDirector.Entities")] [assembly: AssemblyCopyright("Copyright © 2016")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] @@ -22,7 +22,7 @@ // 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID [assembly: Guid("d78a4080-34f4-45ec-a8ef-87f95815e3bd")] -// 程序集的版本信息由下列四个值组成: +// 程序集的版本信息由下列四个值组成: // // 主版本 // 次版本 @@ -36,4 +36,4 @@ [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: InternalsVisibleTo("StarlightDirector")] -[assembly: InternalsVisibleTo("DereTore.Applications.StarlightDirector.Exchange")] +[assembly: InternalsVisibleTo("StarlightDirector.Exchange")] diff --git a/DereTore.Applications.StarlightDirector.Entities/Score.cs b/StarlightDirector.Entities/Score.cs similarity index 91% rename from DereTore.Applications.StarlightDirector.Entities/Score.cs rename to StarlightDirector.Entities/Score.cs index dcf69a6..61de4f1 100644 --- a/DereTore.Applications.StarlightDirector.Entities/Score.cs +++ b/StarlightDirector.Entities/Score.cs @@ -3,7 +3,7 @@ using Newtonsoft.Json; using Newtonsoft.Json.Serialization; -namespace DereTore.Applications.StarlightDirector.Entities { +namespace StarlightDirector.Entities { [JsonObject(NamingStrategyType = typeof(CamelCaseNamingStrategy), MemberSerialization = MemberSerialization.OptIn)] public sealed class Score { @@ -108,11 +108,11 @@ internal void ResolveReferences(Project project) { if (!note.IsGamingNote) { continue; } - if (note.NextFlickNoteID != EntityID.Invalid) { - note.NextFlickNote = FindNoteByID(note.NextFlickNoteID); + if (note.NextFlickOrSlideNoteID != EntityID.Invalid) { + note.NextFlickOrSlideNote = FindNoteByID(note.NextFlickOrSlideNoteID); } - if (note.PrevFlickNoteID != EntityID.Invalid) { - note.PrevFlickNote = FindNoteByID(note.PrevFlickNoteID); + if (note.PrevFlickOrSlideNoteID != EntityID.Invalid) { + note.PrevFlickOrSlideNote = FindNoteByID(note.PrevFlickOrSlideNoteID); } if (note.HoldTargetID != EntityID.Invalid) { note.HoldTarget = FindNoteByID(note.HoldTargetID); @@ -146,10 +146,8 @@ private Note FindNoteByID(int noteID) { return Bars.SelectMany(bar => bar.Notes).FirstOrDefault(note => note.ID == noteID); } - internal void UpdateBarTimings() - { - foreach (var bar in Bars) - { + internal void UpdateBarTimings() { + foreach (var bar in Bars) { bar.UpdateTimings(); } } diff --git a/DereTore.Applications.StarlightDirector.Entities/ScoreSettings.cs b/StarlightDirector.Entities/ScoreSettings.cs similarity index 98% rename from DereTore.Applications.StarlightDirector.Entities/ScoreSettings.cs rename to StarlightDirector.Entities/ScoreSettings.cs index 42a5e1e..fc0db15 100644 --- a/DereTore.Applications.StarlightDirector.Entities/ScoreSettings.cs +++ b/StarlightDirector.Entities/ScoreSettings.cs @@ -1,9 +1,10 @@ using System; using System.Windows; +using DereTore; using Newtonsoft.Json; using Newtonsoft.Json.Serialization; -namespace DereTore.Applications.StarlightDirector.Entities { +namespace StarlightDirector.Entities { [JsonObject(NamingStrategyType = typeof(CamelCaseNamingStrategy), MemberSerialization = MemberSerialization.OptIn)] public sealed class ScoreSettings : DependencyObject, ICloneable { diff --git a/DereTore.Applications.StarlightDirector.Entities/Serialization/ScoreCsvMap.cs b/StarlightDirector.Entities/Serialization/ScoreCsvMap.cs similarity index 96% rename from DereTore.Applications.StarlightDirector.Entities/Serialization/ScoreCsvMap.cs rename to StarlightDirector.Entities/Serialization/ScoreCsvMap.cs index 9917714..dcae379 100644 --- a/DereTore.Applications.StarlightDirector.Entities/Serialization/ScoreCsvMap.cs +++ b/StarlightDirector.Entities/Serialization/ScoreCsvMap.cs @@ -2,7 +2,7 @@ using CsvHelper.Configuration; using CsvHelper.TypeConversion; -namespace DereTore.Applications.StarlightDirector.Entities.Serialization { +namespace StarlightDirector.Entities.Serialization { public sealed class ScoreCsvMap : CsvClassMap { public ScoreCsvMap() { @@ -14,7 +14,7 @@ public ScoreCsvMap() { Map(m => m.FinishPosition).Name("finishPos").TypeConverter(); Map(m => m.FlickType).Name("status").TypeConverter(); Map(m => m.IsSync).Name("sync").TypeConverter(); - Map(m => m.FlickGroupID).Name("groupId"); + Map(m => m.GroupID).Name("groupId"); } private sealed class IntToBoolConverter : ITypeConverter { diff --git a/DereTore.Applications.StarlightDirector.Entities/DereTore.Applications.StarlightDirector.Entities.csproj b/StarlightDirector.Entities/StarlightDirector.Entities.csproj similarity index 93% rename from DereTore.Applications.StarlightDirector.Entities/DereTore.Applications.StarlightDirector.Entities.csproj rename to StarlightDirector.Entities/StarlightDirector.Entities.csproj index a179e5b..5bb4372 100644 --- a/DereTore.Applications.StarlightDirector.Entities/DereTore.Applications.StarlightDirector.Entities.csproj +++ b/StarlightDirector.Entities/StarlightDirector.Entities.csproj @@ -7,8 +7,8 @@ {D78A4080-34F4-45EC-A8EF-87F95815E3BD} Library Properties - DereTore.Applications.StarlightDirector.Entities - DereTore.Applications.StarlightDirector.Entities + StarlightDirector.Entities + StarlightDirector.Entities v4.0 512 @@ -97,14 +97,14 @@ - - {7fb2a631-88c4-4c6b-9e8b-8eeeb40575d0} - DereTore.Applications.StarlightDirector.Core - {dbd0da4a-0057-4d04-ad69-0e7267d72793} DereTore.Common + + {7fb2a631-88c4-4c6b-9e8b-8eeeb40575d0} + StarlightDirector.Core + diff --git a/DereTore.Applications.StarlightDirector.Entities/packages.config b/StarlightDirector.Entities/packages.config similarity index 100% rename from DereTore.Applications.StarlightDirector.Entities/packages.config rename to StarlightDirector.Entities/packages.config diff --git a/DereTore.Applications.StarlightDirector.Exchange/Deleste/CommandParameters/ChangeBpmCommandParameters.cs b/StarlightDirector.Exchange/Deleste/CommandParameters/ChangeBpmCommandParameters.cs similarity index 84% rename from DereTore.Applications.StarlightDirector.Exchange/Deleste/CommandParameters/ChangeBpmCommandParameters.cs rename to StarlightDirector.Exchange/Deleste/CommandParameters/ChangeBpmCommandParameters.cs index ccb2a91..c9d8aed 100644 --- a/DereTore.Applications.StarlightDirector.Exchange/Deleste/CommandParameters/ChangeBpmCommandParameters.cs +++ b/StarlightDirector.Exchange/Deleste/CommandParameters/ChangeBpmCommandParameters.cs @@ -1,6 +1,6 @@ using System; -namespace DereTore.Applications.StarlightDirector.Exchange.Deleste.CommandParameters { +namespace StarlightDirector.Exchange.Deleste.CommandParameters { internal sealed class ChangeBpmCommandParameters : ICloneable { public int StartMeasureIndex { get; set; } diff --git a/DereTore.Applications.StarlightDirector.Exchange/Deleste/Constants.cs b/StarlightDirector.Exchange/Deleste/Constants.cs similarity index 90% rename from DereTore.Applications.StarlightDirector.Exchange/Deleste/Constants.cs rename to StarlightDirector.Exchange/Deleste/Constants.cs index de58a73..43bbc2c 100644 --- a/DereTore.Applications.StarlightDirector.Exchange/Deleste/Constants.cs +++ b/StarlightDirector.Exchange/Deleste/Constants.cs @@ -1,4 +1,4 @@ -namespace DereTore.Applications.StarlightDirector.Exchange.Deleste { +namespace StarlightDirector.Exchange.Deleste { internal static class Constants { public static readonly string[] BeatmapCommands = { diff --git a/DereTore.Applications.StarlightDirector.Exchange/Deleste/DelesteBasicNote.cs b/StarlightDirector.Exchange/Deleste/DelesteBasicNote.cs similarity index 89% rename from DereTore.Applications.StarlightDirector.Exchange/Deleste/DelesteBasicNote.cs rename to StarlightDirector.Exchange/Deleste/DelesteBasicNote.cs index 19c34ef..098b1a7 100644 --- a/DereTore.Applications.StarlightDirector.Exchange/Deleste/DelesteBasicNote.cs +++ b/StarlightDirector.Exchange/Deleste/DelesteBasicNote.cs @@ -1,6 +1,6 @@ -using DereTore.Applications.StarlightDirector.Entities; +using StarlightDirector.Entities; -namespace DereTore.Applications.StarlightDirector.Exchange.Deleste { +namespace StarlightDirector.Exchange.Deleste { internal sealed class DelesteBasicNote { public DelesteBasicNote() diff --git a/DereTore.Applications.StarlightDirector.Exchange/Deleste/DelesteBeatmapEntry.cs b/StarlightDirector.Exchange/Deleste/DelesteBeatmapEntry.cs similarity index 87% rename from DereTore.Applications.StarlightDirector.Exchange/Deleste/DelesteBeatmapEntry.cs rename to StarlightDirector.Exchange/Deleste/DelesteBeatmapEntry.cs index ef4aeb7..4444605 100644 --- a/DereTore.Applications.StarlightDirector.Exchange/Deleste/DelesteBeatmapEntry.cs +++ b/StarlightDirector.Exchange/Deleste/DelesteBeatmapEntry.cs @@ -1,4 +1,4 @@ -namespace DereTore.Applications.StarlightDirector.Exchange.Deleste { +namespace StarlightDirector.Exchange.Deleste { internal sealed class DelesteBeatmapEntry { public int GroupID { get; set; } diff --git a/DereTore.Applications.StarlightDirector.Exchange/Deleste/DelesteCommand.cs b/StarlightDirector.Exchange/Deleste/DelesteCommand.cs similarity index 51% rename from DereTore.Applications.StarlightDirector.Exchange/Deleste/DelesteCommand.cs rename to StarlightDirector.Exchange/Deleste/DelesteCommand.cs index 173a791..c98bc44 100644 --- a/DereTore.Applications.StarlightDirector.Exchange/Deleste/DelesteCommand.cs +++ b/StarlightDirector.Exchange/Deleste/DelesteCommand.cs @@ -1,4 +1,4 @@ -namespace DereTore.Applications.StarlightDirector.Exchange.Deleste { +namespace StarlightDirector.Exchange.Deleste { internal enum DelesteCommand { None, diff --git a/DereTore.Applications.StarlightDirector.Exchange/Deleste/DelesteGroupID.cs b/StarlightDirector.Exchange/Deleste/DelesteGroupID.cs similarity index 72% rename from DereTore.Applications.StarlightDirector.Exchange/Deleste/DelesteGroupID.cs rename to StarlightDirector.Exchange/Deleste/DelesteGroupID.cs index 6b6afe0..cdee381 100644 --- a/DereTore.Applications.StarlightDirector.Exchange/Deleste/DelesteGroupID.cs +++ b/StarlightDirector.Exchange/Deleste/DelesteGroupID.cs @@ -1,4 +1,4 @@ -namespace DereTore.Applications.StarlightDirector.Exchange.Deleste { +namespace StarlightDirector.Exchange.Deleste { internal static class DelesteGroupID { public static bool IsSupportedGroup(int groupID) { diff --git a/DereTore.Applications.StarlightDirector.Exchange/Deleste/DelesteHelper.cs b/StarlightDirector.Exchange/Deleste/DelesteHelper.cs similarity index 97% rename from DereTore.Applications.StarlightDirector.Exchange/Deleste/DelesteHelper.cs rename to StarlightDirector.Exchange/Deleste/DelesteHelper.cs index bcdc64b..e9d7def 100644 --- a/DereTore.Applications.StarlightDirector.Exchange/Deleste/DelesteHelper.cs +++ b/StarlightDirector.Exchange/Deleste/DelesteHelper.cs @@ -3,12 +3,13 @@ using System.IO; using System.Linq; using System.Text; -using DereTore.Applications.StarlightDirector.Entities; -using DereTore.Applications.StarlightDirector.Entities.Extensions; -using DereTore.Applications.StarlightDirector.Exchange.Deleste.CommandParameters; -using DereTore.Applications.StarlightDirector.Exchange.Properties; +using DereTore; +using StarlightDirector.Entities; +using StarlightDirector.Entities.Extensions; +using StarlightDirector.Exchange.Deleste.CommandParameters; +using StarlightDirector.Exchange.Properties; -namespace DereTore.Applications.StarlightDirector.Exchange.Deleste { +namespace StarlightDirector.Exchange.Deleste { internal static class DelesteHelper { public static void AnalyzeBeatmap(Score score, List entries, DelesteState initialState, List warnings) { @@ -280,7 +281,7 @@ public static Encoding TryDetectBeatmapEncoding(string fileName) { return Encoding.UTF8; } else { // According to the help of Deleste: - // + // // > 譜面ファイルの文字コードは原則「Shift-JIS」を使用してください。 // > 例外的に「UTF-8」のみ使用できます。 // > 使用する場合、テキストファイルの先頭に「#utf8」又は「#utf-8」と記述してください。 @@ -357,7 +358,7 @@ public static void WriteEntries(Score score, StreamWriter writer) { if (!Note.IsTypeGaming(compiledNote.Type)) { continue; } - writer.WriteLine("#{0},{1:000.000000}:{2}:{3}:{4}", compiledNote.FlickGroupID, compiledNote.HitTiming, (int)TranslateNoteType(compiledNote), (int)compiledNote.StartPosition, (int)compiledNote.FinishPosition); + writer.WriteLine("#{0},{1:000.000000}:{2}:{3}:{4}", compiledNote.GroupID, compiledNote.HitTiming, (int)TranslateNoteType(compiledNote), (int)compiledNote.StartPosition, (int)compiledNote.FinishPosition); } } diff --git a/DereTore.Applications.StarlightDirector.Exchange/Deleste/DelesteHelperExtensions.cs b/StarlightDirector.Exchange/Deleste/DelesteHelperExtensions.cs similarity index 76% rename from DereTore.Applications.StarlightDirector.Exchange/Deleste/DelesteHelperExtensions.cs rename to StarlightDirector.Exchange/Deleste/DelesteHelperExtensions.cs index fac370e..d247247 100644 --- a/DereTore.Applications.StarlightDirector.Exchange/Deleste/DelesteHelperExtensions.cs +++ b/StarlightDirector.Exchange/Deleste/DelesteHelperExtensions.cs @@ -1,6 +1,6 @@ using System.Linq; -namespace DereTore.Applications.StarlightDirector.Exchange.Deleste { +namespace StarlightDirector.Exchange.Deleste { internal static class DelesteHelperExtensions { public static bool StartsWithOfGroup(this string str, string[] group) { diff --git a/DereTore.Applications.StarlightDirector.Exchange/Deleste/DelesteNoteType.cs b/StarlightDirector.Exchange/Deleste/DelesteNoteType.cs similarity index 66% rename from DereTore.Applications.StarlightDirector.Exchange/Deleste/DelesteNoteType.cs rename to StarlightDirector.Exchange/Deleste/DelesteNoteType.cs index 83d075a..922390d 100644 --- a/DereTore.Applications.StarlightDirector.Exchange/Deleste/DelesteNoteType.cs +++ b/StarlightDirector.Exchange/Deleste/DelesteNoteType.cs @@ -1,4 +1,4 @@ -namespace DereTore.Applications.StarlightDirector.Exchange.Deleste { +namespace StarlightDirector.Exchange.Deleste { internal enum DelesteNoteType { Null = 0, diff --git a/DereTore.Applications.StarlightDirector.Exchange/Deleste/DelesteState.cs b/StarlightDirector.Exchange/Deleste/DelesteState.cs similarity index 85% rename from DereTore.Applications.StarlightDirector.Exchange/Deleste/DelesteState.cs rename to StarlightDirector.Exchange/Deleste/DelesteState.cs index 3b16316..d703fe7 100644 --- a/DereTore.Applications.StarlightDirector.Exchange/Deleste/DelesteState.cs +++ b/StarlightDirector.Exchange/Deleste/DelesteState.cs @@ -1,6 +1,6 @@ using System; -namespace DereTore.Applications.StarlightDirector.Exchange.Deleste { +namespace StarlightDirector.Exchange.Deleste { internal sealed class DelesteState : ICloneable { public double BPM { get; set; } diff --git a/DereTore.Applications.StarlightDirector.Exchange/ProjectIO.Legacy.cs b/StarlightDirector.Exchange/ProjectIO.Legacy.cs similarity index 97% rename from DereTore.Applications.StarlightDirector.Exchange/ProjectIO.Legacy.cs rename to StarlightDirector.Exchange/ProjectIO.Legacy.cs index 4691505..c72c7eb 100644 --- a/DereTore.Applications.StarlightDirector.Exchange/ProjectIO.Legacy.cs +++ b/StarlightDirector.Exchange/ProjectIO.Legacy.cs @@ -6,14 +6,15 @@ using System.IO; using System.Linq; using System.Text; -using DereTore.Applications.StarlightDirector.Entities; +using DereTore; using Newtonsoft.Json; using Newtonsoft.Json.Linq; +using StarlightDirector.Entities; -namespace DereTore.Applications.StarlightDirector.Exchange { +namespace StarlightDirector.Exchange { partial class ProjectIO { - internal static ProjectVersion CheckProjectFileVersion(string fileName) { + internal static int CheckProjectFileVersion(string fileName) { try { using (var fileStream = File.Open(fileName, FileMode.Open, FileAccess.Read)) { var buffer = new byte[128]; @@ -74,6 +75,8 @@ internal static ProjectVersion CheckProjectFileVersion(string fileName) { return ProjectVersion.V0_2; } else if (v.Equals(0.3)) { return ProjectVersion.V0_3; + } else if (v.Equals(ProjectVersion.V0_3_1)) { + return ProjectVersion.V0_3_1; } else { return ProjectVersion.Unknown; } diff --git a/DereTore.Applications.StarlightDirector.Exchange/ProjectIO.Names.cs b/StarlightDirector.Exchange/ProjectIO.Names.cs similarity index 97% rename from DereTore.Applications.StarlightDirector.Exchange/ProjectIO.Names.cs rename to StarlightDirector.Exchange/ProjectIO.Names.cs index c2952a5..4161a0c 100644 --- a/DereTore.Applications.StarlightDirector.Exchange/ProjectIO.Names.cs +++ b/StarlightDirector.Exchange/ProjectIO.Names.cs @@ -1,4 +1,4 @@ -namespace DereTore.Applications.StarlightDirector.Exchange { +namespace StarlightDirector.Exchange { static partial class ProjectIO { private static class Names { diff --git a/DereTore.Applications.StarlightDirector.Exchange/ProjectIO.SQLiteHelper.cs b/StarlightDirector.Exchange/ProjectIO.SQLiteHelper.cs similarity index 96% rename from DereTore.Applications.StarlightDirector.Exchange/ProjectIO.SQLiteHelper.cs rename to StarlightDirector.Exchange/ProjectIO.SQLiteHelper.cs index 4f3b9bb..d352327 100644 --- a/DereTore.Applications.StarlightDirector.Exchange/ProjectIO.SQLiteHelper.cs +++ b/StarlightDirector.Exchange/ProjectIO.SQLiteHelper.cs @@ -1,10 +1,9 @@ -using System; -using System.Collections.Specialized; +using System.Collections.Specialized; using System.Data; using System.Data.SQLite; -using DereTore.Applications.StarlightDirector.Entities; +using StarlightDirector.Entities; -namespace DereTore.Applications.StarlightDirector.Exchange { +namespace StarlightDirector.Exchange { static partial class ProjectIO { private static class SQLiteHelper { @@ -185,7 +184,7 @@ public static void CreateScoresTable(SQLiteConnection connection) { command.ExecuteNonQuery(); command.CommandText = $@"CREATE TABLE {Names.Table_Notes} ( {Names.Column_ID} INTEGER PRIMARY KEY NOT NULL, {Names.Column_Difficulty} INTEGER NOT NULL, {Names.Column_BarIndex} INTEGER NOT NULL, {Names.Column_IndexInGrid} INTEGER NOT NULL, -{Names.Column_StartPosition} INTEGER NOT NULL, {Names.Column_FinishPosition} INTEGER NOT NULL, {Names.Column_FlickType} INTEGER NOT NULL, +{Names.Column_NoteType} INTEGER NOT NULL, {Names.Column_StartPosition} INTEGER NOT NULL, {Names.Column_FinishPosition} INTEGER NOT NULL, {Names.Column_FlickType} INTEGER NOT NULL, {Names.Column_PrevFlickNoteID} INTEGER NOT NULL, {Names.Column_NextFlickNoteID} NOT NULL, {Names.Column_SyncTargetID} INTEGER NOT NULL, {Names.Column_HoldTargetID} INTEGER NOT NULL, FOREIGN KEY ({Names.Column_ID}) REFERENCES {Names.Table_NoteIDs}({Names.Column_ID}), FOREIGN KEY ({Names.Column_PrevFlickNoteID}) REFERENCES {Names.Table_NoteIDs}({Names.Column_ID}), FOREIGN KEY ({Names.Column_NextFlickNoteID}) REFERENCES {Names.Table_NoteIDs}({Names.Column_ID}), FOREIGN KEY ({Names.Column_SyncTargetID}) REFERENCES {Names.Table_NoteIDs}({Names.Column_ID}), @@ -216,13 +215,14 @@ public static void InsertNote(SQLiteConnection connection, Note note, ref SQLite if (command == null) { command = connection.CreateCommand(); command.CommandText = $@"INSERT INTO {Names.Table_Notes} ( -{Names.Column_ID}, {Names.Column_Difficulty}, {Names.Column_BarIndex}, {Names.Column_IndexInGrid}, {Names.Column_StartPosition}, {Names.Column_FinishPosition}, +{Names.Column_ID}, {Names.Column_Difficulty}, {Names.Column_BarIndex}, {Names.Column_IndexInGrid}, {Names.Column_NoteType}, {Names.Column_StartPosition}, {Names.Column_FinishPosition}, {Names.Column_FlickType}, {Names.Column_PrevFlickNoteID}, {Names.Column_NextFlickNoteID}, {Names.Column_SyncTargetID}, {Names.Column_HoldTargetID} -) VALUES (@id, @difficulty, @bar, @grid, @start, @finish, @flick, @prev_flick, @next_flick, @sync, @hold);"; +) VALUES (@id, @difficulty, @bar, @grid, @note_type, @start, @finish, @flick, @prev_flick, @next_flick, @sync, @hold);"; command.Parameters.Add("id", DbType.Int32); command.Parameters.Add("difficulty", DbType.Int32); command.Parameters.Add("bar", DbType.Int32); command.Parameters.Add("grid", DbType.Int32); + command.Parameters.Add("note_type", DbType.Int32); command.Parameters.Add("start", DbType.Int32); command.Parameters.Add("finish", DbType.Int32); command.Parameters.Add("flick", DbType.Int32); @@ -235,11 +235,12 @@ public static void InsertNote(SQLiteConnection connection, Note note, ref SQLite command.Parameters["difficulty"].Value = note.Bar.Score.Difficulty; command.Parameters["bar"].Value = note.Bar.Index; command.Parameters["grid"].Value = note.IndexInGrid; + command.Parameters["note_type"].Value = (int)note.Type; command.Parameters["start"].Value = (int)note.StartPosition; command.Parameters["finish"].Value = (int)note.FinishPosition; command.Parameters["flick"].Value = (int)note.FlickType; - command.Parameters["prev_flick"].Value = note.PrevFlickNoteID; - command.Parameters["next_flick"].Value = note.NextFlickNoteID; + command.Parameters["prev_flick"].Value = note.PrevFlickOrSlideNoteID; + command.Parameters["next_flick"].Value = note.NextFlickOrSlideNoteID; command.Parameters["sync"].Value = note.SyncTargetID; command.Parameters["hold"].Value = note.HoldTargetID; command.ExecuteNonQuery(); @@ -281,6 +282,7 @@ public static void InsertSpecialNote(SQLiteConnection connection, Note note, ref command.Parameters.Add("bar", DbType.Int32); command.Parameters.Add("grid", DbType.Int32); command.Parameters.Add("type", DbType.Int32); + // Parameter values command.Parameters.Add("pv", DbType.AnsiString); } command.Parameters["id"].Value = note.ID; diff --git a/DereTore.Applications.StarlightDirector.Exchange/ProjectIO.cs b/StarlightDirector.Exchange/ProjectIO.cs similarity index 88% rename from DereTore.Applications.StarlightDirector.Exchange/ProjectIO.cs rename to StarlightDirector.Exchange/ProjectIO.cs index c332514..6c04f45 100644 --- a/DereTore.Applications.StarlightDirector.Exchange/ProjectIO.cs +++ b/StarlightDirector.Exchange/ProjectIO.cs @@ -6,9 +6,9 @@ using System.Globalization; using System.IO; using System.Linq; -using DereTore.Applications.StarlightDirector.Entities; +using StarlightDirector.Entities; -namespace DereTore.Applications.StarlightDirector.Exchange { +namespace StarlightDirector.Exchange { public static partial class ProjectIO { public static void Save(Project project) { @@ -30,7 +30,7 @@ public static Project Load(string fileName) { return Load(fileName, version); } - internal static Project Load(string fileName, ProjectVersion versionOverride) { + internal static Project Load(string fileName, int versionOverride) { Project project = null; switch (versionOverride) { case ProjectVersion.Unknown: @@ -41,10 +41,16 @@ internal static Project Load(string fileName, ProjectVersion versionOverride) { case ProjectVersion.V0_2: project = LoadFromV02(fileName); break; + case ProjectVersion.V0_3: + // Note (2017-Feb-28): + // Slide note is added to CGSS a month before. SLDPROJ format v0.3.1 uses the "prev_flick" and "next_flick" fields to + // store slide notes relation info, because slide and flick notes have similar behaviors and they can be distinguished + // by the "type" field. So v0.3.1 is a super set of v0.3. The exceptions are handled in ReadScore() (see below). + break; } if (project == null) - project = LoadCurrentVersion(fileName); + project = LoadFromV03x(fileName); // Update bar timings, sort notes foreach (var difficulty in Difficulties) { @@ -145,7 +151,7 @@ private static void Save(Project project, string fileName, bool createNewDatabas } } - private static Project LoadCurrentVersion(string fileName) { + private static Project LoadFromV03x(string fileName) { var fileInfo = new FileInfo(fileName); if (!fileInfo.Exists) { throw new FileNotFoundException(string.Empty, fileName); @@ -164,12 +170,23 @@ private static Project LoadCurrentVersion(string fileName) { // Main var mainValues = SQLiteHelper.GetValues(connection, Names.Table_Main, ref getValues); project.MusicFileName = mainValues[Names.Field_MusicFileName]; - project.Version = mainValues[Names.Field_Version]; + var projectVersionString = mainValues[Names.Field_Version]; + float fProjectVersion; + float.TryParse(projectVersionString, out fProjectVersion); + if (fProjectVersion <= 0) { + Debug.Print("WARNING: incorrect project version: {0}", projectVersionString); + fProjectVersion = ProjectVersion.Current; + } + if (fProjectVersion < 1) { + fProjectVersion *= 1000; + } + var projectVersion = (int)fProjectVersion; + // Keep project.Version property having the newest project version. // Scores foreach (var difficulty in Difficulties) { var score = new Score(project, difficulty); - ReadScore(connection, score); + ReadScore(connection, score, projectVersion); score.ResolveReferences(project); score.FixSyncNotes(); score.Difficulty = difficulty; @@ -258,9 +275,12 @@ private static void GridLineFixup(Project project) { } } - private static void ReadScore(SQLiteConnection connection, Score score) { + private static void ReadScore(SQLiteConnection connection, Score score, int projectVersion) { using (var table = new DataTable()) { SQLiteHelper.ReadNotesTable(connection, score.Difficulty, table); + // v0.3.1: "note_type" + // Only flick existed when there is a flick-alike relation. Now, both flick and slide are possible. + var hasNoteTypeColumn = projectVersion >= ProjectVersion.V0_3_1; foreach (DataRow row in table.Rows) { var id = (int)(long)row[Names.Column_ID]; var barIndex = (int)(long)row[Names.Column_BarIndex]; @@ -271,6 +291,7 @@ private static void ReadScore(SQLiteConnection connection, Score score) { var prevFlick = (int)(long)row[Names.Column_PrevFlickNoteID]; var nextFlick = (int)(long)row[Names.Column_NextFlickNoteID]; var hold = (int)(long)row[Names.Column_HoldTargetID]; + var noteType = hasNoteTypeColumn ? (NoteType)(long)row[Names.Column_NoteType] : NoteType.TapOrFlick; EnsureBarIndex(score, barIndex); var bar = score.Bars[barIndex]; @@ -279,12 +300,13 @@ private static void ReadScore(SQLiteConnection connection, Score score) { note.IndexInGrid = grid; note.StartPosition = start; note.FinishPosition = finish; + note.Type = noteType; note.FlickType = flick; - note.PrevFlickNoteID = prevFlick; - note.NextFlickNoteID = nextFlick; + note.PrevFlickOrSlideNoteID = prevFlick; + note.NextFlickOrSlideNoteID = nextFlick; note.HoldTargetID = hold; } else { - Debug.Print("Note with id {0} already exists.", id); + Debug.Print("Note with ID '{0}' already exists.", id); } } } diff --git a/DereTore.Applications.StarlightDirector.Exchange/Properties/AssemblyInfo.cs b/StarlightDirector.Exchange/Properties/AssemblyInfo.cs similarity index 88% rename from DereTore.Applications.StarlightDirector.Exchange/Properties/AssemblyInfo.cs rename to StarlightDirector.Exchange/Properties/AssemblyInfo.cs index 7a9efb0..fb3a1b1 100644 --- a/DereTore.Applications.StarlightDirector.Exchange/Properties/AssemblyInfo.cs +++ b/StarlightDirector.Exchange/Properties/AssemblyInfo.cs @@ -5,11 +5,11 @@ // 有关程序集的一般信息由以下 // 控制。更改这些特性值可修改 // 与程序集关联的信息。 -[assembly: AssemblyTitle("DereTore.Applications.StarlightDirector.Exchange")] +[assembly: AssemblyTitle("StarlightDirector.Exchange")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("DereTore.Applications.StarlightDirector.Exchange")] +[assembly: AssemblyProduct("StarlightDirector.Exchange")] [assembly: AssemblyCopyright("Copyright © 2016")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] diff --git a/DereTore.Applications.StarlightDirector.Exchange/Properties/Resources.Designer.cs b/StarlightDirector.Exchange/Properties/Resources.Designer.cs similarity index 95% rename from DereTore.Applications.StarlightDirector.Exchange/Properties/Resources.Designer.cs rename to StarlightDirector.Exchange/Properties/Resources.Designer.cs index 9379967..a8245c2 100644 --- a/DereTore.Applications.StarlightDirector.Exchange/Properties/Resources.Designer.cs +++ b/StarlightDirector.Exchange/Properties/Resources.Designer.cs @@ -8,7 +8,7 @@ // //------------------------------------------------------------------------------ -namespace DereTore.Applications.StarlightDirector.Exchange.Properties { +namespace StarlightDirector.Exchange.Properties { using System; @@ -39,7 +39,7 @@ internal Resources() { internal static global::System.Resources.ResourceManager ResourceManager { get { if (object.ReferenceEquals(resourceMan, null)) { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("DereTore.Applications.StarlightDirector.Exchange.Properties.Resources", typeof(Resources).Assembly); + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("StarlightDirector.Exchange.Properties.Resources", typeof(Resources).Assembly); resourceMan = temp; } return resourceMan; diff --git a/DereTore.Applications.StarlightDirector.Exchange/Properties/Resources.resx b/StarlightDirector.Exchange/Properties/Resources.resx similarity index 100% rename from DereTore.Applications.StarlightDirector.Exchange/Properties/Resources.resx rename to StarlightDirector.Exchange/Properties/Resources.resx diff --git a/DereTore.Applications.StarlightDirector.Exchange/ScoreIO.cs b/StarlightDirector.Exchange/ScoreIO.cs similarity index 93% rename from DereTore.Applications.StarlightDirector.Exchange/ScoreIO.cs rename to StarlightDirector.Exchange/ScoreIO.cs index a425377..6dde998 100644 --- a/DereTore.Applications.StarlightDirector.Exchange/ScoreIO.cs +++ b/StarlightDirector.Exchange/ScoreIO.cs @@ -1,10 +1,10 @@ using System.Collections.Generic; using System.IO; using System.Text; -using DereTore.Applications.StarlightDirector.Entities; -using DereTore.Applications.StarlightDirector.Exchange.Deleste; +using StarlightDirector.Entities; +using StarlightDirector.Exchange.Deleste; -namespace DereTore.Applications.StarlightDirector.Exchange { +namespace StarlightDirector.Exchange { public static class ScoreIO { public static Score LoadFromDelesteBeatmap(Project temporaryProject, Difficulty difficulty, string fileName, out string[] warnings, out bool hasErrors) { diff --git a/DereTore.Applications.StarlightDirector.Exchange/DereTore.Applications.StarlightDirector.Exchange.csproj b/StarlightDirector.Exchange/StarlightDirector.Exchange.csproj similarity index 83% rename from DereTore.Applications.StarlightDirector.Exchange/DereTore.Applications.StarlightDirector.Exchange.csproj rename to StarlightDirector.Exchange/StarlightDirector.Exchange.csproj index 3c61263..b3797ea 100644 --- a/DereTore.Applications.StarlightDirector.Exchange/DereTore.Applications.StarlightDirector.Exchange.csproj +++ b/StarlightDirector.Exchange/StarlightDirector.Exchange.csproj @@ -7,8 +7,8 @@ {3ECDD0BB-215A-4437-B162-FC9D9285303D} Library Properties - DereTore.Applications.StarlightDirector.Exchange - DereTore.Applications.StarlightDirector.Exchange + StarlightDirector.Exchange + StarlightDirector.Exchange v4.0 512 @@ -57,8 +57,8 @@ - - ..\packages\System.Data.SQLite.Core.1.0.103\lib\net40\System.Data.SQLite.dll + + ..\packages\System.Data.SQLite.Core.1.0.104.0\lib\net40\System.Data.SQLite.dll True @@ -92,18 +92,18 @@ - - {7fb2a631-88c4-4c6b-9e8b-8eeeb40575d0} - DereTore.Applications.StarlightDirector.Core - - - {d78a4080-34f4-45ec-a8ef-87f95815e3bd} - DereTore.Applications.StarlightDirector.Entities - {dbd0da4a-0057-4d04-ad69-0e7267d72793} DereTore.Common + + {7fb2a631-88c4-4c6b-9e8b-8eeeb40575d0} + StarlightDirector.Core + + + {d78a4080-34f4-45ec-a8ef-87f95815e3bd} + StarlightDirector.Entities + @@ -116,12 +116,12 @@ - + 这台计算机上缺少此项目引用的 NuGet 程序包。使用“NuGet 程序包还原”可下载这些程序包。有关更多信息,请参见 http://go.microsoft.com/fwlink/?LinkID=322105。缺少的文件是 {0}。 - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/DereTore.Applications.StarlightDirector/UI/Controls/Primitives/ScoreNote.xaml.cs b/StarlightDirector/UI/Controls/Primitives/ScoreNote.xaml.cs similarity index 83% rename from DereTore.Applications.StarlightDirector/UI/Controls/Primitives/ScoreNote.xaml.cs rename to StarlightDirector/UI/Controls/Primitives/ScoreNote.xaml.cs index 990478c..2717cd5 100644 --- a/DereTore.Applications.StarlightDirector/UI/Controls/Primitives/ScoreNote.xaml.cs +++ b/StarlightDirector/UI/Controls/Primitives/ScoreNote.xaml.cs @@ -1,6 +1,6 @@ using System.Windows; -namespace DereTore.Applications.StarlightDirector.UI.Controls.Primitives { +namespace StarlightDirector.UI.Controls.Primitives { public partial class ScoreNote { public ScoreNote() { diff --git a/DereTore.Applications.StarlightDirector/UI/Controls/Primitives/ScrollViewerThumbnail.DependencyProperties.cs b/StarlightDirector/UI/Controls/Primitives/ScrollViewerThumbnail.DependencyProperties.cs similarity index 95% rename from DereTore.Applications.StarlightDirector/UI/Controls/Primitives/ScrollViewerThumbnail.DependencyProperties.cs rename to StarlightDirector/UI/Controls/Primitives/ScrollViewerThumbnail.DependencyProperties.cs index 5db1e86..ebbfb5b 100644 --- a/DereTore.Applications.StarlightDirector/UI/Controls/Primitives/ScrollViewerThumbnail.DependencyProperties.cs +++ b/StarlightDirector/UI/Controls/Primitives/ScrollViewerThumbnail.DependencyProperties.cs @@ -2,7 +2,7 @@ using System.Windows.Controls; using System.Windows.Media; -namespace DereTore.Applications.StarlightDirector.UI.Controls.Primitives { +namespace StarlightDirector.UI.Controls.Primitives { // http://www.thejoyofcode.com/Controllerizing_the_ScrollViewer_Thumbnail.aspx partial class ScrollViewerThumbnail { diff --git a/StarlightDirector/UI/Controls/Primitives/ScrollViewerThumbnail.xaml b/StarlightDirector/UI/Controls/Primitives/ScrollViewerThumbnail.xaml new file mode 100644 index 0000000..9f185a5 --- /dev/null +++ b/StarlightDirector/UI/Controls/Primitives/ScrollViewerThumbnail.xaml @@ -0,0 +1,20 @@ + + + + + + + + + + + + diff --git a/DereTore.Applications.StarlightDirector/UI/Controls/Primitives/ScrollViewerThumbnail.xaml.cs b/StarlightDirector/UI/Controls/Primitives/ScrollViewerThumbnail.xaml.cs similarity index 95% rename from DereTore.Applications.StarlightDirector/UI/Controls/Primitives/ScrollViewerThumbnail.xaml.cs rename to StarlightDirector/UI/Controls/Primitives/ScrollViewerThumbnail.xaml.cs index 31f576f..f786498 100644 --- a/DereTore.Applications.StarlightDirector/UI/Controls/Primitives/ScrollViewerThumbnail.xaml.cs +++ b/StarlightDirector/UI/Controls/Primitives/ScrollViewerThumbnail.xaml.cs @@ -2,7 +2,7 @@ using System.Windows.Controls; using System.Windows.Media; -namespace DereTore.Applications.StarlightDirector.UI.Controls.Primitives { +namespace StarlightDirector.UI.Controls.Primitives { public partial class ScrollViewerThumbnail { public ScrollViewerThumbnail() { diff --git a/DereTore.Applications.StarlightDirector/UI/Controls/Primitives/SpecialNotePointer.Commands.cs b/StarlightDirector/UI/Controls/Primitives/SpecialNotePointer.Commands.cs similarity index 91% rename from DereTore.Applications.StarlightDirector/UI/Controls/Primitives/SpecialNotePointer.Commands.cs rename to StarlightDirector/UI/Controls/Primitives/SpecialNotePointer.Commands.cs index 9a80c22..685a3a2 100644 --- a/DereTore.Applications.StarlightDirector/UI/Controls/Primitives/SpecialNotePointer.Commands.cs +++ b/StarlightDirector/UI/Controls/Primitives/SpecialNotePointer.Commands.cs @@ -1,9 +1,9 @@ using System.Globalization; using System.Windows.Input; -using DereTore.Applications.StarlightDirector.Entities; -using DereTore.Applications.StarlightDirector.Extensions; +using StarlightDirector.Entities; +using StarlightDirector.Extensions; -namespace DereTore.Applications.StarlightDirector.UI.Controls.Primitives { +namespace StarlightDirector.UI.Controls.Primitives { partial class SpecialNotePointer { public static readonly ICommand CmdDeleteThis = CommandHelper.RegisterCommand(); diff --git a/DereTore.Applications.StarlightDirector/UI/Controls/Primitives/SpecialNotePointer.DependencyProperties.cs b/StarlightDirector/UI/Controls/Primitives/SpecialNotePointer.DependencyProperties.cs similarity index 95% rename from DereTore.Applications.StarlightDirector/UI/Controls/Primitives/SpecialNotePointer.DependencyProperties.cs rename to StarlightDirector/UI/Controls/Primitives/SpecialNotePointer.DependencyProperties.cs index e56a57b..2ed8ab6 100644 --- a/DereTore.Applications.StarlightDirector/UI/Controls/Primitives/SpecialNotePointer.DependencyProperties.cs +++ b/StarlightDirector/UI/Controls/Primitives/SpecialNotePointer.DependencyProperties.cs @@ -1,9 +1,9 @@ using System.Diagnostics; using System.Windows; using System.Windows.Controls; -using DereTore.Applications.StarlightDirector.Entities; +using StarlightDirector.Entities; -namespace DereTore.Applications.StarlightDirector.UI.Controls.Primitives { +namespace StarlightDirector.UI.Controls.Primitives { partial class SpecialNotePointer { public Note Note { diff --git a/DereTore.Applications.StarlightDirector/UI/Controls/Primitives/SpecialNotePointer.xaml b/StarlightDirector/UI/Controls/Primitives/SpecialNotePointer.xaml similarity index 92% rename from DereTore.Applications.StarlightDirector/UI/Controls/Primitives/SpecialNotePointer.xaml rename to StarlightDirector/UI/Controls/Primitives/SpecialNotePointer.xaml index e3862db..db738be 100644 --- a/DereTore.Applications.StarlightDirector/UI/Controls/Primitives/SpecialNotePointer.xaml +++ b/StarlightDirector/UI/Controls/Primitives/SpecialNotePointer.xaml @@ -1,11 +1,10 @@ - diff --git a/DereTore.Applications.StarlightDirector/UI/Controls/Primitives/SpecialNotePointer.xaml.cs b/StarlightDirector/UI/Controls/Primitives/SpecialNotePointer.xaml.cs similarity index 84% rename from DereTore.Applications.StarlightDirector/UI/Controls/Primitives/SpecialNotePointer.xaml.cs rename to StarlightDirector/UI/Controls/Primitives/SpecialNotePointer.xaml.cs index 90e8821..c70e372 100644 --- a/DereTore.Applications.StarlightDirector/UI/Controls/Primitives/SpecialNotePointer.xaml.cs +++ b/StarlightDirector/UI/Controls/Primitives/SpecialNotePointer.xaml.cs @@ -1,8 +1,8 @@ using System; using System.Windows; -using DereTore.Applications.StarlightDirector.Extensions; +using StarlightDirector.Extensions; -namespace DereTore.Applications.StarlightDirector.UI.Controls.Primitives { +namespace StarlightDirector.UI.Controls.Primitives { public partial class SpecialNotePointer { public SpecialNotePointer() { diff --git a/DereTore.Applications.StarlightDirector/UI/Controls/ScoreEditor.DependencyProperties.cs b/StarlightDirector/UI/Controls/ScoreEditor.DependencyProperties.cs similarity index 90% rename from DereTore.Applications.StarlightDirector/UI/Controls/ScoreEditor.DependencyProperties.cs rename to StarlightDirector/UI/Controls/ScoreEditor.DependencyProperties.cs index f5cd34d..107d866 100644 --- a/DereTore.Applications.StarlightDirector/UI/Controls/ScoreEditor.DependencyProperties.cs +++ b/StarlightDirector/UI/Controls/ScoreEditor.DependencyProperties.cs @@ -1,9 +1,8 @@ using System.Windows; -using System.Windows.Controls; using System.Windows.Input; -using DereTore.Applications.StarlightDirector.Entities; +using StarlightDirector.Entities; -namespace DereTore.Applications.StarlightDirector.UI.Controls { +namespace StarlightDirector.UI.Controls { partial class ScoreEditor { public EditMode EditMode { diff --git a/DereTore.Applications.StarlightDirector/UI/Controls/ScoreEditor.Editing.cs b/StarlightDirector/UI/Controls/ScoreEditor.Editing.cs similarity index 98% rename from DereTore.Applications.StarlightDirector/UI/Controls/ScoreEditor.Editing.cs rename to StarlightDirector/UI/Controls/ScoreEditor.Editing.cs index d078f11..3c59c0b 100644 --- a/DereTore.Applications.StarlightDirector/UI/Controls/ScoreEditor.Editing.cs +++ b/StarlightDirector/UI/Controls/ScoreEditor.Editing.cs @@ -2,11 +2,10 @@ using System.Collections.Generic; using System.Diagnostics; using System.Linq; -using DereTore.Applications.StarlightDirector.Entities; -using DereTore.Applications.StarlightDirector.Entities.Extensions; -using DereTore.Applications.StarlightDirector.UI.Controls.Primitives; +using StarlightDirector.Entities; +using StarlightDirector.UI.Controls.Primitives; -namespace DereTore.Applications.StarlightDirector.UI.Controls { +namespace StarlightDirector.UI.Controls { partial class ScoreEditor { public ScoreBar AppendScoreBar() { diff --git a/DereTore.Applications.StarlightDirector/UI/Controls/ScoreEditor.EventHandlers.cs b/StarlightDirector/UI/Controls/ScoreEditor.EventHandlers.cs similarity index 96% rename from DereTore.Applications.StarlightDirector/UI/Controls/ScoreEditor.EventHandlers.cs rename to StarlightDirector/UI/Controls/ScoreEditor.EventHandlers.cs index 2b122eb..23063f6 100644 --- a/DereTore.Applications.StarlightDirector/UI/Controls/ScoreEditor.EventHandlers.cs +++ b/StarlightDirector/UI/Controls/ScoreEditor.EventHandlers.cs @@ -4,12 +4,12 @@ using System.Windows.Controls; using System.Windows.Input; using System.Windows.Media; -using DereTore.Applications.StarlightDirector.Entities; -using DereTore.Applications.StarlightDirector.Entities.Extensions; -using DereTore.Applications.StarlightDirector.Extensions; -using DereTore.Applications.StarlightDirector.UI.Controls.Primitives; +using StarlightDirector.Entities; +using StarlightDirector.Entities.Extensions; +using StarlightDirector.Extensions; +using StarlightDirector.UI.Controls.Primitives; -namespace DereTore.Applications.StarlightDirector.UI.Controls { +namespace StarlightDirector.UI.Controls { partial class ScoreEditor { private void BarLayer_OnSizeChanged(object sender, SizeChangedEventArgs e) { @@ -120,11 +120,11 @@ private void ScoreNote_MouseUp(object sender, MouseButtonEventArgs e) { if (mode == EditMode.Clear) { ns.Reset(); LineLayer.NoteRelations.RemoveAll(start, NoteRelation.Hold); - LineLayer.NoteRelations.RemoveAll(start, NoteRelation.Flick); + LineLayer.NoteRelations.RemoveAll(start, NoteRelation.FlickOrSlide); if (!start.Equals(end)) { ne.Reset(); LineLayer.NoteRelations.RemoveAll(end, NoteRelation.Hold); - LineLayer.NoteRelations.RemoveAll(end, NoteRelation.Flick); + LineLayer.NoteRelations.RemoveAll(end, NoteRelation.FlickOrSlide); } LineLayer.InvalidateVisual(); Project.IsChanged = true; @@ -145,12 +145,12 @@ private void ScoreNote_MouseUp(object sender, MouseButtonEventArgs e) { } else if (ns.FinishPosition != ne.FinishPosition && (ns.Bar != ne.Bar || ns.IndexInGrid != ne.IndexInGrid) && (!ns.IsHoldStart && !ne.IsHoldStart)) { // flick var second = first.Equals(ns) ? ne : ns; - if (first.HasNextFlick || second.HasPrevFlick) { + if (first.HasNextFlickOrSlide || second.HasPrevFlickOrSlide) { MessageBox.Show(Application.Current.FindResource(App.ResourceKeys.FlickRelationIsFullPrompt), App.Title, MessageBoxButton.OK, MessageBoxImage.Exclamation); return; } Note.ConnectFlick(first, second); - LineLayer.NoteRelations.Add(start, end, NoteRelation.Flick); + LineLayer.NoteRelations.Add(start, end, NoteRelation.FlickOrSlide); LineLayer.InvalidateVisual(); } else if (ns.FinishPosition == ne.FinishPosition && !ns.IsHold && !ne.IsHold && !first.IsFlick) { // hold diff --git a/DereTore.Applications.StarlightDirector/UI/Controls/ScoreEditor.Helpers.cs b/StarlightDirector/UI/Controls/ScoreEditor.Helpers.cs similarity index 95% rename from DereTore.Applications.StarlightDirector/UI/Controls/ScoreEditor.Helpers.cs rename to StarlightDirector/UI/Controls/ScoreEditor.Helpers.cs index 7836e46..242246d 100644 --- a/DereTore.Applications.StarlightDirector/UI/Controls/ScoreEditor.Helpers.cs +++ b/StarlightDirector/UI/Controls/ScoreEditor.Helpers.cs @@ -3,11 +3,11 @@ using System.Linq; using System.Windows; using System.Windows.Media; -using DereTore.Applications.StarlightDirector.Entities; -using DereTore.Applications.StarlightDirector.Extensions; -using DereTore.Applications.StarlightDirector.UI.Controls.Primitives; +using StarlightDirector.Entities; +using StarlightDirector.Extensions; +using StarlightDirector.UI.Controls.Primitives; -namespace DereTore.Applications.StarlightDirector.UI.Controls { +namespace StarlightDirector.UI.Controls { partial class ScoreEditor { public bool HasSelectedScoreNotes => ScoreNotes.Any(scoreNote => scoreNote.IsSelected); diff --git a/DereTore.Applications.StarlightDirector/UI/Controls/ScoreEditor.Layout.cs b/StarlightDirector/UI/Controls/ScoreEditor.Layout.cs similarity index 93% rename from DereTore.Applications.StarlightDirector/UI/Controls/ScoreEditor.Layout.cs rename to StarlightDirector/UI/Controls/ScoreEditor.Layout.cs index 8eaff16..c5f6487 100644 --- a/DereTore.Applications.StarlightDirector/UI/Controls/ScoreEditor.Layout.cs +++ b/StarlightDirector/UI/Controls/ScoreEditor.Layout.cs @@ -1,9 +1,8 @@ using System.Linq; using System.Windows.Controls; -using DereTore.Applications.StarlightDirector.Entities.Extensions; -using DereTore.Applications.StarlightDirector.UI.Controls.Primitives; +using StarlightDirector.UI.Controls.Primitives; -namespace DereTore.Applications.StarlightDirector.UI.Controls { +namespace StarlightDirector.UI.Controls { partial class ScoreEditor { private void RecalcEditorLayout() { diff --git a/DereTore.Applications.StarlightDirector/UI/Controls/ScoreEditor.Logic.Misc.cs b/StarlightDirector/UI/Controls/ScoreEditor.Logic.Misc.cs similarity index 88% rename from DereTore.Applications.StarlightDirector/UI/Controls/ScoreEditor.Logic.Misc.cs rename to StarlightDirector/UI/Controls/ScoreEditor.Logic.Misc.cs index 0b7ac48..96bf195 100644 --- a/DereTore.Applications.StarlightDirector/UI/Controls/ScoreEditor.Logic.Misc.cs +++ b/StarlightDirector/UI/Controls/ScoreEditor.Logic.Misc.cs @@ -2,11 +2,10 @@ using System.Collections.Generic; using System.Diagnostics; using System.Linq; -using DereTore.Applications.StarlightDirector.Entities; -using DereTore.Applications.StarlightDirector.Entities.Extensions; -using DereTore.Applications.StarlightDirector.UI.Controls.Primitives; +using StarlightDirector.Entities; +using StarlightDirector.UI.Controls.Primitives; -namespace DereTore.Applications.StarlightDirector.UI.Controls { +namespace StarlightDirector.UI.Controls { partial class ScoreEditor { internal void UpdateBarTexts() { @@ -91,16 +90,16 @@ private static void ProcessNoteRelations(Note root, IDictionary noteP waitingList.Enqueue(note.NextSyncTarget); } } - if (note.HasNextFlick) { - if (!relations.ContainsPair(map[note.ID], map[note.NextFlickNote.ID])) { - relations.Add(map[note.ID], map[note.NextFlickNote.ID], NoteRelation.Flick); - waitingList.Enqueue(note.NextFlickNote); + if (note.HasNextFlickOrSlide) { + if (!relations.ContainsPair(map[note.ID], map[note.NextFlickOrSlideNote.ID])) { + relations.Add(map[note.ID], map[note.NextFlickOrSlideNote.ID], NoteRelation.FlickOrSlide); + waitingList.Enqueue(note.NextFlickOrSlideNote); } } - if (note.HasPrevFlick) { - if (!relations.ContainsPair(map[note.ID], map[note.PrevFlickNote.ID])) { - relations.Add(map[note.ID], map[note.PrevFlickNote.ID], NoteRelation.Flick); - waitingList.Enqueue(note.PrevFlickNote); + if (note.HasPrevFlickOrSlide) { + if (!relations.ContainsPair(map[note.ID], map[note.PrevFlickOrSlideNote.ID])) { + relations.Add(map[note.ID], map[note.PrevFlickOrSlideNote.ID], NoteRelation.FlickOrSlide); + waitingList.Enqueue(note.PrevFlickOrSlideNote); } } if (note.IsHoldStart) { diff --git a/DereTore.Applications.StarlightDirector/UI/Controls/ScoreEditor.Properties.cs b/StarlightDirector/UI/Controls/ScoreEditor.Properties.cs similarity index 76% rename from DereTore.Applications.StarlightDirector/UI/Controls/ScoreEditor.Properties.cs rename to StarlightDirector/UI/Controls/ScoreEditor.Properties.cs index 7df36e9..1584fe5 100644 --- a/DereTore.Applications.StarlightDirector/UI/Controls/ScoreEditor.Properties.cs +++ b/StarlightDirector/UI/Controls/ScoreEditor.Properties.cs @@ -1,8 +1,9 @@ using System.Collections.Generic; using System.Collections.ObjectModel; -using DereTore.Applications.StarlightDirector.UI.Controls.Primitives; +using System.Windows.Controls; +using StarlightDirector.UI.Controls.Primitives; -namespace DereTore.Applications.StarlightDirector.UI.Controls { +namespace StarlightDirector.UI.Controls { partial class ScoreEditor { public ReadOnlyCollection ScoreBars { get; } @@ -11,6 +12,8 @@ partial class ScoreEditor { public ScoreBarHitTestInfo LastHitTestInfo { get; private set; } + public Grid ContentsGridControl => ContentsGrid; + private List EditableScoreBars { get; } private List EditableSpecialScoreNotes { get; } diff --git a/DereTore.Applications.StarlightDirector/UI/Controls/ScoreEditor.Viewing.cs b/StarlightDirector/UI/Controls/ScoreEditor.Viewing.cs similarity index 96% rename from DereTore.Applications.StarlightDirector/UI/Controls/ScoreEditor.Viewing.cs rename to StarlightDirector/UI/Controls/ScoreEditor.Viewing.cs index fce5ce6..7d61972 100644 --- a/DereTore.Applications.StarlightDirector/UI/Controls/ScoreEditor.Viewing.cs +++ b/StarlightDirector/UI/Controls/ScoreEditor.Viewing.cs @@ -1,8 +1,7 @@ using System.Windows; using System.Windows.Input; -using DereTore.Applications.StarlightDirector.Entities.Extensions; -namespace DereTore.Applications.StarlightDirector.UI.Controls { +namespace StarlightDirector.UI.Controls { partial class ScoreEditor { public void ZoomOutByCenter() { diff --git a/DereTore.Applications.StarlightDirector/UI/Controls/ScoreEditor.xaml b/StarlightDirector/UI/Controls/ScoreEditor.xaml similarity index 58% rename from DereTore.Applications.StarlightDirector/UI/Controls/ScoreEditor.xaml rename to StarlightDirector/UI/Controls/ScoreEditor.xaml index 590c282..b6f4ec1 100644 --- a/DereTore.Applications.StarlightDirector/UI/Controls/ScoreEditor.xaml +++ b/StarlightDirector/UI/Controls/ScoreEditor.xaml @@ -1,10 +1,10 @@ - - + + + + + + + + + - - - - - - - + diff --git a/DereTore.Applications.StarlightDirector/UI/Controls/ScoreEditor.xaml.cs b/StarlightDirector/UI/Controls/ScoreEditor.xaml.cs similarity index 75% rename from DereTore.Applications.StarlightDirector/UI/Controls/ScoreEditor.xaml.cs rename to StarlightDirector/UI/Controls/ScoreEditor.xaml.cs index ec4008d..a2aa3c1 100644 --- a/DereTore.Applications.StarlightDirector/UI/Controls/ScoreEditor.xaml.cs +++ b/StarlightDirector/UI/Controls/ScoreEditor.xaml.cs @@ -1,7 +1,7 @@ using System.Collections.Generic; -using DereTore.Applications.StarlightDirector.UI.Controls.Primitives; +using StarlightDirector.UI.Controls.Primitives; -namespace DereTore.Applications.StarlightDirector.UI.Controls { +namespace StarlightDirector.UI.Controls { public partial class ScoreEditor { public ScoreEditor() { diff --git a/DereTore.Applications.StarlightDirector/UI/Controls/ScorePreviewer.DependencyProperties.cs b/StarlightDirector/UI/Controls/ScorePreviewer.DependencyProperties.cs similarity index 95% rename from DereTore.Applications.StarlightDirector/UI/Controls/ScorePreviewer.DependencyProperties.cs rename to StarlightDirector/UI/Controls/ScorePreviewer.DependencyProperties.cs index 81c4115..51a42fd 100644 --- a/DereTore.Applications.StarlightDirector/UI/Controls/ScorePreviewer.DependencyProperties.cs +++ b/StarlightDirector/UI/Controls/ScorePreviewer.DependencyProperties.cs @@ -1,7 +1,7 @@ using System; using System.Windows; -namespace DereTore.Applications.StarlightDirector.UI.Controls { +namespace StarlightDirector.UI.Controls { partial class ScorePreviewer { public bool IsPreviewing { diff --git a/DereTore.Applications.StarlightDirector/UI/Controls/ScorePreviewer.xaml b/StarlightDirector/UI/Controls/ScorePreviewer.xaml similarity index 64% rename from DereTore.Applications.StarlightDirector/UI/Controls/ScorePreviewer.xaml rename to StarlightDirector/UI/Controls/ScorePreviewer.xaml index c8b4403..5918c65 100644 --- a/DereTore.Applications.StarlightDirector/UI/Controls/ScorePreviewer.xaml +++ b/StarlightDirector/UI/Controls/ScorePreviewer.xaml @@ -1,12 +1,12 @@ - - + diff --git a/DereTore.Applications.StarlightDirector/UI/Controls/ScorePreviewer.xaml.cs b/StarlightDirector/UI/Controls/ScorePreviewer.xaml.cs similarity index 93% rename from DereTore.Applications.StarlightDirector/UI/Controls/ScorePreviewer.xaml.cs rename to StarlightDirector/UI/Controls/ScorePreviewer.xaml.cs index 1cf0241..605fda8 100644 --- a/DereTore.Applications.StarlightDirector/UI/Controls/ScorePreviewer.xaml.cs +++ b/StarlightDirector/UI/Controls/ScorePreviewer.xaml.cs @@ -2,17 +2,17 @@ using System.Collections.Generic; using System.Diagnostics; using System.IO; +using System.Linq; using System.Threading; using System.Threading.Tasks; using System.Windows; -using DereTore.Applications.StarlightDirector.Entities; -using System.Linq; -using DereTore.Applications.StarlightDirector.UI.Controls.Models; -using DereTore.Applications.StarlightDirector.UI.Windows; using NAudio.CoreAudioApi; using NAudio.Wave; +using StarlightDirector.Entities; +using StarlightDirector.UI.Controls.Models; +using StarlightDirector.UI.Windows; -namespace DereTore.Applications.StarlightDirector.UI.Controls { +namespace StarlightDirector.UI.Controls { /// /// Interaction logic for ScorePreviewer.xaml /// @@ -76,7 +76,7 @@ public void BeginPreview(Score score, double targetFps, int startTime, double ap foreach (var note in _score.Notes) { // can I draw it? - if (note.Type != NoteType.TapOrFlick && note.Type != NoteType.Hold) { + if (note.Type != NoteType.TapOrFlick && note.Type != NoteType.Hold && note.Type != NoteType.Slide) { continue; } @@ -87,6 +87,17 @@ public void BeginPreview(Score score, double targetFps, int startTime, double ap if (pos == 0) continue; + NoteDrawType drawType; + if (note.IsHoldStart) { + drawType = NoteDrawType.Hold; + } else if (note.ShouldBeRenderedAsFlick) { + drawType = (NoteDrawType)note.FlickType; + } else if (note.ShouldBeRenderedAsSlide) { + drawType = NoteDrawType.Slide; + } else { + drawType = NoteDrawType.Tap; + } + var snote = new DrawingNote { Note = note, Done = false, @@ -95,7 +106,7 @@ public void BeginPreview(Score score, double targetFps, int startTime, double ap Timing = (int)(note.HitTiming * 1000), LastT = 0, HitPosition = pos - 1, - DrawType = (note.IsTap && !note.IsHoldEnd) || note.IsFlick ? (int)note.FlickType : 3 + DrawType = drawType }; if (note.IsHoldStart) { @@ -135,8 +146,8 @@ public void BeginPreview(Score score, double targetFps, int startTime, double ap snote.SyncTarget = _notes.FirstOrDefault(note => note.Note.ID == snote.Note.NextSyncTarget.ID); } - if (snote.Note.HasNextFlick) { - snote.GroupTarget = _notes.FirstOrDefault(note => note.Note.ID == snote.Note.NextFlickNoteID); + if (snote.Note.HasNextFlickOrSlide) { + snote.GroupTarget = _notes.FirstOrDefault(note => note.Note.ID == snote.Note.NextFlickOrSlideNoteID); } } diff --git a/DereTore.Applications.StarlightDirector/UI/Controls/ScoreViewerBase.DependencyProperties.cs b/StarlightDirector/UI/Controls/ScoreViewerBase.DependencyProperties.cs similarity index 94% rename from DereTore.Applications.StarlightDirector/UI/Controls/ScoreViewerBase.DependencyProperties.cs rename to StarlightDirector/UI/Controls/ScoreViewerBase.DependencyProperties.cs index 64d8659..eb8e635 100644 --- a/DereTore.Applications.StarlightDirector/UI/Controls/ScoreViewerBase.DependencyProperties.cs +++ b/StarlightDirector/UI/Controls/ScoreViewerBase.DependencyProperties.cs @@ -1,8 +1,8 @@ using System.Windows; using System.Windows.Controls; -using DereTore.Applications.StarlightDirector.Entities; +using StarlightDirector.Entities; -namespace DereTore.Applications.StarlightDirector.UI.Controls { +namespace StarlightDirector.UI.Controls { partial class ScoreViewerBase { public bool AreRelationIndicatorsVisible { diff --git a/DereTore.Applications.StarlightDirector/UI/Controls/ScoreViewerBase.Properties.cs b/StarlightDirector/UI/Controls/ScoreViewerBase.Properties.cs similarity index 65% rename from DereTore.Applications.StarlightDirector/UI/Controls/ScoreViewerBase.Properties.cs rename to StarlightDirector/UI/Controls/ScoreViewerBase.Properties.cs index 72b6433..bf8396a 100644 --- a/DereTore.Applications.StarlightDirector/UI/Controls/ScoreViewerBase.Properties.cs +++ b/StarlightDirector/UI/Controls/ScoreViewerBase.Properties.cs @@ -1,8 +1,8 @@ using System.Collections.Generic; using System.Collections.ObjectModel; -using DereTore.Applications.StarlightDirector.UI.Controls.Primitives; +using StarlightDirector.UI.Controls.Primitives; -namespace DereTore.Applications.StarlightDirector.UI.Controls { +namespace StarlightDirector.UI.Controls { partial class ScoreViewerBase { public ReadOnlyCollection ScoreNotes { get; } diff --git a/DereTore.Applications.StarlightDirector/UI/Controls/ScoreViewerBase.cs b/StarlightDirector/UI/Controls/ScoreViewerBase.cs similarity index 65% rename from DereTore.Applications.StarlightDirector/UI/Controls/ScoreViewerBase.cs rename to StarlightDirector/UI/Controls/ScoreViewerBase.cs index 3c0b1f4..9903888 100644 --- a/DereTore.Applications.StarlightDirector/UI/Controls/ScoreViewerBase.cs +++ b/StarlightDirector/UI/Controls/ScoreViewerBase.cs @@ -1,9 +1,9 @@ using System.Collections.Generic; using System.Windows.Controls; -using DereTore.Applications.StarlightDirector.Entities; -using DereTore.Applications.StarlightDirector.UI.Controls.Primitives; +using StarlightDirector.Entities; +using StarlightDirector.UI.Controls.Primitives; -namespace DereTore.Applications.StarlightDirector.UI.Controls { +namespace StarlightDirector.UI.Controls { public partial class ScoreViewerBase : UserControl { public ScoreViewerBase() { diff --git a/DereTore.Applications.StarlightDirector/UI/Converters/BooleanToValuesConverter.cs b/StarlightDirector/UI/Converters/BooleanToValuesConverter.cs similarity index 83% rename from DereTore.Applications.StarlightDirector/UI/Converters/BooleanToValuesConverter.cs rename to StarlightDirector/UI/Converters/BooleanToValuesConverter.cs index e326a5f..524eab9 100644 --- a/DereTore.Applications.StarlightDirector/UI/Converters/BooleanToValuesConverter.cs +++ b/StarlightDirector/UI/Converters/BooleanToValuesConverter.cs @@ -1,11 +1,8 @@ using System; -using System.Collections.Generic; using System.Globalization; -using System.Linq; -using System.Text; using System.Windows.Data; -namespace DereTore.Applications.StarlightDirector.UI.Converters +namespace StarlightDirector.UI.Converters { public class BooleanToValuesConverter : IValueConverter { diff --git a/DereTore.Applications.StarlightDirector/UI/Converters/ConverterGroupParameters.cs b/StarlightDirector/UI/Converters/ConverterGroupParameters.cs similarity index 62% rename from DereTore.Applications.StarlightDirector/UI/Converters/ConverterGroupParameters.cs rename to StarlightDirector/UI/Converters/ConverterGroupParameters.cs index 52b5a20..0e0d4e0 100644 --- a/DereTore.Applications.StarlightDirector/UI/Converters/ConverterGroupParameters.cs +++ b/StarlightDirector/UI/Converters/ConverterGroupParameters.cs @@ -1,6 +1,6 @@ using System.Collections.Generic; -namespace DereTore.Applications.StarlightDirector.UI.Converters { +namespace StarlightDirector.UI.Converters { public sealed class ConverterGroupParameters : List { } } diff --git a/DereTore.Applications.StarlightDirector/UI/Converters/DescribedEnumToStringConverter.cs b/StarlightDirector/UI/Converters/DescribedEnumToStringConverter.cs similarity index 92% rename from DereTore.Applications.StarlightDirector/UI/Converters/DescribedEnumToStringConverter.cs rename to StarlightDirector/UI/Converters/DescribedEnumToStringConverter.cs index cbe7b10..bc7eb0f 100644 --- a/DereTore.Applications.StarlightDirector/UI/Converters/DescribedEnumToStringConverter.cs +++ b/StarlightDirector/UI/Converters/DescribedEnumToStringConverter.cs @@ -3,7 +3,7 @@ using System.Globalization; using System.Windows.Data; -namespace DereTore.Applications.StarlightDirector.UI.Converters { +namespace StarlightDirector.UI.Converters { public sealed class DescribedEnumToStringConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { diff --git a/DereTore.Applications.StarlightDirector/UI/Converters/DifficultyToIndexConverter.cs b/StarlightDirector/UI/Converters/DifficultyToIndexConverter.cs similarity index 81% rename from DereTore.Applications.StarlightDirector/UI/Converters/DifficultyToIndexConverter.cs rename to StarlightDirector/UI/Converters/DifficultyToIndexConverter.cs index d7edc9c..0d8c831 100644 --- a/DereTore.Applications.StarlightDirector/UI/Converters/DifficultyToIndexConverter.cs +++ b/StarlightDirector/UI/Converters/DifficultyToIndexConverter.cs @@ -1,9 +1,9 @@ using System; using System.Globalization; using System.Windows.Data; -using DereTore.Applications.StarlightDirector.Entities; +using StarlightDirector.Entities; -namespace DereTore.Applications.StarlightDirector.UI.Converters { +namespace StarlightDirector.UI.Converters { public sealed class DifficultyToIndexConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { diff --git a/DereTore.Applications.StarlightDirector/UI/Converters/DifficultyToIsCheckedConverter.cs b/StarlightDirector/UI/Converters/DifficultyToIsCheckedConverter.cs similarity index 82% rename from DereTore.Applications.StarlightDirector/UI/Converters/DifficultyToIsCheckedConverter.cs rename to StarlightDirector/UI/Converters/DifficultyToIsCheckedConverter.cs index 8437b64..89e531f 100644 --- a/DereTore.Applications.StarlightDirector/UI/Converters/DifficultyToIsCheckedConverter.cs +++ b/StarlightDirector/UI/Converters/DifficultyToIsCheckedConverter.cs @@ -1,9 +1,9 @@ using System; using System.Globalization; using System.Windows.Data; -using DereTore.Applications.StarlightDirector.Entities; +using StarlightDirector.Entities; -namespace DereTore.Applications.StarlightDirector.UI.Converters { +namespace StarlightDirector.UI.Converters { public sealed class DifficultyToIsCheckedConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { diff --git a/DereTore.Applications.StarlightDirector/UI/Converters/DoubleToStringConverter.cs b/StarlightDirector/UI/Converters/DoubleToStringConverter.cs similarity index 93% rename from DereTore.Applications.StarlightDirector/UI/Converters/DoubleToStringConverter.cs rename to StarlightDirector/UI/Converters/DoubleToStringConverter.cs index 4dbe450..9a2b211 100644 --- a/DereTore.Applications.StarlightDirector/UI/Converters/DoubleToStringConverter.cs +++ b/StarlightDirector/UI/Converters/DoubleToStringConverter.cs @@ -4,7 +4,7 @@ using System.Windows; using System.Windows.Data; -namespace DereTore.Applications.StarlightDirector.UI.Converters { +namespace StarlightDirector.UI.Converters { public sealed class DoubleToStringConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { diff --git a/DereTore.Applications.StarlightDirector/UI/Converters/EditModeToIsCheckedConverter.cs b/StarlightDirector/UI/Converters/EditModeToIsCheckedConverter.cs similarity index 89% rename from DereTore.Applications.StarlightDirector/UI/Converters/EditModeToIsCheckedConverter.cs rename to StarlightDirector/UI/Converters/EditModeToIsCheckedConverter.cs index 7f2e8a1..c7b0857 100644 --- a/DereTore.Applications.StarlightDirector/UI/Converters/EditModeToIsCheckedConverter.cs +++ b/StarlightDirector/UI/Converters/EditModeToIsCheckedConverter.cs @@ -2,7 +2,7 @@ using System.Globalization; using System.Windows.Data; -namespace DereTore.Applications.StarlightDirector.UI.Converters { +namespace StarlightDirector.UI.Converters { public sealed class EditModeToIsCheckedConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { diff --git a/DereTore.Applications.StarlightDirector/UI/Converters/EquityConverter.cs b/StarlightDirector/UI/Converters/EquityConverter.cs similarity index 94% rename from DereTore.Applications.StarlightDirector/UI/Converters/EquityConverter.cs rename to StarlightDirector/UI/Converters/EquityConverter.cs index 910d707..b253f64 100644 --- a/DereTore.Applications.StarlightDirector/UI/Converters/EquityConverter.cs +++ b/StarlightDirector/UI/Converters/EquityConverter.cs @@ -3,7 +3,7 @@ using System.Globalization; using System.Windows.Data; -namespace DereTore.Applications.StarlightDirector.UI.Converters { +namespace StarlightDirector.UI.Converters { // http://stackoverflow.com/questions/1350598/passing-two-command-parameters-using-a-wpf-binding public sealed class EquityConverter : IMultiValueConverter { diff --git a/DereTore.Applications.StarlightDirector/UI/Converters/MathOp/BinaryOpConverterBase.cs b/StarlightDirector/UI/Converters/MathOp/BinaryOpConverterBase.cs similarity index 93% rename from DereTore.Applications.StarlightDirector/UI/Converters/MathOp/BinaryOpConverterBase.cs rename to StarlightDirector/UI/Converters/MathOp/BinaryOpConverterBase.cs index 91bf348..a43acd1 100644 --- a/DereTore.Applications.StarlightDirector/UI/Converters/MathOp/BinaryOpConverterBase.cs +++ b/StarlightDirector/UI/Converters/MathOp/BinaryOpConverterBase.cs @@ -3,7 +3,7 @@ using System.Linq; using System.Windows.Data; -namespace DereTore.Applications.StarlightDirector.UI.Converters.MathOp { +namespace StarlightDirector.UI.Converters.MathOp { public abstract class BinaryOpConverterBase : MathConverterBase, IMultiValueConverter { public abstract object Convert(object[] values, Type targetType, object parameter, CultureInfo culture); diff --git a/DereTore.Applications.StarlightDirector/UI/Converters/MathOp/LeftParenConverter.cs b/StarlightDirector/UI/Converters/MathOp/LeftParenConverter.cs similarity index 87% rename from DereTore.Applications.StarlightDirector/UI/Converters/MathOp/LeftParenConverter.cs rename to StarlightDirector/UI/Converters/MathOp/LeftParenConverter.cs index 4ed8665..f332368 100644 --- a/DereTore.Applications.StarlightDirector/UI/Converters/MathOp/LeftParenConverter.cs +++ b/StarlightDirector/UI/Converters/MathOp/LeftParenConverter.cs @@ -2,7 +2,7 @@ using System.Globalization; using System.Windows; -namespace DereTore.Applications.StarlightDirector.UI.Converters.MathOp { +namespace StarlightDirector.UI.Converters.MathOp { public sealed class LeftParenConverter : OpSymbolConverterBase { public override object Convert(object value, Type targetType, object parameter, CultureInfo culture) { diff --git a/DereTore.Applications.StarlightDirector/UI/Converters/MathOp/MathAddConverter.cs b/StarlightDirector/UI/Converters/MathOp/MathAddConverter.cs similarity index 93% rename from DereTore.Applications.StarlightDirector/UI/Converters/MathOp/MathAddConverter.cs rename to StarlightDirector/UI/Converters/MathOp/MathAddConverter.cs index cf7f7e2..f1eb6c3 100644 --- a/DereTore.Applications.StarlightDirector/UI/Converters/MathOp/MathAddConverter.cs +++ b/StarlightDirector/UI/Converters/MathOp/MathAddConverter.cs @@ -1,7 +1,7 @@ using System; using System.Globalization; -namespace DereTore.Applications.StarlightDirector.UI.Converters.MathOp { +namespace StarlightDirector.UI.Converters.MathOp { public sealed class MathAddConverter : BinaryOpConverterBase { public override object Convert(object value, Type targetType, object parameter, CultureInfo culture) { diff --git a/DereTore.Applications.StarlightDirector/UI/Converters/MathOp/MathConstantConverter.cs b/StarlightDirector/UI/Converters/MathOp/MathConstantConverter.cs similarity index 86% rename from DereTore.Applications.StarlightDirector/UI/Converters/MathOp/MathConstantConverter.cs rename to StarlightDirector/UI/Converters/MathOp/MathConstantConverter.cs index c483903..3e6c3eb 100644 --- a/DereTore.Applications.StarlightDirector/UI/Converters/MathOp/MathConstantConverter.cs +++ b/StarlightDirector/UI/Converters/MathOp/MathConstantConverter.cs @@ -1,7 +1,7 @@ using System; using System.Globalization; -namespace DereTore.Applications.StarlightDirector.UI.Converters.MathOp { +namespace StarlightDirector.UI.Converters.MathOp { public sealed class MathConstantConverter : MathConverterBase { public override object Convert(object value, Type targetType, object parameter, CultureInfo culture) { diff --git a/DereTore.Applications.StarlightDirector/UI/Converters/MathOp/MathConverterBase.cs b/StarlightDirector/UI/Converters/MathOp/MathConverterBase.cs similarity index 92% rename from DereTore.Applications.StarlightDirector/UI/Converters/MathOp/MathConverterBase.cs rename to StarlightDirector/UI/Converters/MathOp/MathConverterBase.cs index f589bc6..5f9ba8f 100644 --- a/DereTore.Applications.StarlightDirector/UI/Converters/MathOp/MathConverterBase.cs +++ b/StarlightDirector/UI/Converters/MathOp/MathConverterBase.cs @@ -4,7 +4,7 @@ using System.Windows.Data; using SysConvert = System.Convert; -namespace DereTore.Applications.StarlightDirector.UI.Converters.MathOp { +namespace StarlightDirector.UI.Converters.MathOp { public abstract class MathConverterBase : IValueConverter { public abstract object Convert(object value, Type targetType, object parameter, CultureInfo culture); diff --git a/DereTore.Applications.StarlightDirector/UI/Converters/MathOp/MathDivideConverter.cs b/StarlightDirector/UI/Converters/MathOp/MathDivideConverter.cs similarity index 95% rename from DereTore.Applications.StarlightDirector/UI/Converters/MathOp/MathDivideConverter.cs rename to StarlightDirector/UI/Converters/MathOp/MathDivideConverter.cs index 5ab8efe..6042557 100644 --- a/DereTore.Applications.StarlightDirector/UI/Converters/MathOp/MathDivideConverter.cs +++ b/StarlightDirector/UI/Converters/MathOp/MathDivideConverter.cs @@ -1,7 +1,7 @@ using System; using System.Globalization; -namespace DereTore.Applications.StarlightDirector.UI.Converters.MathOp { +namespace StarlightDirector.UI.Converters.MathOp { public sealed class MathDivideConverter : BinaryOpConverterBase { public override object Convert(object value, Type targetType, object parameter, CultureInfo culture) { diff --git a/DereTore.Applications.StarlightDirector/UI/Converters/MathOp/MathExpressionConverter.cs b/StarlightDirector/UI/Converters/MathOp/MathExpressionConverter.cs similarity index 97% rename from DereTore.Applications.StarlightDirector/UI/Converters/MathOp/MathExpressionConverter.cs rename to StarlightDirector/UI/Converters/MathOp/MathExpressionConverter.cs index 6889b58..7ccd2fa 100644 --- a/DereTore.Applications.StarlightDirector/UI/Converters/MathOp/MathExpressionConverter.cs +++ b/StarlightDirector/UI/Converters/MathOp/MathExpressionConverter.cs @@ -1,11 +1,9 @@ using System; using System.Collections.Generic; using System.Globalization; -using System.Linq; -using System.Windows; using System.Windows.Data; -namespace DereTore.Applications.StarlightDirector.UI.Converters.MathOp { +namespace StarlightDirector.UI.Converters.MathOp { public sealed class MathExpressionConverter : List, IMultiValueConverter { /// /// diff --git a/DereTore.Applications.StarlightDirector/UI/Converters/MathOp/MathMultiplyConverter.cs b/StarlightDirector/UI/Converters/MathOp/MathMultiplyConverter.cs similarity index 94% rename from DereTore.Applications.StarlightDirector/UI/Converters/MathOp/MathMultiplyConverter.cs rename to StarlightDirector/UI/Converters/MathOp/MathMultiplyConverter.cs index 38b8df0..9f32b7e 100644 --- a/DereTore.Applications.StarlightDirector/UI/Converters/MathOp/MathMultiplyConverter.cs +++ b/StarlightDirector/UI/Converters/MathOp/MathMultiplyConverter.cs @@ -1,7 +1,7 @@ using System; using System.Globalization; -namespace DereTore.Applications.StarlightDirector.UI.Converters.MathOp { +namespace StarlightDirector.UI.Converters.MathOp { public sealed class MathMultiplyConverter : BinaryOpConverterBase { public override object Convert(object value, Type targetType, object parameter, CultureInfo culture) { diff --git a/DereTore.Applications.StarlightDirector/UI/Converters/MathOp/MathSubtractConverter.cs b/StarlightDirector/UI/Converters/MathOp/MathSubtractConverter.cs similarity index 93% rename from DereTore.Applications.StarlightDirector/UI/Converters/MathOp/MathSubtractConverter.cs rename to StarlightDirector/UI/Converters/MathOp/MathSubtractConverter.cs index beb4df9..d8e413d 100644 --- a/DereTore.Applications.StarlightDirector/UI/Converters/MathOp/MathSubtractConverter.cs +++ b/StarlightDirector/UI/Converters/MathOp/MathSubtractConverter.cs @@ -1,7 +1,7 @@ using System; using System.Globalization; -namespace DereTore.Applications.StarlightDirector.UI.Converters.MathOp { +namespace StarlightDirector.UI.Converters.MathOp { public sealed class MathSubtractConverter : BinaryOpConverterBase { public override object Convert(object value, Type targetType, object parameter, CultureInfo culture) { diff --git a/DereTore.Applications.StarlightDirector/UI/Converters/MathOp/NegateConverter.cs b/StarlightDirector/UI/Converters/MathOp/NegateConverter.cs similarity index 92% rename from DereTore.Applications.StarlightDirector/UI/Converters/MathOp/NegateConverter.cs rename to StarlightDirector/UI/Converters/MathOp/NegateConverter.cs index 12fddcf..60ffc15 100644 --- a/DereTore.Applications.StarlightDirector/UI/Converters/MathOp/NegateConverter.cs +++ b/StarlightDirector/UI/Converters/MathOp/NegateConverter.cs @@ -2,7 +2,7 @@ using System.Globalization; using System.Windows; -namespace DereTore.Applications.StarlightDirector.UI.Converters.MathOp { +namespace StarlightDirector.UI.Converters.MathOp { public sealed class NegateConverter : UnaryOpConverterBase { public override object Convert(object value, Type targetType, object parameter, CultureInfo culture) { diff --git a/DereTore.Applications.StarlightDirector/UI/Converters/MathOp/OpSymbolConverterBase.cs b/StarlightDirector/UI/Converters/MathOp/OpSymbolConverterBase.cs similarity index 50% rename from DereTore.Applications.StarlightDirector/UI/Converters/MathOp/OpSymbolConverterBase.cs rename to StarlightDirector/UI/Converters/MathOp/OpSymbolConverterBase.cs index 1b53844..4d0642c 100644 --- a/DereTore.Applications.StarlightDirector/UI/Converters/MathOp/OpSymbolConverterBase.cs +++ b/StarlightDirector/UI/Converters/MathOp/OpSymbolConverterBase.cs @@ -1,4 +1,4 @@ -namespace DereTore.Applications.StarlightDirector.UI.Converters.MathOp { +namespace StarlightDirector.UI.Converters.MathOp { public abstract class OpSymbolConverterBase : MathConverterBase { } } diff --git a/DereTore.Applications.StarlightDirector/UI/Converters/MathOp/RightParenConverter.cs b/StarlightDirector/UI/Converters/MathOp/RightParenConverter.cs similarity index 87% rename from DereTore.Applications.StarlightDirector/UI/Converters/MathOp/RightParenConverter.cs rename to StarlightDirector/UI/Converters/MathOp/RightParenConverter.cs index dcbc71e..00dd41f 100644 --- a/DereTore.Applications.StarlightDirector/UI/Converters/MathOp/RightParenConverter.cs +++ b/StarlightDirector/UI/Converters/MathOp/RightParenConverter.cs @@ -2,7 +2,7 @@ using System.Globalization; using System.Windows; -namespace DereTore.Applications.StarlightDirector.UI.Converters.MathOp { +namespace StarlightDirector.UI.Converters.MathOp { public sealed class RightParenConverter : OpSymbolConverterBase { public override object Convert(object value, Type targetType, object parameter, CultureInfo culture) { diff --git a/DereTore.Applications.StarlightDirector/UI/Converters/MathOp/UnaryOpConverterBase.cs b/StarlightDirector/UI/Converters/MathOp/UnaryOpConverterBase.cs similarity index 50% rename from DereTore.Applications.StarlightDirector/UI/Converters/MathOp/UnaryOpConverterBase.cs rename to StarlightDirector/UI/Converters/MathOp/UnaryOpConverterBase.cs index 8fbfbfa..083df13 100644 --- a/DereTore.Applications.StarlightDirector/UI/Converters/MathOp/UnaryOpConverterBase.cs +++ b/StarlightDirector/UI/Converters/MathOp/UnaryOpConverterBase.cs @@ -1,4 +1,4 @@ -namespace DereTore.Applications.StarlightDirector.UI.Converters.MathOp { +namespace StarlightDirector.UI.Converters.MathOp { public abstract class UnaryOpConverterBase : MathConverterBase { } } diff --git a/DereTore.Applications.StarlightDirector/UI/Converters/MultiValueConverterGroup.cs b/StarlightDirector/UI/Converters/MultiValueConverterGroup.cs similarity index 97% rename from DereTore.Applications.StarlightDirector/UI/Converters/MultiValueConverterGroup.cs rename to StarlightDirector/UI/Converters/MultiValueConverterGroup.cs index e9f0056..3738f82 100644 --- a/DereTore.Applications.StarlightDirector/UI/Converters/MultiValueConverterGroup.cs +++ b/StarlightDirector/UI/Converters/MultiValueConverterGroup.cs @@ -3,7 +3,7 @@ using System.Globalization; using System.Windows.Data; -namespace DereTore.Applications.StarlightDirector.UI.Converters { +namespace StarlightDirector.UI.Converters { public sealed class MultiValueConverterGroup : List, IMultiValueConverter { public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) { diff --git a/DereTore.Applications.StarlightDirector/UI/Converters/NoteFlickTypeToHorizontalMirrorConverter.cs b/StarlightDirector/UI/Converters/NoteFlickTypeToHorizontalMirrorConverter.cs similarity index 88% rename from DereTore.Applications.StarlightDirector/UI/Converters/NoteFlickTypeToHorizontalMirrorConverter.cs rename to StarlightDirector/UI/Converters/NoteFlickTypeToHorizontalMirrorConverter.cs index 875f1c1..49af5ed 100644 --- a/DereTore.Applications.StarlightDirector/UI/Converters/NoteFlickTypeToHorizontalMirrorConverter.cs +++ b/StarlightDirector/UI/Converters/NoteFlickTypeToHorizontalMirrorConverter.cs @@ -2,9 +2,9 @@ using System.Globalization; using System.Windows; using System.Windows.Data; -using DereTore.Applications.StarlightDirector.Entities; +using StarlightDirector.Entities; -namespace DereTore.Applications.StarlightDirector.UI.Converters { +namespace StarlightDirector.UI.Converters { public sealed class NoteFlickTypeToHorizontalMirrorConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { diff --git a/DereTore.Applications.StarlightDirector/UI/Converters/NoteFlickTypeToVisibilityConverter.cs b/StarlightDirector/UI/Converters/NoteFlickTypeToVisibilityConverter.cs similarity index 85% rename from DereTore.Applications.StarlightDirector/UI/Converters/NoteFlickTypeToVisibilityConverter.cs rename to StarlightDirector/UI/Converters/NoteFlickTypeToVisibilityConverter.cs index 9fad67b..3ff1519 100644 --- a/DereTore.Applications.StarlightDirector/UI/Converters/NoteFlickTypeToVisibilityConverter.cs +++ b/StarlightDirector/UI/Converters/NoteFlickTypeToVisibilityConverter.cs @@ -2,9 +2,9 @@ using System.Globalization; using System.Windows; using System.Windows.Data; -using DereTore.Applications.StarlightDirector.Entities; +using StarlightDirector.Entities; -namespace DereTore.Applications.StarlightDirector.UI.Converters { +namespace StarlightDirector.UI.Converters { public sealed class NoteFlickTypeToVisibilityConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { diff --git a/DereTore.Applications.StarlightDirector/UI/Converters/NotePositionToTextConverter.cs b/StarlightDirector/UI/Converters/NotePositionToTextConverter.cs similarity index 81% rename from DereTore.Applications.StarlightDirector/UI/Converters/NotePositionToTextConverter.cs rename to StarlightDirector/UI/Converters/NotePositionToTextConverter.cs index e61538c..2aa4087 100644 --- a/DereTore.Applications.StarlightDirector/UI/Converters/NotePositionToTextConverter.cs +++ b/StarlightDirector/UI/Converters/NotePositionToTextConverter.cs @@ -1,9 +1,9 @@ using System; using System.Globalization; using System.Windows.Data; -using DereTore.Applications.StarlightDirector.Entities; +using StarlightDirector.Entities; -namespace DereTore.Applications.StarlightDirector.UI.Converters { +namespace StarlightDirector.UI.Converters { public sealed class NotePositionToTextConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { diff --git a/DereTore.Applications.StarlightDirector/UI/Converters/NullableBooleanToVisibilityConverter.cs b/StarlightDirector/UI/Converters/NullableBooleanToVisibilityConverter.cs similarity index 95% rename from DereTore.Applications.StarlightDirector/UI/Converters/NullableBooleanToVisibilityConverter.cs rename to StarlightDirector/UI/Converters/NullableBooleanToVisibilityConverter.cs index c080180..1960f6c 100644 --- a/DereTore.Applications.StarlightDirector/UI/Converters/NullableBooleanToVisibilityConverter.cs +++ b/StarlightDirector/UI/Converters/NullableBooleanToVisibilityConverter.cs @@ -3,7 +3,7 @@ using System.Windows; using System.Windows.Data; -namespace DereTore.Applications.StarlightDirector.UI.Converters { +namespace StarlightDirector.UI.Converters { public sealed class NullableBooleanToVisibilityConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { diff --git a/DereTore.Applications.StarlightDirector/UI/Converters/PositiveDoubleToStringConverter.cs b/StarlightDirector/UI/Converters/PositiveDoubleToStringConverter.cs similarity index 94% rename from DereTore.Applications.StarlightDirector/UI/Converters/PositiveDoubleToStringConverter.cs rename to StarlightDirector/UI/Converters/PositiveDoubleToStringConverter.cs index 35c4e96..29d6fee 100644 --- a/DereTore.Applications.StarlightDirector/UI/Converters/PositiveDoubleToStringConverter.cs +++ b/StarlightDirector/UI/Converters/PositiveDoubleToStringConverter.cs @@ -4,7 +4,7 @@ using System.Windows; using System.Windows.Data; -namespace DereTore.Applications.StarlightDirector.UI.Converters { +namespace StarlightDirector.UI.Converters { public sealed class PositiveDoubleToStringConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { diff --git a/DereTore.Applications.StarlightDirector/UI/Converters/PositiveInt32ToStringConverter.cs b/StarlightDirector/UI/Converters/PositiveInt32ToStringConverter.cs similarity index 94% rename from DereTore.Applications.StarlightDirector/UI/Converters/PositiveInt32ToStringConverter.cs rename to StarlightDirector/UI/Converters/PositiveInt32ToStringConverter.cs index a05ccd0..21011d6 100644 --- a/DereTore.Applications.StarlightDirector/UI/Converters/PositiveInt32ToStringConverter.cs +++ b/StarlightDirector/UI/Converters/PositiveInt32ToStringConverter.cs @@ -4,7 +4,7 @@ using System.Windows; using System.Windows.Data; -namespace DereTore.Applications.StarlightDirector.UI.Converters { +namespace StarlightDirector.UI.Converters { public sealed class PositiveInt32ToStringConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { diff --git a/DereTore.Applications.StarlightDirector/UI/Converters/ValueConverterGroup.cs b/StarlightDirector/UI/Converters/ValueConverterGroup.cs similarity index 96% rename from DereTore.Applications.StarlightDirector/UI/Converters/ValueConverterGroup.cs rename to StarlightDirector/UI/Converters/ValueConverterGroup.cs index 177c2cb..7238d21 100644 --- a/DereTore.Applications.StarlightDirector/UI/Converters/ValueConverterGroup.cs +++ b/StarlightDirector/UI/Converters/ValueConverterGroup.cs @@ -3,7 +3,7 @@ using System.Globalization; using System.Windows.Data; -namespace DereTore.Applications.StarlightDirector.UI.Converters { +namespace StarlightDirector.UI.Converters { // http://stackoverflow.com/questions/2607490/is-there-a-way-to-chain-multiple-value-converters-in-xaml public sealed class ValueConverterGroup : List, IValueConverter { diff --git a/DereTore.Applications.StarlightDirector/UI/CustomScroll.cs b/StarlightDirector/UI/CustomScroll.cs similarity index 98% rename from DereTore.Applications.StarlightDirector/UI/CustomScroll.cs rename to StarlightDirector/UI/CustomScroll.cs index 4fd9b4b..b2f718f 100644 --- a/DereTore.Applications.StarlightDirector/UI/CustomScroll.cs +++ b/StarlightDirector/UI/CustomScroll.cs @@ -4,7 +4,7 @@ using System.Windows.Input; using System.Windows.Media; -namespace DereTore.Applications.StarlightDirector.UI { +namespace StarlightDirector.UI { // http://stackoverflow.com/questions/876994/adjust-flowdocumentreaders-scroll-increment-when-viewingmode-set-to-scroll public static class CustomScroll { diff --git a/DereTore.Applications.StarlightDirector/UI/EditMode.cs b/StarlightDirector/UI/EditMode.cs similarity index 59% rename from DereTore.Applications.StarlightDirector/UI/EditMode.cs rename to StarlightDirector/UI/EditMode.cs index 64210af..3a5f58a 100644 --- a/DereTore.Applications.StarlightDirector/UI/EditMode.cs +++ b/StarlightDirector/UI/EditMode.cs @@ -1,4 +1,4 @@ -namespace DereTore.Applications.StarlightDirector.UI { +namespace StarlightDirector.UI { public enum EditMode { Select, diff --git a/DereTore.Applications.StarlightDirector/UI/NoteRelationCollection.cs b/StarlightDirector/UI/NoteRelationCollection.cs similarity index 88% rename from DereTore.Applications.StarlightDirector/UI/NoteRelationCollection.cs rename to StarlightDirector/UI/NoteRelationCollection.cs index 63c6279..d981503 100644 --- a/DereTore.Applications.StarlightDirector/UI/NoteRelationCollection.cs +++ b/StarlightDirector/UI/NoteRelationCollection.cs @@ -2,12 +2,12 @@ using System.Collections; using System.Collections.Generic; using System.Linq; -using DereTore.Applications.StarlightDirector.Entities; -using DereTore.Applications.StarlightDirector.UI.Controls.Primitives; -using TupleType = System.Tuple; -using InternalEntryType = System.Collections.Generic.KeyValuePair, DereTore.Applications.StarlightDirector.Entities.NoteRelation>; +using StarlightDirector.Entities; +using StarlightDirector.UI.Controls.Primitives; +using TupleType = System.Tuple; +using InternalEntryType = System.Collections.Generic.KeyValuePair, StarlightDirector.Entities.NoteRelation>; -namespace DereTore.Applications.StarlightDirector.UI { +namespace StarlightDirector.UI { public sealed class NoteRelationCollection : IEnumerable { public NoteRelationCollection() { diff --git a/DereTore.Applications.StarlightDirector/UI/ScoreBarHitTestEventArgs.cs b/StarlightDirector/UI/ScoreBarHitTestEventArgs.cs similarity index 88% rename from DereTore.Applications.StarlightDirector/UI/ScoreBarHitTestEventArgs.cs rename to StarlightDirector/UI/ScoreBarHitTestEventArgs.cs index 0a937d1..25cef3b 100644 --- a/DereTore.Applications.StarlightDirector/UI/ScoreBarHitTestEventArgs.cs +++ b/StarlightDirector/UI/ScoreBarHitTestEventArgs.cs @@ -1,7 +1,7 @@ using System; using System.Windows.Input; -namespace DereTore.Applications.StarlightDirector.UI { +namespace StarlightDirector.UI { public sealed class ScoreBarHitTestEventArgs : EventArgs { public ScoreBarHitTestEventArgs(ScoreBarHitTestInfo info, MouseButtonEventArgs buttonEventArgs) { diff --git a/DereTore.Applications.StarlightDirector/UI/ScoreBarHitTestInfo.cs b/StarlightDirector/UI/ScoreBarHitTestInfo.cs similarity index 79% rename from DereTore.Applications.StarlightDirector/UI/ScoreBarHitTestInfo.cs rename to StarlightDirector/UI/ScoreBarHitTestInfo.cs index 31699cc..dd091d6 100644 --- a/DereTore.Applications.StarlightDirector/UI/ScoreBarHitTestInfo.cs +++ b/StarlightDirector/UI/ScoreBarHitTestInfo.cs @@ -1,8 +1,8 @@ using System.Windows; -using DereTore.Applications.StarlightDirector.Entities; -using DereTore.Applications.StarlightDirector.UI.Controls.Primitives; +using StarlightDirector.Entities; +using StarlightDirector.UI.Controls.Primitives; -namespace DereTore.Applications.StarlightDirector.UI { +namespace StarlightDirector.UI { public sealed class ScoreBarHitTestInfo { public ScoreBarHitTestInfo(ScoreBar scoreBar, Bar bar, Point hitPoint, int column, int row, bool isInNextBar, bool isValid) { diff --git a/DereTore.Applications.StarlightDirector/UI/Windows/MainWindow.AutoSave.cs b/StarlightDirector/UI/Windows/MainWindow.AutoSave.cs similarity index 94% rename from DereTore.Applications.StarlightDirector/UI/Windows/MainWindow.AutoSave.cs rename to StarlightDirector/UI/Windows/MainWindow.AutoSave.cs index 31d29bf..7258b1f 100644 --- a/DereTore.Applications.StarlightDirector/UI/Windows/MainWindow.AutoSave.cs +++ b/StarlightDirector/UI/Windows/MainWindow.AutoSave.cs @@ -2,11 +2,11 @@ using System.IO; using System.Linq; using System.Windows; -using DereTore.Applications.StarlightDirector.Entities; -using DereTore.Applications.StarlightDirector.Exchange; -using DereTore.Applications.StarlightDirector.Extensions; +using StarlightDirector.Entities; +using StarlightDirector.Exchange; +using StarlightDirector.Extensions; -namespace DereTore.Applications.StarlightDirector.UI.Windows { +namespace StarlightDirector.UI.Windows { partial class MainWindow { private void SaveBackup() { diff --git a/DereTore.Applications.StarlightDirector/UI/Windows/MainWindow.Commands.Background.cs b/StarlightDirector/UI/Windows/MainWindow.Commands.Background.cs similarity index 97% rename from DereTore.Applications.StarlightDirector/UI/Windows/MainWindow.Commands.Background.cs rename to StarlightDirector/UI/Windows/MainWindow.Commands.Background.cs index 7cd2854..a84a843 100644 --- a/DereTore.Applications.StarlightDirector/UI/Windows/MainWindow.Commands.Background.cs +++ b/StarlightDirector/UI/Windows/MainWindow.Commands.Background.cs @@ -1,6 +1,6 @@ using System.Windows.Input; -namespace DereTore.Applications.StarlightDirector.UI.Windows { +namespace StarlightDirector.UI.Windows { partial class MainWindow { public static readonly ICommand CmdBgScrollUpSmall = CommandHelper.RegisterCommand("Up"); diff --git a/DereTore.Applications.StarlightDirector/UI/Windows/MainWindow.Commands.ContextMenu.cs b/StarlightDirector/UI/Windows/MainWindow.Commands.ContextMenu.cs similarity index 86% rename from DereTore.Applications.StarlightDirector/UI/Windows/MainWindow.Commands.ContextMenu.cs rename to StarlightDirector/UI/Windows/MainWindow.Commands.ContextMenu.cs index e402297..16d0ace 100644 --- a/DereTore.Applications.StarlightDirector/UI/Windows/MainWindow.Commands.ContextMenu.cs +++ b/StarlightDirector/UI/Windows/MainWindow.Commands.ContextMenu.cs @@ -1,7 +1,7 @@ using System.Windows.Input; -using DereTore.Applications.StarlightDirector.Entities; +using StarlightDirector.Entities; -namespace DereTore.Applications.StarlightDirector.UI.Windows { +namespace StarlightDirector.UI.Windows { partial class MainWindow { public static readonly ICommand CmdContextAddSpecialNoteVariantBpm = CommandHelper.RegisterCommand(); diff --git a/DereTore.Applications.StarlightDirector/UI/Windows/MainWindow.Commands.Edit.Bar.cs b/StarlightDirector/UI/Windows/MainWindow.Commands.Edit.Bar.cs similarity index 96% rename from DereTore.Applications.StarlightDirector/UI/Windows/MainWindow.Commands.Edit.Bar.cs rename to StarlightDirector/UI/Windows/MainWindow.Commands.Edit.Bar.cs index ec9f346..4096c94 100644 --- a/DereTore.Applications.StarlightDirector/UI/Windows/MainWindow.Commands.Edit.Bar.cs +++ b/StarlightDirector/UI/Windows/MainWindow.Commands.Edit.Bar.cs @@ -2,9 +2,9 @@ using System.Diagnostics; using System.Windows; using System.Windows.Input; -using DereTore.Applications.StarlightDirector.Extensions; +using StarlightDirector.Extensions; -namespace DereTore.Applications.StarlightDirector.UI.Windows { +namespace StarlightDirector.UI.Windows { partial class MainWindow { public static readonly ICommand CmdEditBarAppend = CommandHelper.RegisterCommand("Ctrl+Alt+U"); diff --git a/DereTore.Applications.StarlightDirector/UI/Windows/MainWindow.Commands.Edit.Mode.cs b/StarlightDirector/UI/Windows/MainWindow.Commands.Edit.Mode.cs similarity index 96% rename from DereTore.Applications.StarlightDirector/UI/Windows/MainWindow.Commands.Edit.Mode.cs rename to StarlightDirector/UI/Windows/MainWindow.Commands.Edit.Mode.cs index 9539915..ba3d0eb 100644 --- a/DereTore.Applications.StarlightDirector/UI/Windows/MainWindow.Commands.Edit.Mode.cs +++ b/StarlightDirector/UI/Windows/MainWindow.Commands.Edit.Mode.cs @@ -1,7 +1,7 @@ using System.Diagnostics; using System.Windows.Input; -namespace DereTore.Applications.StarlightDirector.UI.Windows { +namespace StarlightDirector.UI.Windows { partial class MainWindow { public static readonly ICommand CmdEditModeSelect = CommandHelper.RegisterCommand("Alt+1", "Alt+NumPad1"); diff --git a/DereTore.Applications.StarlightDirector/UI/Windows/MainWindow.Commands.Edit.Note.cs b/StarlightDirector/UI/Windows/MainWindow.Commands.Edit.Note.cs similarity index 66% rename from DereTore.Applications.StarlightDirector/UI/Windows/MainWindow.Commands.Edit.Note.cs rename to StarlightDirector/UI/Windows/MainWindow.Commands.Edit.Note.cs index 783cc83..fc47954 100644 --- a/DereTore.Applications.StarlightDirector/UI/Windows/MainWindow.Commands.Edit.Note.cs +++ b/StarlightDirector/UI/Windows/MainWindow.Commands.Edit.Note.cs @@ -1,10 +1,11 @@ using System.Collections.Generic; using System.Diagnostics; +using System.Linq; using System.Windows.Input; -using DereTore.Applications.StarlightDirector.Entities; -using DereTore.Applications.StarlightDirector.UI.Controls.Primitives; +using StarlightDirector.Entities; +using StarlightDirector.UI.Controls.Primitives; -namespace DereTore.Applications.StarlightDirector.UI.Windows { +namespace StarlightDirector.UI.Windows { partial class MainWindow { public static readonly ICommand CmdEditNoteAdd = CommandHelper.RegisterCommand(); @@ -14,6 +15,8 @@ partial class MainWindow { public static readonly ICommand CmdEditNoteStartPosition4 = CommandHelper.RegisterCommand("Ctrl+4"); public static readonly ICommand CmdEditNoteStartPosition5 = CommandHelper.RegisterCommand("Ctrl+5"); public static readonly ICommand CmdEditNoteDelete = CommandHelper.RegisterCommand("Delete"); + public static readonly ICommand CmdEditNoteSetSlideTypeToFlick = CommandHelper.RegisterCommand(); + public static readonly ICommand CmdEditNoteSetSlideTypeToSlide = CommandHelper.RegisterCommand(); private void CmdEditNoteAdd_CanExecute(object sender, CanExecuteRoutedEventArgs e) { e.CanExecute = Editor.HasSingleSelectedScoreBar && false; @@ -103,5 +106,41 @@ private static void ChangeNoteStartPositionTo(IEnumerable scoreNotes, } } + private void CmdEditNoteSetSlideTypeToFlick_CanExecute(object sender, CanExecuteRoutedEventArgs e) { + var notes = Editor.GetSelectedScoreNotes(); + // The problem is that, in Note.UpdateFlickTypeStep2(), if we check n2.IsFlick from the first to the end in temporal + // order, we will always get 'true'. Therefore we must calculate IsFlick in reversed temporal order. + var scoreNotes = notes as ScoreNote[] ?? notes.ToArray(); + e.CanExecute = scoreNotes.Any() && scoreNotes.All(t => t.Note.IsFlick || t.Note.IsSlide); + } + + private void CmdEditNoteSetSlideTypeToFlick_Executed(object sender, ExecutedRoutedEventArgs e) { + var notes = Editor.GetSelectedScoreNotes(); + var scoreNotes = notes as List ?? notes.ToList(); + scoreNotes.Sort((c1, c2) => Note.TimingThenPositionComparison(c1.Note, c2.Note)); + scoreNotes.Reverse(); + foreach (var scoreNote in scoreNotes) { + scoreNote.Note.Type = NoteType.TapOrFlick; + } + NotifyProjectChanged(); + } + + private void CmdEditNoteSetSlideTypeToSlide_CanExecute(object sender, CanExecuteRoutedEventArgs e) { + var notes = Editor.GetSelectedScoreNotes(); + var scoreNotes = notes as ScoreNote[] ?? notes.Reverse().ToArray(); + e.CanExecute = scoreNotes.Any() && scoreNotes.All(t => (t.Note.IsFlick && !t.Note.IsHoldEnd) || t.Note.IsSlide); + } + + private void CmdEditNoteSetSlideTypeToSlide_Executed(object sender, ExecutedRoutedEventArgs e) { + var notes = Editor.GetSelectedScoreNotes(); + var scoreNotes = notes as List ?? notes.ToList(); + scoreNotes.Sort((c1, c2) => Note.TimingThenPositionComparison(c1.Note, c2.Note)); + scoreNotes.Reverse(); + foreach (var scoreNote in scoreNotes) { + scoreNote.Note.Type = NoteType.Slide; + } + NotifyProjectChanged(); + } + } } diff --git a/DereTore.Applications.StarlightDirector/UI/Windows/MainWindow.Commands.Edit.cs b/StarlightDirector/UI/Windows/MainWindow.Commands.Edit.cs similarity index 88% rename from DereTore.Applications.StarlightDirector/UI/Windows/MainWindow.Commands.Edit.cs rename to StarlightDirector/UI/Windows/MainWindow.Commands.Edit.cs index f480e37..cae5ff0 100644 --- a/DereTore.Applications.StarlightDirector/UI/Windows/MainWindow.Commands.Edit.cs +++ b/StarlightDirector/UI/Windows/MainWindow.Commands.Edit.cs @@ -1,6 +1,6 @@ using System.Windows.Input; -namespace DereTore.Applications.StarlightDirector.UI.Windows { +namespace StarlightDirector.UI.Windows { partial class MainWindow { public static readonly ICommand CmdEditSelectAll = CommandHelper.RegisterCommand("Ctrl+A"); diff --git a/DereTore.Applications.StarlightDirector/UI/Windows/MainWindow.Commands.File.cs b/StarlightDirector/UI/Windows/MainWindow.Commands.File.cs similarity index 96% rename from DereTore.Applications.StarlightDirector/UI/Windows/MainWindow.Commands.File.cs rename to StarlightDirector/UI/Windows/MainWindow.Commands.File.cs index 6258a79..b928c45 100644 --- a/DereTore.Applications.StarlightDirector/UI/Windows/MainWindow.Commands.File.cs +++ b/StarlightDirector/UI/Windows/MainWindow.Commands.File.cs @@ -2,12 +2,12 @@ using System.Diagnostics; using System.Windows; using System.Windows.Input; -using DereTore.Applications.StarlightDirector.Entities; -using DereTore.Applications.StarlightDirector.Exchange; -using DereTore.Applications.StarlightDirector.Extensions; using Microsoft.Win32; +using StarlightDirector.Entities; +using StarlightDirector.Exchange; +using StarlightDirector.Extensions; -namespace DereTore.Applications.StarlightDirector.UI.Windows { +namespace StarlightDirector.UI.Windows { partial class MainWindow { public static readonly ICommand CmdFileNewProject = CommandHelper.RegisterCommand("Ctrl+N"); diff --git a/DereTore.Applications.StarlightDirector/UI/Windows/MainWindow.Commands.Misc.cs b/StarlightDirector/UI/Windows/MainWindow.Commands.Misc.cs similarity index 85% rename from DereTore.Applications.StarlightDirector/UI/Windows/MainWindow.Commands.Misc.cs rename to StarlightDirector/UI/Windows/MainWindow.Commands.Misc.cs index 75e07a6..ae05dba 100644 --- a/DereTore.Applications.StarlightDirector/UI/Windows/MainWindow.Commands.Misc.cs +++ b/StarlightDirector/UI/Windows/MainWindow.Commands.Misc.cs @@ -1,7 +1,7 @@ using System.Windows.Input; -using DereTore.Applications.StarlightDirector.Entities; +using StarlightDirector.Entities; -namespace DereTore.Applications.StarlightDirector.UI.Windows { +namespace StarlightDirector.UI.Windows { partial class MainWindow { public static readonly ICommand CmdScoreSwitchDifficulty = CommandHelper.RegisterCommand(); diff --git a/DereTore.Applications.StarlightDirector/UI/Windows/MainWindow.Commands.Music.cs b/StarlightDirector/UI/Windows/MainWindow.Commands.Music.cs similarity index 97% rename from DereTore.Applications.StarlightDirector/UI/Windows/MainWindow.Commands.Music.cs rename to StarlightDirector/UI/Windows/MainWindow.Commands.Music.cs index 2749329..7036b98 100644 --- a/DereTore.Applications.StarlightDirector/UI/Windows/MainWindow.Commands.Music.cs +++ b/StarlightDirector/UI/Windows/MainWindow.Commands.Music.cs @@ -2,13 +2,13 @@ using System.IO; using System.Windows; using System.Windows.Input; -using DereTore.Applications.StarlightDirector.Extensions; using Microsoft.Win32; using NAudio.CoreAudioApi; using NAudio.Wave; +using StarlightDirector.Extensions; using AudioOut = NAudio.Wave.WasapiOut; -namespace DereTore.Applications.StarlightDirector.UI.Windows { +namespace StarlightDirector.UI.Windows { partial class MainWindow { public static readonly ICommand CmdMusicSelectWaveFile = CommandHelper.RegisterCommand(); diff --git a/DereTore.Applications.StarlightDirector/UI/Windows/MainWindow.Commands.Preview.cs b/StarlightDirector/UI/Windows/MainWindow.Commands.Preview.cs similarity index 96% rename from DereTore.Applications.StarlightDirector/UI/Windows/MainWindow.Commands.Preview.cs rename to StarlightDirector/UI/Windows/MainWindow.Commands.Preview.cs index a880e88..d74e60f 100644 --- a/DereTore.Applications.StarlightDirector/UI/Windows/MainWindow.Commands.Preview.cs +++ b/StarlightDirector/UI/Windows/MainWindow.Commands.Preview.cs @@ -1,8 +1,7 @@ using System.Linq; using System.Windows.Input; -using DereTore.Applications.StarlightDirector.Entities; -namespace DereTore.Applications.StarlightDirector.UI.Windows { +namespace StarlightDirector.UI.Windows { partial class MainWindow { public static readonly ICommand CmdPreviewToggle = CommandHelper.RegisterCommand("F5"); diff --git a/DereTore.Applications.StarlightDirector/UI/Windows/MainWindow.Commands.View.cs b/StarlightDirector/UI/Windows/MainWindow.Commands.View.cs similarity index 97% rename from DereTore.Applications.StarlightDirector/UI/Windows/MainWindow.Commands.View.cs rename to StarlightDirector/UI/Windows/MainWindow.Commands.View.cs index 1445dd4..2ea9795 100644 --- a/DereTore.Applications.StarlightDirector/UI/Windows/MainWindow.Commands.View.cs +++ b/StarlightDirector/UI/Windows/MainWindow.Commands.View.cs @@ -1,6 +1,6 @@ using System.Windows.Input; -namespace DereTore.Applications.StarlightDirector.UI.Windows { +namespace StarlightDirector.UI.Windows { partial class MainWindow { public static readonly ICommand CmdViewZoomIn = CommandHelper.RegisterCommand(); diff --git a/DereTore.Applications.StarlightDirector/UI/Windows/MainWindow.DependencyProperties.cs b/StarlightDirector/UI/Windows/MainWindow.DependencyProperties.cs similarity index 97% rename from DereTore.Applications.StarlightDirector/UI/Windows/MainWindow.DependencyProperties.cs rename to StarlightDirector/UI/Windows/MainWindow.DependencyProperties.cs index 5e53803..221a174 100644 --- a/DereTore.Applications.StarlightDirector/UI/Windows/MainWindow.DependencyProperties.cs +++ b/StarlightDirector/UI/Windows/MainWindow.DependencyProperties.cs @@ -1,9 +1,9 @@ using System.Diagnostics; using System.Windows; using System.Windows.Media; -using DereTore.Applications.StarlightDirector.Entities; +using StarlightDirector.Entities; -namespace DereTore.Applications.StarlightDirector.UI.Windows { +namespace StarlightDirector.UI.Windows { partial class MainWindow { public Project Project { diff --git a/DereTore.Applications.StarlightDirector/UI/Windows/MainWindow.EventHandlers.cs b/StarlightDirector/UI/Windows/MainWindow.EventHandlers.cs similarity index 96% rename from DereTore.Applications.StarlightDirector/UI/Windows/MainWindow.EventHandlers.cs rename to StarlightDirector/UI/Windows/MainWindow.EventHandlers.cs index 378b87e..8baeceb 100644 --- a/DereTore.Applications.StarlightDirector/UI/Windows/MainWindow.EventHandlers.cs +++ b/StarlightDirector/UI/Windows/MainWindow.EventHandlers.cs @@ -4,10 +4,10 @@ using System.Windows; using System.Windows.Controls; using System.Windows.Input; -using DereTore.Applications.StarlightDirector.Entities; -using DereTore.Applications.StarlightDirector.Extensions; +using StarlightDirector.Entities; +using StarlightDirector.Extensions; -namespace DereTore.Applications.StarlightDirector.UI.Windows { +namespace StarlightDirector.UI.Windows { partial class MainWindow { private void MainWindow_OnLoaded(object sender, RoutedEventArgs e) { diff --git a/DereTore.Applications.StarlightDirector/UI/Windows/MainWindow.xaml b/StarlightDirector/UI/Windows/MainWindow.xaml similarity index 95% rename from DereTore.Applications.StarlightDirector/UI/Windows/MainWindow.xaml rename to StarlightDirector/UI/Windows/MainWindow.xaml index cfb1011..0be2dfc 100644 --- a/DereTore.Applications.StarlightDirector/UI/Windows/MainWindow.xaml +++ b/StarlightDirector/UI/Windows/MainWindow.xaml @@ -1,16 +1,16 @@ - @@ -110,6 +110,10 @@ + + + + @@ -229,7 +233,8 @@ - + diff --git a/DereTore.Applications.StarlightDirector/UI/Windows/MainWindow.xaml.cs b/StarlightDirector/UI/Windows/MainWindow.xaml.cs similarity index 97% rename from DereTore.Applications.StarlightDirector/UI/Windows/MainWindow.xaml.cs rename to StarlightDirector/UI/Windows/MainWindow.xaml.cs index 3c24ea2..6927a84 100644 --- a/DereTore.Applications.StarlightDirector/UI/Windows/MainWindow.xaml.cs +++ b/StarlightDirector/UI/Windows/MainWindow.xaml.cs @@ -2,7 +2,7 @@ using System.Timers; using DereTore.Interop; -namespace DereTore.Applications.StarlightDirector.UI.Windows { +namespace StarlightDirector.UI.Windows { public partial class MainWindow { public MainWindow() { diff --git a/DereTore.Applications.StarlightDirector/UIHelper.cs b/StarlightDirector/UIHelper.cs similarity index 97% rename from DereTore.Applications.StarlightDirector/UIHelper.cs rename to StarlightDirector/UIHelper.cs index 161bc62..29f4df7 100644 --- a/DereTore.Applications.StarlightDirector/UIHelper.cs +++ b/StarlightDirector/UIHelper.cs @@ -4,7 +4,7 @@ using System.Windows.Media; using DereTore.Interop; -namespace DereTore.Applications.StarlightDirector { +namespace StarlightDirector { public static class UIHelper { public static void RegisterWndProc(this Window window, HwndSourceHook hook) { diff --git a/DereTore.Applications.StarlightDirector/app.config b/StarlightDirector/app.config similarity index 89% rename from DereTore.Applications.StarlightDirector/app.config rename to StarlightDirector/app.config index 9ee14e3..73b1379 100644 --- a/DereTore.Applications.StarlightDirector/app.config +++ b/StarlightDirector/app.config @@ -10,7 +10,7 @@ - + diff --git a/DereTore.Applications.StarlightDirector/app.manifest b/StarlightDirector/app.manifest similarity index 100% rename from DereTore.Applications.StarlightDirector/app.manifest rename to StarlightDirector/app.manifest diff --git a/DereTore.Applications.StarlightDirector/docs/user-guide_zh-CN.md b/StarlightDirector/docs/user-guide_zh-CN.md similarity index 100% rename from DereTore.Applications.StarlightDirector/docs/user-guide_zh-CN.md rename to StarlightDirector/docs/user-guide_zh-CN.md diff --git a/DereTore.Applications.StarlightDirector/packages.config b/StarlightDirector/packages.config similarity index 58% rename from DereTore.Applications.StarlightDirector/packages.config rename to StarlightDirector/packages.config index 9606850..2961316 100644 --- a/DereTore.Applications.StarlightDirector/packages.config +++ b/StarlightDirector/packages.config @@ -1,9 +1,9 @@  - + - + - + \ No newline at end of file diff --git a/DereTore.Applications.StarlightDirector/x64/sqlite3.dll b/StarlightDirector/x64/sqlite3.dll similarity index 100% rename from DereTore.Applications.StarlightDirector/x64/sqlite3.dll rename to StarlightDirector/x64/sqlite3.dll diff --git a/DereTore.Applications.StarlightDirector/x86/sqlite3.dll b/StarlightDirector/x86/sqlite3.dll similarity index 100% rename from DereTore.Applications.StarlightDirector/x86/sqlite3.dll rename to StarlightDirector/x86/sqlite3.dll diff --git a/TODO.md b/TODO.md index 69a3cd5..fdf6fc9 100644 --- a/TODO.md +++ b/TODO.md @@ -27,6 +27,7 @@ - [x] Quick zooming to the level of seeing 1/8, 1/16, 1/24 note, etc. - [x] More efficient rendering (`ScrollViewer`) - [x] Score Lens + - [x] Slide notes (from CGSS v2.7.0+) - [x] Preview - [x] Live preview (see Deleste) - [ ] Inlined audio spectrum diff --git a/appveyor.yml b/appveyor.yml index 0f36d91..0a71f86 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,6 +1,6 @@ # https://www.appveyor.com/docs/appveyor-yml/ -version: 0.6.1.{build} +version: 0.7.0.{build} branches: only: - master @@ -19,10 +19,10 @@ environment: before_build: nuget restore after_build: - - 7z a deretore-toolkit.zip -r %APPVEYOR_BUILD_FOLDER%/DereTore.Applications.StarlightDirector/bin/%PLATFORM%/%CONFIGURATION%/*.exe - - 7z a deretore-toolkit.zip -r %APPVEYOR_BUILD_FOLDER%/DereTore.Applications.StarlightDirector/bin/%PLATFORM%/%CONFIGURATION%/*.dll - - 7z a deretore-toolkit.zip -r %APPVEYOR_BUILD_FOLDER%/DereTore.Applications.ScoreEditor/bin/%PLATFORM%/%CONFIGURATION%/*.exe - - 7z a deretore-toolkit.zip -r %APPVEYOR_BUILD_FOLDER%/DereTore.Applications.ScoreEditor/bin/%PLATFORM%/%CONFIGURATION%/*.dll + - 7z a deretore-toolkit.zip -r %APPVEYOR_BUILD_FOLDER%/StarlightDirector/bin/%PLATFORM%/%CONFIGURATION%/*.exe + - 7z a deretore-toolkit.zip -r %APPVEYOR_BUILD_FOLDER%/StarlightDirector/bin/%PLATFORM%/%CONFIGURATION%/*.dll + - 7z a deretore-toolkit.zip -r %APPVEYOR_BUILD_FOLDER%/DereTore.Applications.ScoreViewer/bin/%PLATFORM%/%CONFIGURATION%/*.exe + - 7z a deretore-toolkit.zip -r %APPVEYOR_BUILD_FOLDER%/DereTore.Applications.ScoreViewer/bin/%PLATFORM%/%CONFIGURATION%/*.dll - 7z a deretore-toolkit.zip -r %APPVEYOR_BUILD_FOLDER%/DereTore.Applications.MusicToolchain/bin/%PLATFORM%/%CONFIGURATION%/*.exe - 7z a deretore-toolkit.zip -r %APPVEYOR_BUILD_FOLDER%/DereTore.Applications.MusicToolchain/bin/%PLATFORM%/%CONFIGURATION%/*.dll - 7z a deretore-toolkit.zip -r %APPVEYOR_BUILD_FOLDER%/DereTore.Applications.Hca2Wav/bin/%PLATFORM%/%CONFIGURATION%/*.exe @@ -31,10 +31,10 @@ after_build: - 7z a deretore-toolkit.zip -r %APPVEYOR_BUILD_FOLDER%/DereTore.Applications.AcbUnzip/bin/%PLATFORM%/%CONFIGURATION%/*.dll - 7z a deretore-toolkit.zip -r %APPVEYOR_BUILD_FOLDER%/DereTore.Applications.JacketCreator/bin/%PLATFORM%/%CONFIGURATION%/*.exe - 7z a deretore-toolkit.zip -r %APPVEYOR_BUILD_FOLDER%/DereTore.Applications.JacketCreator/bin/%PLATFORM%/%CONFIGURATION%/*.dll - - 7z a deretore-toolkit.zip %APPVEYOR_BUILD_FOLDER%/DereTore.Applications.StarlightDirector/bin/%PLATFORM%/%CONFIGURATION%/StarlightDirector.exe.config - - 7z a deretore-toolkit.zip -r %APPVEYOR_BUILD_FOLDER%/DereTore.Applications.StarlightDirector/bin/%PLATFORM%/%CONFIGURATION%/*.mdb - - 7z a deretore-toolkit.zip -r %APPVEYOR_BUILD_FOLDER%/DereTore.Applications.StarlightDirector/bin/%PLATFORM%/%CONFIGURATION%/*.wav - - 7z a deretore-toolkit.zip -r %APPVEYOR_BUILD_FOLDER%/DereTore.Applications.ScoreEditor/bin/%PLATFORM%/%CONFIGURATION%/*.wav + - 7z a deretore-toolkit.zip %APPVEYOR_BUILD_FOLDER%/StarlightDirector/bin/%PLATFORM%/%CONFIGURATION%/StarlightDirector.exe.config + - 7z a deretore-toolkit.zip -r %APPVEYOR_BUILD_FOLDER%/StarlightDirector/bin/%PLATFORM%/%CONFIGURATION%/*.mdb + - 7z a deretore-toolkit.zip -r %APPVEYOR_BUILD_FOLDER%/StarlightDirector/bin/%PLATFORM%/%CONFIGURATION%/*.wav + - 7z a deretore-toolkit.zip -r %APPVEYOR_BUILD_FOLDER%/DereTore.Applications.ScoreViewer/bin/%PLATFORM%/%CONFIGURATION%/*.wav - copy deretore-toolkit.zip deretore-toolkit-%PLATFORM%-v%APPVEYOR_BUILD_VERSION%-alpha-b%APPVEYOR_BUILD_NUMBER%.zip - copy deretore-toolkit.zip deretore-toolkit-%PLATFORM%.zip artifacts: