Skip to content

Commit

Permalink
Merge pull request #182 from Warp9000/new-editorconfig
Browse files Browse the repository at this point in the history
new .editorconfig + format everything
  • Loading branch information
AiAe authored Aug 18, 2024
2 parents d766e81 + 5c4f224 commit 5f4c01d
Show file tree
Hide file tree
Showing 19 changed files with 434 additions and 322 deletions.
594 changes: 345 additions & 249 deletions .editorconfig

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions Quaver.API.Tests/Quaver/TestCaseQua.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public void MirrorHitObjects4K()
var qua = new Qua { Mode = GameMode.Keys4 };

for (var i = 0; i < qua.GetKeyCount(); i++)
qua.HitObjects.Add(new HitObjectInfo { Lane = i + 1});
qua.HitObjects.Add(new HitObjectInfo { Lane = i + 1 });

qua.MirrorHitObjects();

Expand All @@ -37,7 +37,7 @@ public void MirrorHitObjects7K()
var qua = new Qua { Mode = GameMode.Keys7 };

for (var i = 0; i < qua.GetKeyCount(); i++)
qua.HitObjects.Add(new HitObjectInfo { Lane = i + 1});
qua.HitObjects.Add(new HitObjectInfo { Lane = i + 1 });

qua.MirrorHitObjects();

Expand All @@ -56,7 +56,7 @@ public void MirrorHitObjects7KP1()
var qua = new Qua { Mode = GameMode.Keys7, HasScratchKey = true };

for (var i = 0; i < qua.GetKeyCount(); i++)
qua.HitObjects.Add(new HitObjectInfo { Lane = i + 1});
qua.HitObjects.Add(new HitObjectInfo { Lane = i + 1 });

qua.MirrorHitObjects();

