public IStateHandler <T> Create <T>(T state, string file, StateHandlerFlags flags) where T : IState
 {
     if (flags.HasFlag(StateHandlerFlags.Exportable))
     {
         _exportableStateFiles.Add(new StateFile(file, flags));
     }
     return(new JsonStateHandler <T>(state, file, flags));
 }
Exemplo n.º 2
0
        private byte[] _hash = new byte[0]; // We use this to check for changes.

        public JsonStateHandler(T state, string file, StateHandlerFlags flags)
        {
            _state = state;
            _file  = Path.IsPathRooted(file) ? file :
                     Path.Combine(Env.Config.DataDir, file + (flags.HasFlag(StateHandlerFlags.UseCipher) ? "" : ".json"));
            _flags = flags;
            if (_flags.HasFlag(StateHandlerFlags.SavePeriodically))
            {
                Env.App.AddSaveAction(SaveAsync);
            }
        }
 public IStateHandler <T> Create <T>(T state, string file, StateHandlerFlags flags) where T : IState
 {
     return(new Mock <IStateHandler <T> >().Object);
 }
Exemplo n.º 4
0
 private void InitStateHandler()
 {
     var stateHandlerPlayers = new StateHandlerPlayers(GameRoom.State.statePlayers, this);
     var stateHandlerUnits   = new StateHandlerUnits(GameRoom.State.stateUnits, this);
     var stateHandlerFlags   = new StateHandlerFlags(GameRoom.State.stateFlags, this);
 }