Skip to content

Commit

Permalink
https://docs.microsoft.com/en-us/gaming/playfab/release-notes/#220214
Browse files Browse the repository at this point in the history
  • Loading branch information
PlayFabJenkinsBot committed Feb 15, 2022
2 parents 18b4d98 + 0df95be commit 9f678fe
Show file tree
Hide file tree
Showing 17 changed files with 1,161 additions and 181 deletions.
103 changes: 89 additions & 14 deletions PlayFabSDK/source/Json/SimpleJson.cs
Original file line number Diff line number Diff line change
Expand Up @@ -519,8 +519,46 @@ private enum TokenType : byte
}
private const int BUILDER_INIT = 2000;

private static readonly char[] EscapeTable;
private static readonly char[] EscapeCharacters = new char[] { '"', '\\', '\b', '\f', '\n', '\r', '\t' };
private const char EscapeCharacterRequiresSlashU = char.MaxValue;
private static readonly char[] EscapeTable = BuildEscapeTableArray();
private static readonly char[] EscapeCharacters = new char[]
{
'\u0000',
'\u0001',
'\u0002',
'\u0003',
'\u0004',
'\u0005',
'\u0006',
'\u0007',
'\b',
'\t',
'\n',
'\u000b',
'\f',
'\r',
'\u000e',
'\u000f',
'\u0010',
'\u0011',
'\u0012',
'\u0013',
'\u0014',
'\u0015',
'\u0016',
'\u0017',
'\u0018',
'\u0019',
'\u001a',
'\u001b',
'\u001c',
'\u001d',
'\u001e',
'\u001f',

'"', // 0x22
'\\', // 0x92
};
// private static readonly string EscapeCharactersString = new string(EscapeCharacters);
internal static readonly List<Type> NumberTypes = new List<Type> {
typeof(bool), typeof(byte), typeof(ushort), typeof(uint), typeof(ulong), typeof(sbyte), typeof(short), typeof(int), typeof(long), typeof(double), typeof(float), typeof(decimal)
Expand All @@ -532,16 +570,43 @@ private enum TokenType : byte
[ThreadStatic]
private static StringBuilder _parseStringBuilder;

static PlayFabSimpleJson()
{
EscapeTable = new char[93];
EscapeTable['"'] = '"';
EscapeTable['\\'] = '\\';
EscapeTable['\b'] = 'b';
EscapeTable['\f'] = 'f';
EscapeTable['\n'] = 'n';
EscapeTable['\r'] = 'r';
EscapeTable['\t'] = 't';
static char[] BuildEscapeTableArray()
{
// The escape table is a 1:1 translation table
// with \0 [default(char)] denoting a safe character.
var escapeTable = new char[93];

// See: https://datatracker.ietf.org/doc/html/rfc4627.html#section-2.5
// "All Unicode characters may be placed within the
// quotation marks except for the characters that must be escaped:
// quotation mark, reverse solidus, and the control characters (U+0000
// through U+001F)."
// Also of note:
// "The hexadecimal letters A though F can be upper or lowercase."
// We'll always use lowercase in SerializeString.

// First, populate control characters which will be fully escaped with "popular characters"
escapeTable['\b'] = 'b';
escapeTable['\t'] = 't';
escapeTable['\n'] = 'n';
escapeTable['\f'] = 'f';
escapeTable['\r'] = 'r';

// These are outside the 0x1F range, but are fully escaped
escapeTable['"'] = '"';
escapeTable['\\'] = '\\';

// Second, populate the remaining characters that will need be generically escaped using \uXXXX.
// Yes, including the null character \u0000
for (int x = '\x0000'; x <= '\x001f'; x++)
{
if (escapeTable[x] == default(char))
{
escapeTable[x] = EscapeCharacterRequiresSlashU;
}
}

return escapeTable;
}

/// <summary>
Expand Down Expand Up @@ -1153,8 +1218,18 @@ static bool SerializeString(string aString, StringBuilder builder)
safeCharacterCount = 0;
}

builder.Append('\\');
builder.Append(EscapeTable[c]);
if (EscapeTable[c] == EscapeCharacterRequiresSlashU)
{
builder.Append("\\u");
// This is probably a slow (relative) code path, but this case is also in theory rarely ever taken.
// Note: we always use lowercase here.
builder.AppendFormat(CultureInfo.InvariantCulture, "{0:x4}", (uint)c);
}
else
{
builder.Append('\\');
builder.Append(EscapeTable[c]);
}
}
}

