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