aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Tests/Common/Mock/BaseAssetRepository.cs
blob: acfe4fe25d28e097cbb3c66502f5d666ee12d399 (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); 
        }
    }
}