mirror of
https://github.com/space-wizards/RobustToolbox.git
synced 2026-02-15 03:30:53 +01:00
* Console command completions v1.
I think it works™️
* Unify cvar commands
* Handle no-completions-at-all better.
* Don't crash if you tab complete while no completions available.
* Always show hints if available
* Properly null completion hint over the wire
* Unify help command, localize it.
* Clean up + localize cvar command.
* Remove debug logging
* List command unified & localized.
* Remove server completions debug logging
* Remote execute command.
Had to make everything async for this.
* Don't lower case enums or bools
Why
* GC commands converted and localized.
* Fix remote command completions.
Whoops
* Kick command completions
* lsasm unified & localized.
* Revert "Don't lower case enums or bools"
This reverts commit 2f825347c3.
* ToString gc_mode command enums instead of trying to fix Fluent.
Ah well.
* Unify szr_stats
* Unify log commands, completions
* Fix compile
* Improve completion with complex cases (quotes, escapes)
* Code cleanup, comments.
* Fix tab completion with empty arg ruining everything.
* Fix RegisteredCommand completions
* Add more complex completion options system.
* Refactor content directory entries into a proper resource manager API.
* Implement GetEntries for DirLoader
* Make type hint darker.
* Exec command autocomplete, pulled play global sound code out to engine.
98 lines
2.4 KiB
C#
98 lines
2.4 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Threading;
|
|
using Robust.Shared.Utility;
|
|
|
|
namespace Robust.Shared.Log
|
|
{
|
|
// Sealed. New functionality should be added with handlers.
|
|
public partial class LogManager : ILogManager, IDisposable
|
|
{
|
|
public const string SawmillProperty = "Sawmill";
|
|
public const string ROOT = "root";
|
|
private readonly Sawmill rootSawmill;
|
|
public ISawmill RootSawmill => rootSawmill;
|
|
|
|
private readonly Dictionary<string, Sawmill> sawmills = new();
|
|
private readonly ReaderWriterLockSlim _sawmillsLock = new();
|
|
|
|
public ISawmill GetSawmill(string name)
|
|
{
|
|
_sawmillsLock.EnterReadLock();
|
|
try
|
|
{
|
|
if (sawmills.TryGetValue(name, out var sawmill))
|
|
{
|
|
return sawmill;
|
|
}
|
|
}
|
|
finally
|
|
{
|
|
_sawmillsLock.ExitReadLock();
|
|
}
|
|
|
|
_sawmillsLock.EnterWriteLock();
|
|
try
|
|
{
|
|
return _getSawmillUnlocked(name);
|
|
}
|
|
finally
|
|
{
|
|
_sawmillsLock.ExitWriteLock();
|
|
}
|
|
}
|
|
|
|
public IEnumerable<ISawmill> AllSawmills
|
|
{
|
|
get
|
|
{
|
|
using var _ = _sawmillsLock.ReadGuard();
|
|
|
|
return sawmills.Values.ToArray();
|
|
}
|
|
}
|
|
|
|
private Sawmill _getSawmillUnlocked(string name)
|
|
{
|
|
if (sawmills.TryGetValue(name, out var sawmill))
|
|
{
|
|
return sawmill;
|
|
}
|
|
|
|
var index = name.LastIndexOf('.');
|
|
string parentName;
|
|
if (index == -1)
|
|
{
|
|
parentName = ROOT;
|
|
}
|
|
else
|
|
{
|
|
parentName = name.Substring(0, index);
|
|
}
|
|
|
|
var parent = _getSawmillUnlocked(parentName);
|
|
sawmill = new Sawmill(parent, name);
|
|
sawmills.Add(name, sawmill);
|
|
return sawmill;
|
|
}
|
|
|
|
public LogManager()
|
|
{
|
|
rootSawmill = new Sawmill(null, ROOT)
|
|
{
|
|
Level = LogLevel.Debug,
|
|
};
|
|
sawmills[ROOT] = rootSawmill;
|
|
}
|
|
|
|
public void Dispose()
|
|
{
|
|
foreach (Sawmill p in sawmills.Values)
|
|
{
|
|
p.Dispose();
|
|
}
|
|
}
|
|
}
|
|
}
|