Ejemplo n.º 1
0
 public void SaveDialogs(string characterId, Hashtable dialogHash)
 {
     lock (sync) {
         var document = dialogDocuments.FindOne(Query <DialogDocument> .EQ(d => d.characterId, characterId));
         if (document == null)
         {
             document = new DialogDocument {
                 characterId = characterId
             };
         }
         document.isNewDocument = false;
         document.Set(dialogHash);
         dialogDocuments.Save(document);
     }
 }
Ejemplo n.º 2
0
 public Hashtable LoadDialogs(string characterId, Res resource, out bool isNew)
 {
     lock (sync) {
         var document = dialogDocuments.FindOne(Query <DialogDocument> .EQ(d => d.characterId, characterId));
         if (document != null)
         {
             isNew = false;
             return(document.SourceObject(resource));
         }
         else
         {
             isNew    = true;
             document = new DialogDocument {
                 characterId   = characterId,
                 isNewDocument = isNew,
                 dialogHash    = new Hashtable()
             };
             dialogDocuments.Save(document);
             return(document.SourceObject(resource));
         }
     }
 }