Ryujinx/Ryujinx.Core/OsHle/Handles/HDomain.cs

48 lines
1,000 B
C#
Raw Normal View History

2018-02-04 18:08:20 -05:00
using System;
namespace Ryujinx.Core.OsHle.Handles
2018-02-04 18:08:20 -05:00
{
class HDomain : HSession, IDisposable
2018-02-04 18:08:20 -05:00
{
private IdDictionary Objects;
2018-02-04 18:08:20 -05:00
public HDomain(HSession Session) : base(Session)
{
Objects = new IdDictionary();
2018-02-04 18:08:20 -05:00
}
public int Add(object Obj)
2018-02-04 18:08:20 -05:00
{
return Objects.Add(Obj);
}
2018-02-04 18:08:20 -05:00
public bool Delete(int Id)
{
return Objects.Delete(Id);
2018-02-04 18:08:20 -05:00
}
public object GetObject(int Id)
2018-02-04 18:08:20 -05:00
{
return Objects.GetData(Id);
}
2018-02-04 18:08:20 -05:00
public void Dispose()
{
Dispose(true);
2018-02-04 18:08:20 -05:00
}
protected virtual void Dispose(bool Disposing)
2018-02-04 18:08:20 -05:00
{
if (Disposing)
2018-02-04 18:08:20 -05:00
{
foreach (object Obj in Objects)
{
if (Obj is IDisposable DisposableObj)
{
DisposableObj.Dispose();
}
}
2018-02-04 18:08:20 -05:00
}
}
}
}