This repository was archived by the owner on Jun 17, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 11
Fix freeze upon opening Credits tab #32
Open
recreationx
wants to merge
2
commits into
FICTURE7:v0.1.x
Choose a base branch
from
recreationx:v0.1.x
base: v0.1.x
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| using System.IO; | ||
|
|
||
| namespace UberStrok.Core.Serialization.Views | ||
| { | ||
| public static class DecimalProxy | ||
| { | ||
| public static void Serialize(Stream bytes, decimal instance) | ||
| { | ||
| int[] bits = decimal.GetBits(instance); | ||
| Int32Proxy.Serialize(bytes, bits[0]); | ||
| Int32Proxy.Serialize(bytes, bits[1]); | ||
| Int32Proxy.Serialize(bytes, bits[2]); | ||
| Int32Proxy.Serialize(bytes, bits[3]); | ||
| } | ||
|
|
||
| public static decimal Deserialize(Stream bytes) | ||
| { | ||
| int[] bits = new int[] { | ||
| Int32Proxy.Deserialize(bytes), | ||
| Int32Proxy.Deserialize(bytes), | ||
| Int32Proxy.Deserialize(bytes), | ||
| Int32Proxy.Deserialize(bytes) | ||
| }; | ||
| return new decimal(bits); | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
166 changes: 166 additions & 0 deletions
166
src/UberStrok.Core.Serialization/Views/BundleViewProxy.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,166 @@ | ||
| using System.IO; | ||
| using UberStrok.Core.Common; | ||
| using UberStrok.Core.Views; | ||
|
|
||
| namespace UberStrok.Core.Serialization.Views | ||
| { | ||
| public static class BundleViewProxy | ||
| { | ||
| public static void Serialize(Stream stream, BundleView instance) | ||
| { | ||
| int num = 0; | ||
| using (MemoryStream memoryStream = new MemoryStream()) | ||
| { | ||
| if (instance.AndroidStoreUniqueId != null) | ||
| { | ||
| StringProxy.Serialize(memoryStream, instance.AndroidStoreUniqueId); | ||
| } | ||
| else | ||
| { | ||
| num |= 1; | ||
| } | ||
| Int32Proxy.Serialize(memoryStream, instance.ApplicationId); | ||
| if (instance.Availability != null) | ||
| { | ||
| ListProxy<ChannelType>.Serialize(memoryStream, instance.Availability, new ListProxy<ChannelType>.Serializer<ChannelType>(EnumProxy<ChannelType>.Serialize)); | ||
| } | ||
| else | ||
| { | ||
| num |= 2; | ||
| } | ||
| if (instance.BundleItemViews != null) | ||
| { | ||
| ListProxy<BundleItemView>.Serialize(memoryStream, instance.BundleItemViews, new ListProxy<BundleItemView>.Serializer<BundleItemView>(BundleItemViewProxy.Serialize)); | ||
| } | ||
| else | ||
| { | ||
| num |= 4; | ||
| } | ||
| EnumProxy<BundleCategoryType>.Serialize(memoryStream, instance.Category); | ||
| Int32Proxy.Serialize(memoryStream, instance.Credits); | ||
| if (instance.Description != null) | ||
| { | ||
| StringProxy.Serialize(memoryStream, instance.Description); | ||
| } | ||
| else | ||
| { | ||
| num |= 8; | ||
| } | ||
| if (instance.IconUrl != null) | ||
| { | ||
| StringProxy.Serialize(memoryStream, instance.IconUrl); | ||
| } | ||
| else | ||
| { | ||
| num |= 16; | ||
| } | ||
| Int32Proxy.Serialize(memoryStream, instance.Id); | ||
| if (instance.ImageUrl != null) | ||
| { | ||
| StringProxy.Serialize(memoryStream, instance.ImageUrl); | ||
| } | ||
| else | ||
| { | ||
| num |= 32; | ||
| } | ||
| if (instance.IosAppStoreUniqueId != null) | ||
| { | ||
| StringProxy.Serialize(memoryStream, instance.IosAppStoreUniqueId); | ||
| } | ||
| else | ||
| { | ||
| num |= 64; | ||
| } | ||
| BooleanProxy.Serialize(memoryStream, instance.IsDefault); | ||
| BooleanProxy.Serialize(memoryStream, instance.IsOnSale); | ||
| BooleanProxy.Serialize(memoryStream, instance.IsPromoted); | ||
| if (instance.MacAppStoreUniqueId != null) | ||
| { | ||
| StringProxy.Serialize(memoryStream, instance.MacAppStoreUniqueId); | ||
| } | ||
| else | ||
| { | ||
| num |= 128; | ||
| } | ||
| if (instance.Name != null) | ||
| { | ||
| StringProxy.Serialize(memoryStream, instance.Name); | ||
| } | ||
| else | ||
| { | ||
| num |= 256; | ||
| } | ||
| Int32Proxy.Serialize(memoryStream, instance.Points); | ||
| if (instance.PromotionTag != null) | ||
| { | ||
| StringProxy.Serialize(memoryStream, instance.PromotionTag); | ||
| } | ||
| else | ||
| { | ||
| num |= 512; | ||
| } | ||
| DecimalProxy.Serialize(memoryStream, instance.USDPrice); | ||
| DecimalProxy.Serialize(memoryStream, instance.USDPromoPrice); | ||
| Int32Proxy.Serialize(stream, ~num); | ||
| memoryStream.WriteTo(stream); | ||
| } | ||
| } | ||
|
|
||
| public static BundleView Deserialize(Stream bytes) | ||
| { | ||
| int num = Int32Proxy.Deserialize(bytes); | ||
| BundleView bundleView = new BundleView(); | ||
| if ((num & 1) != 0) | ||
| { | ||
| bundleView.AndroidStoreUniqueId = StringProxy.Deserialize(bytes); | ||
| } | ||
| bundleView.ApplicationId = Int32Proxy.Deserialize(bytes); | ||
| if ((num & 2) != 0) | ||
| { | ||
| bundleView.Availability = ListProxy<ChannelType>.Deserialize(bytes, new ListProxy<ChannelType>.Deserializer<ChannelType>(EnumProxy<ChannelType>.Deserialize)); | ||
| } | ||
| if ((num & 4) != 0) | ||
| { | ||
| bundleView.BundleItemViews = ListProxy<BundleItemView>.Deserialize(bytes, new ListProxy<BundleItemView>.Deserializer<BundleItemView>(BundleItemViewProxy.Deserialize)); | ||
| } | ||
| bundleView.Category = EnumProxy<BundleCategoryType>.Deserialize(bytes); | ||
| bundleView.Credits = Int32Proxy.Deserialize(bytes); | ||
| if ((num & 8) != 0) | ||
| { | ||
| bundleView.Description = StringProxy.Deserialize(bytes); | ||
| } | ||
| if ((num & 16) != 0) | ||
| { | ||
| bundleView.IconUrl = StringProxy.Deserialize(bytes); | ||
| } | ||
| bundleView.Id = Int32Proxy.Deserialize(bytes); | ||
| if ((num & 32) != 0) | ||
| { | ||
| bundleView.ImageUrl = StringProxy.Deserialize(bytes); | ||
| } | ||
| if ((num & 64) != 0) | ||
| { | ||
| bundleView.IosAppStoreUniqueId = StringProxy.Deserialize(bytes); | ||
| } | ||
| bundleView.IsDefault = BooleanProxy.Deserialize(bytes); | ||
| bundleView.IsOnSale = BooleanProxy.Deserialize(bytes); | ||
| bundleView.IsPromoted = BooleanProxy.Deserialize(bytes); | ||
| if ((num & 128) != 0) | ||
| { | ||
| bundleView.MacAppStoreUniqueId = StringProxy.Deserialize(bytes); | ||
| } | ||
| if ((num & 256) != 0) | ||
| { | ||
| bundleView.Name = StringProxy.Deserialize(bytes); | ||
| } | ||
| bundleView.Points = Int32Proxy.Deserialize(bytes); | ||
| if ((num & 512) != 0) | ||
| { | ||
| bundleView.PromotionTag = StringProxy.Deserialize(bytes); | ||
| } | ||
| bundleView.USDPrice = DecimalProxy.Deserialize(bytes); | ||
| bundleView.USDPromoPrice = DecimalProxy.Deserialize(bytes); | ||
| return bundleView; | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| using System; | ||
| using System.Collections.Generic; | ||
| using UberStrok.Core.Common; | ||
|
|
||
| namespace UberStrok.Core.Views | ||
| { | ||
| [Serializable] | ||
| public class BundleView | ||
| { | ||
| public int Id { get; set; } | ||
| public int ApplicationId { get; set; } | ||
| public string Name { get; set; } | ||
| public string ImageUrl { get; set; } | ||
| public string IconUrl { get; set; } | ||
| public string Description { get; set; } | ||
| public bool IsOnSale { get; set; } | ||
| public bool IsPromoted { get; set; } | ||
| public decimal USDPrice { get; set; } | ||
| public decimal USDPromoPrice { get; set; } | ||
| public int Credits { get; set; } | ||
| public int Points { get; set; } | ||
| public List<BundleItemView> BundleItemViews { get; set; } | ||
| public BundleCategoryType Category { get; set; } | ||
| public List<ChannelType> Availability { get; set; } | ||
| public string PromotionTag { get; set; } | ||
| public string MacAppStoreUniqueId { get; set; } | ||
| public string IosAppStoreUniqueId { get; set; } | ||
| public string AndroidStoreUniqueId { get; set; } | ||
| public bool IsDefault { get; set; } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -1,6 +1,7 @@ | ||||||
| using System; | ||||||
| using System.IO; | ||||||
| using UberStrok.Core.Views; | ||||||
| using System.Collections.Generic; | ||||||
|
|
||||||
| namespace UberStrok.WebServices | ||||||
| { | ||||||
|
|
@@ -22,10 +23,16 @@ public ItemManager(WebServiceContext ctx) | |||||
|
|
||||||
| private readonly UberStrikeItemShopClientView _items; | ||||||
| private readonly WebServiceContext _ctx; | ||||||
| private readonly List<BundleView> _bundles; | ||||||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is not initialized, should be an empty list
Suggested change
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do that somewhere in the constructor. |
||||||
|
|
||||||
| public UberStrikeItemShopClientView GetShop() | ||||||
| { | ||||||
| return _items; | ||||||
| } | ||||||
|
|
||||||
| public List<BundleView> GetBundles() | ||||||
| { | ||||||
| return _bundles; | ||||||
| } | ||||||
| } | ||||||
| } | ||||||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The base class should not contain any hardcoded logic, instead rely on the abstract method's implementation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BundleView does not contain definition for Serialize
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops, apologies that should be
BundleViewProxy.Serialize