Expand Down
85 changes: 65 additions & 20 deletions PlayFabSDK/source/PlayFabAdminModels.cs
Original file line number Diff line number Diff line change
Expand Up @@ -781,6 +781,14 @@ public class CheckLimitedEditionItemAvailabilityResult : PlayFabResultCommon

}

public enum ChurnRiskLevel
{
NoData,
LowRisk,
MediumRisk,
HighRisk
}

public class CloudScriptFile
{
/// <summary>
Expand Down Expand Up @@ -4778,6 +4786,48 @@ public class PermissionStatement

}

public class PlayerChurnPredictionSegmentFilter
{
/// <summary>
/// Comparison
/// </summary>
public SegmentFilterComparison? Comparison ;

/// <summary>
/// RiskLevel
/// </summary>
public ChurnRiskLevel? RiskLevel ;

}

public class PlayerChurnPredictionTimeSegmentFilter
{
/// <summary>
/// Comparison
/// </summary>
public SegmentFilterComparison? Comparison ;

/// <summary>
/// DurationInDays
/// </summary>
public double DurationInDays ;

}

public class PlayerChurnPreviousPredictionSegmentFilter
{
/// <summary>
/// Comparison
/// </summary>
public SegmentFilterComparison? Comparison ;

/// <summary>
/// RiskLevel
/// </summary>
public ChurnRiskLevel? RiskLevel ;

}

