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