Skip to content

Commit

Permalink
ref - Simplified collections
Browse files Browse the repository at this point in the history
---

Type: ref
Breaking: False
Doc Required: False
Part: 1/1
  • Loading branch information
AptiviCEO committed Feb 15, 2024
1 parent 191e5df commit 89022be
Show file tree
Hide file tree
Showing 14 changed files with 16 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ internal static void RemoveNotes() =>
/// </summary>
/// <returns>An array of note contents</returns>
internal static string[] ListNotes() =>
notes.ToArray();
[.. notes];

/// <summary>
/// Saves all notes
Expand Down
2 changes: 1 addition & 1 deletion public/Nitrocid/Drivers/Filesystem/BaseFilesystemDriver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -989,7 +989,7 @@ public virtual string GetNumberedFileName(string path, string fileName)

/// <inheritdoc/>
public virtual List<string> GetPathList() =>
PathLookupTools.PathsToLookup.Split(Convert.ToChar(PathLookupTools.PathLookupDelimiter)).ToList();
[.. PathLookupTools.PathsToLookup.Split(Convert.ToChar(PathLookupTools.PathLookupDelimiter))];

/// <inheritdoc/>
public string GetRandomFileName() =>
Expand Down
2 changes: 1 addition & 1 deletion public/Nitrocid/Kernel/Debugging/DebugWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public static class DebugWriter
/// Debug stack trace list
/// </summary>
public static string[] DebugStackTraces =>
debugStackTraces.ToArray();
[.. debugStackTraces];

/// <summary>
/// Censor private information that may be printed to the debug logs.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public class RemoteDebugDeviceInfo
/// </summary>
[JsonIgnore]
public string[] ChatHistory =>
chatHistory.ToArray();
[.. chatHistory];

[JsonConstructor]
internal RemoteDebugDeviceInfo()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ public static string[] ListDeviceNames() =>
/// Lists all devices and puts them into an array
/// </summary>
public static RemoteDebugDeviceInfo[] ListDevices() =>
remoteDebugDevices.ToArray();
[.. remoteDebugDevices];

/// <summary>
/// Gets a device by IP address
Expand Down
2 changes: 1 addition & 1 deletion public/Nitrocid/Misc/Interactives/FilesSelectorCli.cs
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ public override string GetEntryFromItem(object item)
/// Selected files. If not selected yet and bailed earlier, this list is empty.
/// </summary>
public string[] SelectedFiles =>
selectedFiles.ToArray();
[.. selectedFiles];

private static void SelectOrGoTo(FileSystemEntry currentFileSystemEntry)
{
Expand Down
2 changes: 1 addition & 1 deletion public/Nitrocid/Misc/Interactives/FoldersSelectorCli.cs
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ public override string GetEntryFromItem(object item)
/// Selected files. If not selected yet and bailed earlier, this list is empty.
/// </summary>
public string[] SelectedFolders =>
selectedFolders.ToArray();
[.. selectedFolders];

private static void Select(FileSystemEntry currentFileSystemEntry)
{
Expand Down
2 changes: 1 addition & 1 deletion public/Nitrocid/Misc/Splash/SplashReport.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public static class SplashReport
/// Log buffer of the boot process
/// </summary>
public static string[] LogBuffer =>
logBuffer.ToArray();
[.. logBuffer];

/// <summary>
/// Reports the progress for the splash screen while the kernel is booting.
Expand Down
2 changes: 1 addition & 1 deletion public/Nitrocid/Modifications/ModManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ public static void RemoveModFromBlacklist(string ModFilename)
/// <summary>
/// Gets the blacklisted mods list
/// </summary>
public static List<string> GetBlacklistedMods() => BlacklistedModsString.Split(';').ToList();
public static List<string> GetBlacklistedMods() => [.. BlacklistedModsString.Split(';')];

/// <summary>
/// Installs the mod DLL or single code file to the mod directory
Expand Down
2 changes: 1 addition & 1 deletion public/Nitrocid/Network/SpeedDial/SpeedDialTools.cs
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ public static bool TryAddEntryToSpeedDial(string Address, int Port, string Speed
/// </summary>
/// <returns>A list</returns>
public static SpeedDialEntry[] ListSpeedDialEntries() =>
speedDialEntries.ToArray();
[.. speedDialEntries];

/// <summary>
/// Lists all speed dial entries by type
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ public CommandArgumentPart(bool argumentRequired, string argumentExpression, Fun
if (!done && argumentExpression.Contains('/'))
{
string[] expressions = argumentExpression.Split('/');
autoCompleter = (_) => expressions.ToArray();
autoCompleter = (_) => [.. expressions];
done = true;
}
}
Expand Down
2 changes: 1 addition & 1 deletion public/Nitrocid/Shell/Shells/Admin/AdminShellInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ internal class AdminShellInfo : BaseShellInfo, IShellInfo
{
new CommandArgumentPart(false, "argument", new CommandArgumentPartOptions()
{
AutoCompleter = (_) => ArgumentParse.AvailableCMDLineArgs.Keys.ToArray()
AutoCompleter = (_) => [.. ArgumentParse.AvailableCMDLineArgs.Keys]
})
})
], new ArgHelpCommand(), CommandFlags.Wrappable | CommandFlags.RedirectionSupported),
Expand Down
4 changes: 2 additions & 2 deletions public/Nitrocid/Shell/Shells/Debug/DebugShellInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ internal class DebugShellInfo : BaseShellInfo, IShellInfo
{
new CommandArgumentPart(true, "field", new CommandArgumentPartOptions()
{
AutoCompleter = (_) => FieldManager.GetAllFieldsNoEvaluation().Keys.ToArray(),
AutoCompleter = (_) => [.. FieldManager.GetAllFieldsNoEvaluation().Keys],
})
}, true)
], new GetFieldValueCommand()),
Expand All @@ -86,7 +86,7 @@ internal class DebugShellInfo : BaseShellInfo, IShellInfo
{
new CommandArgumentPart(true, "property", new CommandArgumentPartOptions()
{
AutoCompleter = (_) => PropertyManager.GetAllPropertiesNoEvaluation().Keys.ToArray(),
AutoCompleter = (_) => [.. PropertyManager.GetAllPropertiesNoEvaluation().Keys],
})
}, true)
], new GetPropertyValueCommand()),
Expand Down
4 changes: 2 additions & 2 deletions public/Nitrocid/Shell/Shells/UESH/UESHShellInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ internal class UESHShellInfo : BaseShellInfo, IShellInfo
{
new CommandArgumentPart(true, "oldUserName", new CommandArgumentPartOptions()
{
AutoCompleter = (_) => UserManagement.ListAllUsers().ToArray()
AutoCompleter = (_) => [.. UserManagement.ListAllUsers()]
}),
new CommandArgumentPart(true, "newUserName"),
})
Expand Down Expand Up @@ -798,7 +798,7 @@ internal class UESHShellInfo : BaseShellInfo, IShellInfo
new CommandArgumentPart(true, "reload/load/unload"),
new CommandArgumentPart(true, "customlanguagename", new CommandArgumentPartOptions()
{
AutoCompleter = (_) => LanguageManager.CustomLanguages.Keys.ToArray()
AutoCompleter = (_) => [.. LanguageManager.CustomLanguages.Keys]
}),
}),
new CommandArgumentInfo(new[]
Expand Down

0 comments on commit 89022be

Please sign in to comment.