public static void ExportData(string userName) { JsonService jsonService = Service.Get <JsonService>(); string token = (!string.IsNullOrEmpty(userName)) ? RegistrationProfile.Id(userName) : Service.Get <OfflineDatabase>().AccessToken; OfflineDataExport offlineDataExport = default(OfflineDataExport); offlineDataExport.BreadCrumbs = OfflineDatabase.Read <BreadcrumbCollection>(token); offlineDataExport.ClaimableRewards = OfflineDatabase.Read <ClaimableRewardData>(token); offlineDataExport.ConsumableInventory = OfflineDatabase.Read <ConsumableInventory>(token); offlineDataExport.Equipment = OfflineDatabase.Read <CustomEquipmentCollection>(token); offlineDataExport.DailySpinData = OfflineDatabase.Read <DailySpinData>(token); offlineDataExport.IglooData = OfflineDatabase.Read <IglooEntity>(token); offlineDataExport.RoomRewards = OfflineDatabase.Read <InRoomRewards>(token); offlineDataExport.Assets = OfflineDatabase.Read <PlayerAssets>(token); offlineDataExport.Outfit = OfflineDatabase.Read <PlayerOutfitDetails>(token); offlineDataExport.Profile = OfflineDatabase.Read <Profile>(token); offlineDataExport.QuestStates = OfflineDatabase.Read <QuestStates>(token); offlineDataExport.RegistrationProfile = OfflineDatabase.Read <RegistrationProfile>(token); offlineDataExport.IglooLayouts = OfflineDatabase.Read <SceneLayoutEntity>(token); offlineDataExport.Tube = OfflineDatabase.Read <TubeData>(token); offlineDataExport.Tutorials = OfflineDatabase.Read <TutorialData>(token); OfflineDataExport objectToSerialize = offlineDataExport; objectToSerialize.UserName = objectToSerialize.RegistrationProfile.userName; TextEditor textEditor = new TextEditor(); textEditor.text = jsonService.Serialize(objectToSerialize); textEditor.SelectAll(); textEditor.Copy(); }
private void continueLoginWithOfflineDataCopy() { OfflineDatabase offlineDatabase = Service.Get <OfflineDatabase>(); string username = LocalUser.RegistrationProfile.Username; offlineDatabase.AccessToken = RegistrationProfile.Id(username); RegistrationProfile value = offlineDatabase.Read <RegistrationProfile>(); value.userName = username; value.displayName = LocalUser.RegistrationProfile.DisplayName; value.firstName = LocalUser.RegistrationProfile.FirstName; value.parentEmail = LocalUser.RegistrationProfile.ParentEmail; offlineDatabase.Write(value); eventDispatcher.DispatchEvent(new SessionEvents.SessionStartedEvent(accessToken, localPlayerSwid)); }
public void Save() { OfflineDatabase.Write(data, data.Id()); }
protected override void PerformOfflineAction(OfflineDatabase offlineDatabase, IOfflineDefinitionLoader offlineDefinitions) { ResponseBody = new LocalPlayerData(); ResponseBody.member = true; ResponseBody.membershipExpireDate = DateTime.UtcNow.AddMonths(1).GetTimeInMilliseconds(); ResponseBody.trialAvailable = false; ResponseBody.subscriptionPaymentPending = false; ResponseBody.id = new PlayerId { id = offlineDatabase.AccessToken, type = PlayerId.PlayerIdType.SWID }; ClubPenguin.Net.Offline.Profile profile = offlineDatabase.Read <ClubPenguin.Net.Offline.Profile>(); ResponseBody.profile = new ClubPenguin.Net.Domain.Profile { colour = profile.Colour, daysOld = profile.DaysOld }; ResponseBody.outfit = offlineDatabase.Read <ClubPenguin.Net.Offline.PlayerOutfitDetails>().Parts; ResponseBody.mascotXP = offlineDatabase.Read <ClubPenguin.Net.Offline.PlayerAssets>().Assets.mascotXP; ResponseBody.minigameProgress = new List <MinigameProgress>(); ResponseBody.quests = SetProgressOperation.GetQuestStateCollection(offlineDatabase.Read <QuestStates>(), offlineDefinitions, includeComplete: true); ResponseBody.tutorialData = new List <sbyte>(offlineDatabase.Read <TutorialData>().Bytes); List <Breadcrumb> list = new List <Breadcrumb>(); foreach (Breadcrumb breadcrumb in offlineDatabase.Read <BreadcrumbCollection>().breadcrumbs) { list.Add(new Breadcrumb { id = breadcrumb.id, breadcrumbType = breadcrumb.breadcrumbType }); } ResponseBody.breadcrumbs = new BreadcrumbsResponse { breadcrumbs = list }; RegistrationProfile registrationProfile = offlineDatabase.Read <RegistrationProfile>(); ResponseBody.name = registrationProfile.displayName; if (string.IsNullOrEmpty(ResponseBody.name)) { ResponseBody.name = registrationProfile.userName; } ResponseBody.claimedRewardIds = offlineDatabase.Read <ClaimableRewardData>().ClimedRewards; ZoneId zoneId = new ZoneId(); zoneId.name = "DefaultIgloo"; zoneId.instanceId = registrationProfile.Id(); ZoneId zoneId2 = zoneId; IglooEntity iglooEntity = offlineDatabase.Read <IglooEntity>(); if (iglooEntity.Data.activeLayout != null) { string zoneId3 = iglooEntity.Data.activeLayout.zoneId; if (!string.IsNullOrEmpty(zoneId3)) { zoneId2.name = zoneId3; } } ResponseBody.zoneId = zoneId2; List <SavedIglooLayoutSummary> list2 = new List <SavedIglooLayoutSummary>(); foreach (SavedSceneLayout layout in offlineDatabase.Read <SceneLayoutEntity>().Layouts) { list2.Add(new SavedIglooLayoutSummary { createdDate = layout.createdDate.GetValueOrDefault(0L), lastUpdatedDate = layout.lastModifiedDate.GetValueOrDefault(0L), layoutId = layout.layoutId, lot = layout.zoneId, memberOnly = layout.memberOnly, name = layout.name }); } ResponseBody.iglooLayouts = new SavedIglooLayoutsSummary { activeLayoutId = iglooEntity.Data.activeLayoutId, activeLayoutServerChangeNotification = ActiveLayoutServerChangeNotification.NoServerChange, visibility = iglooEntity.Data.visibility.GetValueOrDefault(IglooVisibility.PRIVATE), layouts = list2 }; ClubPenguin.Net.Offline.DailySpinData dailySpinData = offlineDatabase.Read <ClubPenguin.Net.Offline.DailySpinData>(); ResponseBody.dailySpinData = new ClubPenguin.Net.Domain.DailySpinData { currentChestId = dailySpinData.CurrentChestId, numChestsReceivedOfCurrentChestId = dailySpinData.NumChestsReceivedOfCurrentChestId, numPunchesOnCurrentChest = dailySpinData.NumPunchesOnCurrentChest, timeOfLastSpinInMilliseconds = dailySpinData.TimeOfLastSpinInMilliseconds }; ClubPenguin.Net.Offline.SessionData sessionData = offlineDatabase.Read <ClubPenguin.Net.Offline.SessionData>(); if (sessionData.Data.sessionId != 0) { ResponseBody.onlineLocation = sessionData.CurrentRoom; } }