Ryujinx/Ryujinx.HLE/HOS/Kernel/KAutoObject.cs
gdkchan 3615a70cae
Revert "Adjust naming conventions and general refactoring in HLE Project (#490)" (#526)
This reverts commit 85dbb9559ad317a657dafd24da27fec4b3f5250f.
2018-12-04 22:52:39 -02:00

42 lines
997 B
C#

namespace Ryujinx.HLE.HOS.Kernel
{
class KAutoObject
{
protected Horizon System;
public KAutoObject(Horizon System)
{
this.System = System;
}
public virtual KernelResult SetName(string Name)
{
if (!System.AutoObjectNames.TryAdd(Name, this))
{
return KernelResult.InvalidState;
}
return KernelResult.Success;
}
public static KernelResult RemoveName(Horizon System, string Name)
{
if (!System.AutoObjectNames.TryRemove(Name, out _))
{
return KernelResult.NotFound;
}
return KernelResult.Success;
}
public static KAutoObject FindNamedObject(Horizon System, string Name)
{
if (System.AutoObjectNames.TryGetValue(Name, out KAutoObject Obj))
{
return Obj;
}
return null;
}
}
}