Apply R# clean-up for reliability (#877)
* Apply R# clean-up for reliability - Migrate to NUnit4 Assert.That - Update dependencise versions - Fix LangVersion to 9.0 (until net core migration) - Reformat code - Apply 'var' style (easier for refactoring) - Remove redundant parentheses - Add braces on every condition blocks (1 line) - Uses new null checking patterns - Uses AutoProperties when possible - Uses string scalar type instead of class - Clean usings - Add .orig files in git ignore - Rename some properties to respect defined conventions and US format definition - ID -> Id - BPM -> Bpm - Finish -> End * Update R# settings according to the clean-up made
This commit is contained in:
1 parent
b9b0f7c8df
commit
6ffa63b923
236 files changed
+14194
-7278
No files matched your search
@@ -33,8 +33,11 @@ namespace VocaluxeLib.Songs
|
||||
|
||||
public CSongLine(CSongLine line)
|
||||
{
|
||||
foreach (CSongNote note in line._Notes)
|
||||
foreach (var note in line._Notes)
|
||||
{
|
||||
_Notes.Add(new CSongNote(note));
|
||||
}
|
||||
|
||||
_StartBeat = line._StartBeat;
|
||||
_EndBeat = line._EndBeat;
|
||||
VisibleInTimeLine = line.VisibleInTimeLine;
|
||||
@@ -50,7 +53,9 @@ namespace VocaluxeLib.Songs
|
||||
set
|
||||
{
|
||||
if (value <= FirstNoteBeat)
|
||||
{
|
||||
_StartBeat = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -60,13 +65,15 @@ namespace VocaluxeLib.Songs
|
||||
set
|
||||
{
|
||||
if (value >= LastNoteBeat)
|
||||
{
|
||||
_EndBeat = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public string Lyrics
|
||||
{
|
||||
get { return _Notes.Aggregate(String.Empty, (current, note) => current + note.Text); }
|
||||
get { return _Notes.Aggregate(string.Empty, (current, note) => current + note.Text); }
|
||||
}
|
||||
#endregion Properties
|
||||
|
||||
@@ -74,31 +81,42 @@ namespace VocaluxeLib.Songs
|
||||
public override bool AddNote(CSongNote note)
|
||||
{
|
||||
if (_Notes.Count == 0)
|
||||
{
|
||||
_Notes.Add(note);
|
||||
}
|
||||
else
|
||||
{
|
||||
//Insert AFTER this note
|
||||
int insPos = FindPreviousNote(note.StartBeat);
|
||||
var insPos = FindPreviousNote(note.StartBeat);
|
||||
//Check for overlapping notes
|
||||
if (insPos >= 0) //Check note before
|
||||
{
|
||||
if (_Notes[insPos].EndBeat >= note.StartBeat)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (insPos < _Notes.Count - 1) //Check note after
|
||||
{
|
||||
if (_Notes[insPos + 1].StartBeat <= note.EndBeat)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
_Notes.Insert(insPos + 1, note);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public void SetMedley(int startBeat, int endBeat)
|
||||
{
|
||||
foreach (CSongNote note in _Notes.Where(note => note.StartBeat < startBeat || note.EndBeat > endBeat))
|
||||
foreach (var note in _Notes.Where(note => note.StartBeat < startBeat || note.EndBeat > endBeat))
|
||||
{
|
||||
note.Type = ENoteType.Freestyle;
|
||||
}
|
||||
|
||||
VisibleInTimeLine = FirstNoteBeat >= startBeat && LastNoteBeat <= endBeat;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user