2
0
mirror of https://github.com/esiur/esiur-dotnet.git synced 2025-06-27 13:33:13 +00:00

Add project files.

This commit is contained in:
Ahmed Zamil
2017-09-15 23:40:03 +03:00
parent 4c95cb1cc6
commit 7ae722ab51
99 changed files with 14687 additions and 0 deletions

View File

@ -0,0 +1,56 @@
using Esiur.Resource;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Esiur.Engine;
namespace Esiur.Stores
{
public class MemoryStore : IStore
{
public Instance Instance { get; set; }
public event DestroyedEvent OnDestroy;
Dictionary<uint, IResource> resources = new Dictionary<uint, IResource>();
public void Destroy()
{
}
public string Link(IResource resource)
{
if (resource.Instance.Store == this)
return this.Instance.Name + "/" + resource.Instance.Id;
return null;
}
public AsyncReply<IResource> Get(string path)
{
return new AsyncReply<IResource>(null);
}
public bool Put(IResource resource)
{
resources.Add(resource.Instance.Id, resource);
return true;
}
public AsyncReply<IResource> Retrieve(uint iid)
{
if (resources.ContainsKey(iid))
return new AsyncReply<IResource>(resources[iid]);
else
return new AsyncReply<IResource>(null);
}
public AsyncReply<bool> Trigger(ResourceTrigger trigger)
{
return new AsyncReply<bool>(true);
}
}
}