Beispiel #1
0
 public VoteCommand(IArkContext context, IConfig config, EfDatabaseContextFactory databaseContextFactory, ISavedState savedstate, ArkContextManager contextManager)
 {
     _context = context;
     _config  = config;
     _databaseContextFactory = databaseContextFactory;
     _savedstate             = savedstate;
     _contextManager         = contextManager;
 }
        public PlayerLastActiveService(ISavedState savedState, ArkContextManager contextManager)
        {
            _savedState     = savedState;
            _contextManager = contextManager;

            _queue = new ActionBlock <IArkUpdateableContext>(
                updateableContext =>
            {
                try
                {
                    if (updateableContext is ArkServerContext)
                    {
                        var serverContext = updateableContext as ArkServerContext;
                        foreach (var player in serverContext.Players)
                        {
                            var state = _savedState.PlayerLastActive.FirstOrDefault(x =>
                                                                                    x.ServerKey != null &&
                                                                                    serverContext.Config.Key.Equals(x.ServerKey) &&
                                                                                    x.SteamId != null &&
                                                                                    x.SteamId.Equals(player.SteamId, StringComparison.OrdinalIgnoreCase));
                            if (state == null)
                            {
                                state = new PlayerLastActiveSavedState
                                {
                                    ServerKey      = serverContext.Config.Key,
                                    SteamId        = player.SteamId,
                                    LastActiveTime = player.LastActiveTime
                                };

                                _savedState.PlayerLastActive.Add(state);
                            }
                            else if (player.LastActiveTime > state.LastActiveTime)
                            {
                                state.LastActiveTime = player.LastActiveTime;
                            }

                            state.Id            = player.Id;
                            state.TribeId       = player.TribeId;
                            state.Name          = player.Name;
                            state.CharacterName = player.CharacterName;
                        }

                        _savedState.Save();
                    }
                }
                catch (Exception ex)
                {
                }
            },
                new ExecutionDataflowBlockOptions {
                MaxDegreeOfParallelism = 1
            }
                );

            contextManager.GameDataUpdated += ContextManager_GameDataUpdated;
        }
        protected override IParcelable OnSaveInstanceState()
        {
            ISavedState ss = new ISavedState(base.OnSaveInstanceState(), this)
            {
                inChoiceMode = inChoiceMode,
                choiceState  = choiceState
            };

            return(ss);
        }
Beispiel #4
0
 public RconCommand(
     ILifetimeScope scope,
     IConfig config,
     IConstants constants,
     EfDatabaseContextFactory databaseContextFactory,
     ISavedState savedstate,
     IArkServerService arkServerService,
     ISavegameBackupService savegameBackupService,
     ArkContextManager contextManager,
     ScheduledTasksManager scheduledTasksManager)
 {
     _config         = config;
     _contextManager = contextManager;
 }
Beispiel #5
0
 public ArkServerContext(
     IConfig fullconfig,
     ServerConfigSection config,
     ArkClusterContext clusterContext,
     ISavedState savedState,
     ArkAnonymizeData anonymizeData,
     ILifetimeScope scope)
     : base(
         config?.SaveFilePath,
         clusterContext,
         loadOnlyPropertiesInDomain: true)
 {
     Config           = config;
     _clusterContext  = clusterContext;
     _scope           = scope;
     _saveFileWatcher = _scope.Resolve <IArkSaveFileWatcher>(new TypedParameter(typeof(ArkServerContext), this));
     _savedState      = savedState;
     _anonymizeData   = anonymizeData;
     Steam            = new SteamManager(config);
 }
Beispiel #6
0
 public ArkServerContext(
     IConfig fullconfig,
     ServerConfigSection config,
     ArkClusterContext clusterContext,
     ISavedState savedState,
     ArkAnonymizeData anonymizeData,
     ILifetimeScope scope)
     : base(
         config?.SaveFilePath,
         clusterContext,
         fullconfig.SavegameExtractionMaxDegreeOfParallelism,
         true)
 {
     Config           = config;
     _clusterContext  = clusterContext;
     _scope           = scope;
     _saveFileWatcher = _scope.Resolve <IArkSaveFileWatcher>(new TypedParameter(typeof(ArkServerContext), this));
     _savedState      = savedState;
     _anonymizeData   = anonymizeData;
     Steam            = new SteamManager(config);
 }
Beispiel #7
0
 public AdminCommand(
     ILifetimeScope scope,
     IArkContext context,
     IConfig config,
     IConstants constants,
     EfDatabaseContextFactory databaseContextFactory,
     ISavedState savedstate,
     IArkServerService arkServerService,
     ISavegameBackupService savegameBackupService,
     ArkContextManager contextManager,
     ScheduledTasksManager scheduledTasksManager)
 {
     _context   = context;
     _config    = config;
     _constants = constants;
     _databaseContextFactory = databaseContextFactory;
     _savedstate             = savedstate;
     _arkServerService       = arkServerService;
     _savegameBackupService  = savegameBackupService;
     _contextManager         = contextManager;
     _scheduledTasksManager  = scheduledTasksManager;
 }
        protected override void OnRestoreInstanceState(IParcelable state)
        {
            ISavedState ss = (ISavedState)state;

            base.OnRestoreInstanceState(ss.GetSuperState());

            if (ss.inChoiceMode)
            {
                IntoChoiceMode();

                int[] positions = ss.choiceState.GetCheckedItemPositions();
                foreach (int position in positions)
                {
                    choiceState.SetChecked(position, true);
                    if (choiceModeListener != null)
                    {
                        long id = adapter.GetItemId(position);
                        choiceModeListener.OnItemCheckedStateChanged(this, position, id, true);
                    }
                }

                UpdateOnScreenViews();
            }
        }
Beispiel #9
0
 public StructuresController(ISavedState savedState, ArkContextManager contextManager, IConfig config) : base(config)
 {
     _savedState     = savedState;
     _contextManager = contextManager;
 }
Beispiel #10
0
 public void AddSavedState(ISavedState state)
 {
     _savedStates.Add(state);
 }
Beispiel #11
0
 public void AddSavedState(ISavedState state)
 {
     _savedStates.Add(state);
 }