Skip to content

Commit

Permalink
chore: add missing docs
Browse files Browse the repository at this point in the history
  • Loading branch information
rushiiMachine committed Mar 28, 2024
1 parent d609f36 commit 589361e
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 6 deletions.
12 changes: 12 additions & 0 deletions Osu.Stubs/Obfuscated.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,17 @@

namespace Osu.Stubs;

/// <summary>
/// Original: <c>osu.Helpers.Obfuscated{T}</c>
/// b20240123: <c>#=z7wrq$zbpx0eedoF3ocH29DF53lUE{#=z62rU_UA=}</c>
/// </summary>
[UsedImplicitly]
public class Obfuscated
{
/// <summary>
/// Original: <c>Finalize()</c>
/// b20240123: <c>Finalize()</c>
/// </summary>
private static readonly LazyMethod Finalize = new(
"Obfuscated#Finalize()",
new[]
Expand All @@ -29,6 +37,10 @@ public class Obfuscated
}
);

/// <summary>
/// Original: <c>get_Value()</c> (property getter)
/// b20240123: <c>#=zHT6xZVI=</c>
/// </summary>
[UsedImplicitly]
public static readonly LazyMethod<object> GetValue = new(
"Obfuscated#get_Value()",
Expand Down
8 changes: 4 additions & 4 deletions Osu.Stubs/Ruleset.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ namespace Osu.Stubs;

/// <summary>
/// Original: <c>osu.GameModes.Play.Rulesets.Ruleset</c>
/// b20240102.2: <c>#=z35zTtWacH8qc$rYRcsQ6iGtK1MBEurfpzNOeLiQ=</c>
/// b20240123: <c>#=zwRa71lIOJzp$VMz5GAIPMrt1N4rdQ4gC2Fx1Jtw=</c>
/// </summary>
public static class Ruleset
{
/// <summary>
/// Original: <c>Fail(bool continuousPlay)</c>
/// b20240102.2: <c>#=zWoTE_tk=</c>
/// b20240123: <c>#=zPAIY7AY=</c>
/// </summary>
public static readonly LazyMethod Fail = new(
"Ruleset#Fail(...)",
Expand Down Expand Up @@ -81,7 +81,7 @@ public static class Ruleset

/// <summary>
/// Original: <c>Initialize()</c>
/// b20240123: <c></c>
/// b20240123: <c>#=znhXnLb4=</c>
/// </summary>
[UsedImplicitly]
public static readonly LazyMethod Initialize = new(
Expand Down Expand Up @@ -117,7 +117,7 @@ public static class Ruleset

/// <summary>
/// Original: <c>ScoreDisplay</c>
/// b20240123: <c></c> TODO: find this
/// b20240123: <c>#=znVUsSpw8w4aW</c>
/// </summary>
[UsedImplicitly]
public static readonly LazyField<object?> ScoreDisplay = new(
Expand Down
10 changes: 8 additions & 2 deletions Osu.Stubs/Score.cs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,11 @@ public class Score
}
);

// Is of type Obfuscated<Mods>
/// <summary>
/// Is of type <c>Obfuscated{Mods}</c>
/// Original: <c>EnabledMods</c>
/// b20240123: <c>#=zxL1NzqBwrqNU</c>
/// </summary>
[UsedImplicitly]
public static readonly LazyField<object> EnabledMods = new(
"Score#EnabledMods",
Expand All @@ -98,7 +102,9 @@ public class Score
field.FieldType.IsGenericType && field.FieldType.GetGenericTypeDefinition() == Obfuscated.RuntimeType)
);

// Generic method Obfuscated<T>.get_Value() bound to the type parameter of
/// <summary>
/// The generic method <c>Obfuscated{T}::get_Value()</c> with the type parameter T bound to <c>Mods</c>.
/// </summary>
[UsedImplicitly]
public static readonly LazyMethod<int> EnabledModsGetValue = new(
"Obfuscated<Mods>#get_Value()",
Expand Down
15 changes: 15 additions & 0 deletions Osu.Stubs/Vector2.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@

namespace Osu.Stubs;

/// <summary>
/// Original: <c>Microsoft.Xna.Framework.Vector2</c>
/// b20240123: <c>Microsoft.Xna.Framework.Vector2</c>
/// Most names are present because of this class is [Serializable].
/// </summary>
[UsedImplicitly]
public class Vector2
{
Expand All @@ -13,19 +18,29 @@ public class Vector2

/// <summary>
/// Constructor that creates a Vector2 from two distinct float values.
/// Original: <c>Vector2(float, float)</c>
/// b20240123: <c>Vector2(Single, Single)</c>
/// </summary>
[UsedImplicitly]
public static readonly LazyMethod<object> Constructor = new(
"Vector2#<init>(float, float)",
() => RuntimeType.GetConstructor([typeof(float), typeof(float)])
);

/// <summary>
/// Original: <c>X</c>
/// b20240123: <c>X</c>
/// </summary>
[UsedImplicitly]
public static readonly LazyField<float> X = new(
"Vector2#X",
() => RuntimeType.GetField("X")
);

/// <summary>
/// Original: <c>Y</c>
/// b20240123: <c>Y</c>
/// </summary>
[UsedImplicitly]
public static readonly LazyField<float> Y = new(
"Vector2#Y",
Expand Down
14 changes: 14 additions & 0 deletions Osu.Utils/Extensions/ArrayExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,24 @@ namespace Osu.Utils.Extensions;

public static class ArrayExtensions
{
/// <summary>
/// Get the value at an array index or a default value if not in range.
/// </summary>
/// <param name="array">Source array</param>
/// <param name="index">Potential index that could exist</param>
/// <param name="defaultValue">Alternative default value</param>
/// <typeparam name="T">A non-null type inside the array.</typeparam>
/// <returns>The value or default value</returns>
[UsedImplicitly]
public static T? GetOrDefault<T>(this T[] array, int index, T? defaultValue) =>
index < array.Length ? array[index] : defaultValue;

/// <summary>
/// Duplicate all the values in an array a certain amount of times.
/// </summary>
/// <param name="array">Source array</param>
/// <param name="times">Amount of times to copy the items.</param>
/// <returns>A new array with shallow copied items.</returns>
[UsedImplicitly]
public static T[] Duplicate<T>(this T[] array, int times)
{
Expand Down

0 comments on commit 589361e

Please sign in to comment.