Ejemplo n.º 1
0
 /// <summary>
 /// Loads the store bindings between virtual object and the PCFs
 /// </summary>
 void LoadBindings()
 {
     _persistentStore = new MLPersistentFileStorage <MLContentBindings>();
     _data            = _persistentStore.Load(_fileName);
     if (_data != null)
     {
         CacheData(_data);
     }
     else
     {
         _data          = new MLContentBindings();
         _data.Bindings = new List <MLContentBinding>();
         _data.Version  = "1.0f";
     }
 }
Ejemplo n.º 2
0
 /// <summary>
 /// stores the bindings in a look up dictionary
 /// </summary>
 /// <param name="data">Data.</param>
 void CacheData(MLContentBindings data)
 {
     // go through all previously saved data bindings between virtual objects and PCF
     // and construct look up dictionaries between the bindings for quick access
     foreach (MLContentBinding binding in data.Bindings)
     {
         if (!_virtualIdToBindings.ContainsKey(binding.ObjectId))
         {
             _virtualIdToBindings.Add(binding.ObjectId, binding);
         }
         else
         {
             MLPluginLog.ErrorFormat("MLPersistentStore.CacheData failed. Reason: Two bindings with same id, {0}, were saved", binding.ObjectId);
         }
     }
 }