public void Initialize(bool startUpdatesManager = true) { if (this._isInitialized) { return; } CacheManager.EnsureCacheFolderExists(); if (CacheManager.TryDeserialize((IBinarySerializable)this._globalState, this._appGlobalStateKey, CacheManager.DataType.StateData)) { AutorizationData autorizationData = new AutorizationData(); autorizationData.access_token = this._globalState.AccessToken ?? ""; autorizationData.secret = this._globalState.Secret ?? ""; autorizationData.user_id = this._globalState.LoggedInUserId; int num = startUpdatesManager ? 1 : 0; VKRequestsDispatcher.SetAuthorizationData(autorizationData, num != 0); } this._eventsTracker = StatsEventsTracker.Instance; this._eventsTracker.PendingEvents = EventsConverter.ConvertToPendingEvents(this.GlobalState.PendingStatisticsEvents); this._isInitialized = true; }
public void SaveState() { this.GlobalState.PendingStatisticsEvents = EventsConverter.ConvertFromPendingEvents(StatsEventsTracker.Instance.PendingEvents); CacheManager.TrySerialize((IBinarySerializable)this._globalState, this._appGlobalStateKey, false, CacheManager.DataType.StateData); }