Expand Down Expand Up @@ -163,7 +163,7 @@ public void SoundEffects()
{
var qua = Qua.Parse("./Quaver/Resources/sound-effects.qua");
Assert.True(qua.IsValid());
Assert.Equal(new []
Assert.Equal(new[]
{
new CustomAudioSampleInfo()
{
Expand All @@ -176,7 +176,7 @@ public void SoundEffects()
UnaffectedByRate = true
}
}, qua.CustomAudioSamples, CustomAudioSampleInfo.ByValueComparer);
Assert.Equal(new []
Assert.Equal(new[]
{
new SoundEffectInfo()
{
Expand Down Expand Up @@ -205,7 +205,7 @@ public void KeySounds()
{
var qua = Qua.Parse("./Quaver/Resources/keysounds.qua");
Assert.True(qua.IsValid());
Assert.Equal(new []
Assert.Equal(new[]
{
new CustomAudioSampleInfo()
{
Expand Down
12 changes: 6 additions & 6 deletions Quaver.API/Maps/AutoMod/AutoMod.cs
Original file line number Diff line number Diff line change
Expand Up @@ -139,12 +139,12 @@ private void DetectHitObjectIssues()
Issues.Add(new AutoModIssueShortLongNote(hitObject));

// Check if the object is before the object is before the audio begins
if (hitObject.StartTime < 0 || ( hitObject.IsLongNote && hitObject.EndTime < 0 ))
if (hitObject.StartTime < 0 || (hitObject.IsLongNote && hitObject.EndTime < 0))
Issues.Add(new AutoModIssueObjectBeforeStart(hitObject));

// Check if object is after the audio ends
if (AudioTrackInfo != null && ( hitObject.StartTime > AudioTrackInfo.DurationMs
|| hitObject.EndTime > AudioTrackInfo.DurationMs ))
if (AudioTrackInfo != null && (hitObject.StartTime > AudioTrackInfo.DurationMs
|| hitObject.EndTime > AudioTrackInfo.DurationMs))
{
Issues.Add(new AutoModIssueObjectAfterAudioEnd(hitObject));
}
Expand All @@ -161,7 +161,7 @@ private void DetectHitObjectIssues()

// Check for excessive break time.
if (hitObject.StartTime - previousObjInMap.StartTime >= BreakTime ||
( previousObjInMap.IsLongNote && hitObject.StartTime - previousObjInMap.EndTime >= BreakTime ))
(previousObjInMap.IsLongNote && hitObject.StartTime - previousObjInMap.EndTime >= BreakTime))
{
Issues.Add(new AutoModIssueExcessiveBreakTime(previousObjInMap));
}
Expand Down Expand Up @@ -228,7 +228,7 @@ private void DetectTimingPointIssues()
{
var current = Qua.TimingPoints[i];

if (AudioTrackInfo != null && ( current.StartTime > AudioTrackInfo.DurationMs ))
if (AudioTrackInfo != null && (current.StartTime > AudioTrackInfo.DurationMs))
Issues.Add(new AutoModIssueTimingPointAfterAudioEnd(current));

if (i == 0)
Expand All @@ -251,7 +251,7 @@ private void DetectScrollVelocityIssues()
{
var current = Qua.SliderVelocities[i];

if (AudioTrackInfo != null && ( current.StartTime > AudioTrackInfo.DurationMs ))
if (AudioTrackInfo != null && (current.StartTime > AudioTrackInfo.DurationMs))
Issues.Add(new AutoModIssueScrollVelocityAfterEnd(current));

if (i == 0)
Expand Down
14 changes: 7 additions & 7 deletions Quaver.API/Maps/Parsers/OsuBeatmap.cs
Original file line number Diff line number Diff line change
Expand Up @@ -356,8 +356,8 @@ public OsuBeatmap(string filePath)
var timingPoint = new OsuTimingPoint
{
Offset = float.Parse(values[0], CultureInfo.InvariantCulture),
MillisecondsPerBeat = (float) msecPerBeat,
Signature = values[2][0] == '0' ? TimeSignature.Quadruple : (TimeSignature) int.Parse(values[2], CultureInfo.InvariantCulture),
MillisecondsPerBeat = (float)msecPerBeat,
Signature = values[2][0] == '0' ? TimeSignature.Quadruple : (TimeSignature)int.Parse(values[2], CultureInfo.InvariantCulture),
SampleType = int.Parse(values[3], CultureInfo.InvariantCulture),
SampleSet = int.Parse(values[4], CultureInfo.InvariantCulture),
Volume = Math.Max(0, int.Parse(values[5], CultureInfo.InvariantCulture)),
Expand Down Expand Up @@ -389,8 +389,8 @@ public OsuBeatmap(string filePath)
X = int.Parse(values[0], CultureInfo.InvariantCulture),
Y = int.Parse(values[1], CultureInfo.InvariantCulture),
StartTime = int.Parse(values[2], CultureInfo.InvariantCulture),
Type = (HitObjectType) int.Parse(values[3], CultureInfo.InvariantCulture),
HitSound = (HitSoundType) int.Parse(values[4], CultureInfo.InvariantCulture),
Type = (HitObjectType)int.Parse(values[3], CultureInfo.InvariantCulture),
HitSound = (HitSoundType)int.Parse(values[4], CultureInfo.InvariantCulture),
Additions = "0:0:0:0:",
KeySound = -1
};
Expand Down Expand Up @@ -558,7 +558,7 @@ public Qua ToQua(bool checkValidity = true)
foreach (var hitObject in HitObjects)
{
// Get the keyLane the hitObject is in
var keyLane = (int) (hitObject.X / (512d / KeyCount)).Clamp(0, KeyCount - 1) + 1;
var keyLane = (int)(hitObject.X / (512d / KeyCount)).Clamp(0, KeyCount - 1) + 1;

// osu! considers objects in lane 1 to be the special key, Quaver considers it to be the last lane.
// Lane 8 on 7K+1
Expand Down Expand Up @@ -679,13 +679,13 @@ public static class HitSoundTypeExtension
/// <returns></returns>
public static HitSounds ToQuaverHitSounds(this HitSoundType hitSoundType)
{
var value = (int) hitSoundType & 15; // Clear any higher bits.
var value = (int)hitSoundType & 15; // Clear any higher bits.

if (value == 0)
return HitSounds.Normal;

// HitSounds happens to have the same values.
return (HitSounds) hitSoundType;
return (HitSounds)hitSoundType;
}
}

Expand Down
12 changes: 6 additions & 6 deletions Quaver.API/Maps/Qua.cs
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ public string Serialize()
Bookmarks = null;

var serializer = new Serializer();
using var stringWriter = new StringWriter {NewLine = "\r\n"};
using var stringWriter = new StringWriter { NewLine = "\r\n" };
serializer.Serialize(stringWriter, this);
var serialized = stringWriter.ToString();

Expand Down Expand Up @@ -565,7 +565,7 @@ public float GetCommonBpm()
if (point.StartTime > lastTime)
continue;

var duration = (int) (lastTime - (i == 0 ? 0 : point.StartTime));
var duration = (int)(lastTime - (i == 0 ? 0 : point.StartTime));
lastTime = point.StartTime;

if (durations.ContainsKey(point.Bpm))
Expand Down Expand Up @@ -819,7 +819,7 @@ public void ApplyInverse()
// For example, consider a fast section of the map transitioning into a very low BPM ending starting
// with the next hit object. Since the LN release and the gap are still in the fast section, they
// should use the fast section's BPM.
if ((int) Math.Round(timingPoint.StartTime) == nextObjectInLane.StartTime)
if ((int)Math.Round(timingPoint.StartTime) == nextObjectInLane.StartTime)
{
var prevTimingPointIndex = TimingPoints.FindLastIndex(x => x.StartTime < timingPoint.StartTime);

Expand All @@ -836,7 +836,7 @@ public void ApplyInverse()
}

// The time gap is quarter of the milliseconds per beat.
timeGap = (int?) Math.Max(Math.Round(15000 / bpm), MINIMAL_GAP_LENGTH);
timeGap = (int?)Math.Max(Math.Round(15000 / bpm), MINIMAL_GAP_LENGTH);
}

// Summary of the changes:
Expand Down Expand Up @@ -1380,7 +1380,7 @@ public void DenormalizeSVs()
/// <returns></returns>
public Qua WithNormalizedSVs()
{
var qua = (Qua) MemberwiseClone();
var qua = (Qua)MemberwiseClone();
// Relies on NormalizeSVs not changing anything within the by-reference members (but rather creating a new List).
qua.NormalizeSVs();
return qua;
Expand All @@ -1392,7 +1392,7 @@ public Qua WithNormalizedSVs()
/// <returns></returns>
public Qua WithDenormalizedSVs()
{
var qua = (Qua) MemberwiseClone();
var qua = (Qua)MemberwiseClone();
// Relies on DenormalizeSVs not changing anything within the by-reference members (but rather creating a new List).
qua.DenormalizeSVs();
return qua;
Expand Down
10 changes: 6 additions & 4 deletions Quaver.API/Maps/Structures/BookmarkInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,16 @@ public class BookmarkInfo
{
public int StartTime
{
get;
[MoonSharpVisible(false)] set;
get;
[MoonSharpVisible(false)]
set;
}

public string Note
{
get;
[MoonSharpVisible(false)] set;
get;
[MoonSharpVisible(false)]
set;
}

private sealed class TimeNoteEqualityComparer : IEqualityComparer<BookmarkInfo>
Expand Down
20 changes: 13 additions & 7 deletions Quaver.API/Maps/Structures/HitObjectInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ public class HitObjectInfo
public int StartTime
{
get;
[MoonSharpVisible(false)] set;
[MoonSharpVisible(false)]
set;
}

/// <summary>
Expand All @@ -38,7 +39,8 @@ public int StartTime
public int Lane
{
get;
[MoonSharpVisible(false)] set;
[MoonSharpVisible(false)]
set;
}

/// <summary>
Expand All @@ -47,7 +49,8 @@ public int Lane
public int EndTime
{
get;
[MoonSharpVisible(false)] set;
[MoonSharpVisible(false)]
set;
}

/// <summary>
Expand All @@ -56,7 +59,8 @@ public int EndTime
public HitSounds HitSound
{
get;
[MoonSharpVisible(false)] set;
[MoonSharpVisible(false)]
set;
}

/// <summary>
Expand All @@ -71,7 +75,8 @@ public HitSounds HitSound
public int EditorLayer
{
get;
[MoonSharpVisible(false)] set;
[MoonSharpVisible(false)]
set;
}

/// <summary>
Expand All @@ -87,7 +92,8 @@ public int EditorLayer
public bool IsEditableInLuaScript
{
get;
[MoonSharpVisible(false)] set;
[MoonSharpVisible(false)]
set;
}

/// <summary>
Expand Down Expand Up @@ -173,7 +179,7 @@ public int GetHashCode(HitObjectInfo obj)
var hashCode = obj.StartTime;
hashCode = (hashCode * 397) ^ obj.Lane;
hashCode = (hashCode * 397) ^ obj.EndTime;
hashCode = (hashCode * 397) ^ (int) obj.HitSound;
hashCode = (hashCode * 397) ^ (int)obj.HitSound;
foreach (var keySound in obj.KeySounds)
hashCode = (hashCode * 397) ^ KeySoundInfo.ByValueComparer.GetHashCode(keySound);
hashCode = (hashCode * 397) ^ obj.EditorLayer;
Expand Down
9 changes: 6 additions & 3 deletions Quaver.API/Maps/Structures/SliderVelocityInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ public class SliderVelocityInfo
public float StartTime
{
get;
[MoonSharpVisible(false)] set;
[MoonSharpVisible(false)]
set;
}

/// <summary>
Expand All @@ -35,7 +36,8 @@ public float StartTime
public float Multiplier
{
get;
[MoonSharpVisible(false)] set;
[MoonSharpVisible(false)]
set;
}

/// <summary>
Expand All @@ -45,7 +47,8 @@ public float Multiplier
public bool IsEditableInLuaScript
{
get;
[MoonSharpVisible(false)] set;
[MoonSharpVisible(false)]
set;
}

/// <summary>
Expand Down
17 changes: 11 additions & 6 deletions Quaver.API/Maps/Structures/TimingPointInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ public class TimingPointInfo
public float StartTime
{
get;
[MoonSharpVisible(false)] set;
[MoonSharpVisible(false)]
set;
}

/// <summary>
Expand All @@ -36,7 +37,8 @@ public float StartTime
public float Bpm
{
get;
[MoonSharpVisible(false)] set;
[MoonSharpVisible(false)]
set;
}

/// <summary>
Expand All @@ -45,7 +47,8 @@ public float Bpm
public TimeSignature Signature
{
get;
[MoonSharpVisible(false)] set;
[MoonSharpVisible(false)]
set;
}

/// <summary>
Expand All @@ -54,14 +57,16 @@ public TimeSignature Signature
public bool Hidden
{
get;
[MoonSharpVisible(false)] set;
[MoonSharpVisible(false)]
set;
}

[YamlIgnore]
public bool IsEditableInLuaScript
{
get;
[MoonSharpVisible(false)] set;
[MoonSharpVisible(false)]
set;
}

/// <summary>
Expand Down Expand Up @@ -90,7 +95,7 @@ public int GetHashCode(TimingPointInfo obj)
{
var hashCode = obj.StartTime.GetHashCode();
hashCode = (hashCode * 397) ^ obj.Bpm.GetHashCode();
hashCode = (hashCode * 397) ^ (int) obj.Signature;
hashCode = (hashCode * 397) ^ (int)obj.Signature;
hashCode = (hashCode * 397) ^ (obj.Hidden ? 1 : 0);
return hashCode;
}
Expand Down
Loading

0 comments on commit 5f4c01d

Please sign in to comment.