Example #1
0
     public IDisposable NewContext(KeyType type, string key)
     {
 #if EXBAKE_SAVE
         var fileCtx = new FileBakeContext(this, type, key);
         //It's still beneficial to open a duplicate context for the sake of record-keeping
         if (OpenedFileKeys.Contains(fileCtx.FileIdentifier))
         {
             fileCtx.DoNotExport = true;
         }
 #else
         var fileCtx = new FileServeContext(this, type, key);
 #endif
         OpenedFileKeys.Add(fileCtx.FileIdentifier);
         OpenContexts.Push(fileCtx);
         return(fileCtx);
     }
Example #2
0
 private void DisposeBake(FileBakeContext fbc)
 {
     if (fbc != CurrentFile)
     {
         throw new Exception("Tried to dispose the wrong FileBakeContext");
     }
     if (fbc == null)
     {
         throw new Exception("Dispose FileBakeContext should not be null");
     }
     if (fbc.Export().Try(out var gf))
     {
         GeneratedFiles.Add(gf);
     }
     OpenContexts.Pop();
 }