aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Tests/Common/Mock/BaseAssetRepository.cs
blob: b284abcc67c758b0e73800e40d4d205b042b8e19 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
using System.Collections.Generic;
using OpenMetaverse;
using OpenSim.Framework;

namespace OpenSim.Tests.Common.Mock
{
    public class BaseAssetRepository
    {
        protected Dictionary<UUID, AssetBase> Assets = new Dictionary<UUID, AssetBase>();

        public AssetBase FetchAsset(UUID uuid) 
        {
            if (ExistsAsset(uuid))
                return Assets[uuid];
            else
                return null;
        }

        public void CreateAsset(AssetBase asset) 
        {
            Assets[asset.FullID] = asset;
        }

        public void UpdateAsset(AssetBase asset) 
        {
            CreateAsset(asset);
        }

        public bool ExistsAsset(UUID uuid) 
        { 
            return Assets.ContainsKey(uuid); 
        }
    }
}