public class PlayerLinkedAccount
{
/// <summary>
Expand Down Expand Up @@ -5837,6 +5887,21 @@ public class SegmentAndDefinition
/// </summary>
public LocationSegmentFilter LocationFilter ;

/// <summary>
/// Filter property for current player churn value.
/// </summary>
public PlayerChurnPredictionSegmentFilter PlayerChurnPredictionFilter ;

/// <summary>
/// Filter property for player churn timespan.
/// </summary>
public PlayerChurnPredictionTimeSegmentFilter PlayerChurnPredictionTimeFilter ;

/// <summary>
/// Filter property for previous player churn value.
/// </summary>
public PlayerChurnPreviousPredictionSegmentFilter PlayerChurnPreviousPredictionFilter ;

/// <summary>
/// Filter property for push notification.
/// </summary>
Expand Down Expand Up @@ -6333,11 +6398,6 @@ public enum SegmentLoginIdentityProvider

public class SegmentModel
{
/// <summary>
/// ResourceId of Segment resource
/// </summary>
public string AzureResourceId ;

/// <summary>
/// Segment description.
/// </summary>
Expand Down Expand Up @@ -6610,11 +6670,6 @@ public class SetTitleDataAndOverridesResult : PlayFabResultCommon
/// </summary>
public class SetTitleDataRequest : PlayFabRequestCommon
{
/// <summary>
/// Id of azure resource
/// </summary>
public string AzureResourceId ;

/// <summary>
/// The optional custom tags associated with the request (e.g. build number, external trace identifiers, etc.).
/// </summary>
Expand All @@ -6626,11 +6681,6 @@ public class SetTitleDataRequest : PlayFabRequestCommon
/// </summary>
public string Key ;

/// <summary>
/// System Data of the Azure Resource
/// </summary>
public AzureResourceSystemData SystemData ;

/// <summary>
/// Unique identifier for the title, found in the Settings > Game Properties section of the PlayFab developer site when a
/// title has been selected.
Expand All @@ -6646,11 +6696,6 @@ public class SetTitleDataRequest : PlayFabRequestCommon

public class SetTitleDataResult : PlayFabResultCommon
{
/// <summary>
/// Id of azure resource
/// </summary>
public string AzureResourceId ;

}

/// <summary>
Expand Down
35 changes: 0 additions & 35 deletions PlayFabSDK/source/PlayFabCloudScriptModels.cs
Original file line number Diff line number Diff line change
Expand Up @@ -619,11 +619,6 @@ public class GetFunctionResult : PlayFabResultCommon
/// </summary>
public string QueueName ;

/// <summary>
/// System Data of the Azure Resource
/// </summary>
public AzureResourceSystemData SystemData ;

/// <summary>
/// The trigger type for the function.
/// </summary>
Expand All @@ -643,11 +638,6 @@ public class HttpFunctionModel
/// </summary>
public string FunctionUrl ;

/// <summary>
/// The System data of the Azure Resource
/// </summary>
public AzureResourceSystemData SystemData ;

}

public class LinkedPlatformAccountModel
Expand Down Expand Up @@ -1106,20 +1096,10 @@ public class QueuedFunctionModel
/// </summary>
public string QueueName ;

/// <summary>
/// The System data of the Azure Resource
/// </summary>
public AzureResourceSystemData SystemData ;

}

public class RegisterHttpFunctionRequest : PlayFabRequestCommon
{
/// <summary>
/// The Id of the Azure Resource
/// </summary>
public string AzureResourceId ;

/// <summary>
/// The optional custom tags associated with the request (e.g. build number, external trace identifiers, etc.).
/// </summary>
Expand All @@ -1135,11 +1115,6 @@ public class RegisterHttpFunctionRequest : PlayFabRequestCommon
/// </summary>
public string FunctionUrl ;

/// <summary>
/// System Data of the Azure Resource
/// </summary>
public AzureResourceSystemData SystemData ;

/// <summary>
/// The Id of the parent Title
/// </summary>
Expand All @@ -1153,11 +1128,6 @@ public class RegisterHttpFunctionRequest : PlayFabRequestCommon
/// </summary>
public class RegisterQueuedFunctionRequest : PlayFabRequestCommon
{
/// <summary>
/// The Id of the Azure Resource
/// </summary>
public string AzureResourceId ;

/// <summary>
/// A connection string for the storage account that hosts the queue for the Azure Function.
/// </summary>
Expand All @@ -1178,11 +1148,6 @@ public class RegisterQueuedFunctionRequest : PlayFabRequestCommon
/// </summary>
public string QueueName ;

/// <summary>
/// System Data of the Azure Resource
/// </summary>
public AzureResourceSystemData SystemData ;

/// <summary>
/// The Id of the parent Title
/// </summary>
Expand Down
6 changes: 6 additions & 0 deletions PlayFabSDK/source/PlayFabMultiplayerModels.cs
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,11 @@ public class BuildRegion
/// </summary>
public DynamicStandbySettings DynamicStandbySettings ;

/// <summary>
/// Whether the game assets provided for the build have been replicated to this region.
/// </summary>
public bool IsAssetReplicationComplete ;

/// <summary>
/// The maximum number of multiplayer servers for the region.
/// </summary>
Expand Down Expand Up @@ -2012,6 +2017,7 @@ public class GetBuildResponse : PlayFabResultCommon
/// When true, assets will be downloaded and uncompressed in memory, without the compressedversion being written first to
/// disc.
/// </summary>
[Obsolete("No longer available", false)]
public bool? UseStreamingForAssetDownloads ;

/// <summary>
Expand Down
4 changes: 2 additions & 2 deletions PlayFabSDK/source/PlayFabSDK.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<FileAlignment>512</FileAlignment>

<PackageId>PlayFabAllSDK</PackageId>
<Version>1.109.220131</Version>
<Version>1.110.220214</Version>
<Title>PlayFab CSharp Sdk</Title>
<Authors>PlayFab Inc.</Authors>
<Owners>PlayFab Inc.</Owners>
Expand All @@ -21,7 +21,7 @@
<Product>PlayFabSDK</Product>
<Copyright>Copyright 2022</Copyright>
<PackageTags>PlayFab, Baas, Paas, JSON, REST, HTTP, SSL, API, cloud, liveops, game, gamedev, native</PackageTags>
<PackageReleaseNotes>https://docs.microsoft.com/gaming/playfab/release-notes#220131</PackageReleaseNotes>
<PackageReleaseNotes>https://docs.microsoft.com/gaming/playfab/release-notes#220214</PackageReleaseNotes>
<NeutralLanguage>en</NeutralLanguage>
<AssemblyVersion>1</AssemblyVersion>
<FileVersion>1</FileVersion>
Expand Down
Loading

0 comments on commit 9f678fe

Please sign in to comment.