/// <summary>
 /// Initialises a new instance from the given error code.
 /// </summary>
 ///
 /// <param name="errorCode">The error code.</param>
 public GetScoresAroundPlayerError(Error errorCode)
 {
     ErrorCode        = errorCode;
     ErrorData        = MultiTypeValue.Null;
     ErrorDescription = GetErrorDescription(ErrorCode);
 }
Пример #2
0
 /// <summary>
 /// Initialises a new instance from the given error code.
 /// </summary>
 ///
 /// <param name="errorCode">The error code.</param>
 public AddScoreError(Error errorCode)
 {
     ErrorCode        = errorCode;
     ErrorData        = MultiTypeValue.Null;
     ErrorDescription = GetErrorDescription(ErrorCode);
 }
Пример #3
0
        /// <summary>
        /// Initialises a new instance from the given Json dictionary.
        /// </summary>
        ///
        /// <param name="jsonDictionary">The dictionary containing the Json data.</param>
        public CollectionDataObject(IDictionary <string, object> jsonDictionary)
        {
            ReleaseAssert.IsNotNull(jsonDictionary, "JSON dictionary cannot be null.");
            ReleaseAssert.IsTrue(jsonDictionary.ContainsKey("ObjectID"), "Json is missing required field 'ObjectID'");
            ReleaseAssert.IsTrue(jsonDictionary.ContainsKey("CreatedBy"), "Json is missing required field 'CreatedBy'");
            ReleaseAssert.IsTrue(jsonDictionary.ContainsKey("DateCreated"), "Json is missing required field 'DateCreated'");
            ReleaseAssert.IsTrue(jsonDictionary.ContainsKey("Value"), "Json is missing required field 'Value'");

            foreach (KeyValuePair <string, object> entry in jsonDictionary)
            {
                // Object Id
                if (entry.Key == "ObjectID")
                {
                    ReleaseAssert.IsTrue(entry.Value is string, "Invalid serialised type.");
                    ObjectId = (string)entry.Value;
                }

                // Created By
                else if (entry.Key == "CreatedBy")
                {
                    ReleaseAssert.IsTrue(entry.Value is IDictionary <string, object>, "Invalid serialised type.");
                    CreatedBy = new Player((IDictionary <string, object>)entry.Value);
                }

                // Date Created
                else if (entry.Key == "DateCreated")
                {
                    ReleaseAssert.IsTrue(entry.Value is string, "Invalid serialised type.");
                    DateCreated = JsonSerialisation.DeserialiseDate((string)entry.Value);
                }

                // Modified By
                else if (entry.Key == "ModifiedBy")
                {
                    if (entry.Value != null)
                    {
                        ReleaseAssert.IsTrue(entry.Value is IDictionary <string, object>, "Invalid serialised type.");
                        ModifiedBy = new Player((IDictionary <string, object>)entry.Value);
                    }
                }

                // Date Modified
                else if (entry.Key == "DateModified")
                {
                    if (entry.Value != null)
                    {
                        ReleaseAssert.IsTrue(entry.Value is string, "Invalid serialised type.");
                        DateModified = JsonSerialisation.DeserialiseDate((string)entry.Value);
                    }
                }

                // Value
                else if (entry.Key == "Value")
                {
                    ReleaseAssert.IsTrue(entry.Value is object, "Invalid serialised type.");
                    Value = new MultiTypeValue((object)entry.Value);
                }

                // Write Lock
                else if (entry.Key == "WriteLock")
                {
                    if (entry.Value != null)
                    {
                        ReleaseAssert.IsTrue(entry.Value is string, "Invalid serialised type.");
                        WriteLock = (string)entry.Value;
                    }
                }

                // An error has occurred.
                else
                {
#if DEBUG
                    throw new ArgumentException("Input Json contains an invalid field.");
#endif
                }
            }
        }
 /// <summary>
 /// Initialises a new instance from the given error code.
 /// </summary>
 ///
 /// <param name="errorCode">The error code.</param>
 public AddCollectionObjectError(Error errorCode)
 {
     ErrorCode        = errorCode;
     ErrorData        = MultiTypeValue.Null;
     ErrorDescription = GetErrorDescription(ErrorCode);
 }
Пример #5
0
        /// <summary>
        /// Initialises a new instance from the given Json dictionary.
        /// </summary>
        ///
        /// <param name="jsonDictionary">The dictionary containing the Json data.</param>
        public FacebookPlayerData(IDictionary <string, object> jsonDictionary)
        {
            ReleaseAssert.IsNotNull(jsonDictionary, "JSON dictionary cannot be null.");
            ReleaseAssert.IsTrue(jsonDictionary.ContainsKey("ChilliConnectID"), "Json is missing required field 'ChilliConnectID'");
            ReleaseAssert.IsTrue(jsonDictionary.ContainsKey("Key"), "Json is missing required field 'Key'");
            ReleaseAssert.IsTrue(jsonDictionary.ContainsKey("Value"), "Json is missing required field 'Value'");
            ReleaseAssert.IsTrue(jsonDictionary.ContainsKey("FacebookName"), "Json is missing required field 'FacebookName'");
            ReleaseAssert.IsTrue(jsonDictionary.ContainsKey("DateCreated"), "Json is missing required field 'DateCreated'");
            ReleaseAssert.IsTrue(jsonDictionary.ContainsKey("DateModified"), "Json is missing required field 'DateModified'");

            foreach (KeyValuePair <string, object> entry in jsonDictionary)
            {
                // Chilli Connect Id
                if (entry.Key == "ChilliConnectID")
                {
                    ReleaseAssert.IsTrue(entry.Value is string, "Invalid serialised type.");
                    ChilliConnectId = (string)entry.Value;
                }

                // Key
                else if (entry.Key == "Key")
                {
                    ReleaseAssert.IsTrue(entry.Value is string, "Invalid serialised type.");
                    Key = (string)entry.Value;
                }

                // Value
                else if (entry.Key == "Value")
                {
                    ReleaseAssert.IsTrue(entry.Value is object, "Invalid serialised type.");
                    Value = new MultiTypeValue((object)entry.Value);
                }

                // Has Attachment
                else if (entry.Key == "HasAttachment")
                {
                    if (entry.Value != null)
                    {
                        ReleaseAssert.IsTrue(entry.Value is bool, "Invalid serialised type.");
                        HasAttachment = (bool)entry.Value;
                    }
                }

                // User Name
                else if (entry.Key == "UserName")
                {
                    if (entry.Value != null)
                    {
                        ReleaseAssert.IsTrue(entry.Value is string, "Invalid serialised type.");
                        UserName = (string)entry.Value;
                    }
                }

                // Display Name
                else if (entry.Key == "DisplayName")
                {
                    if (entry.Value != null)
                    {
                        ReleaseAssert.IsTrue(entry.Value is string, "Invalid serialised type.");
                        DisplayName = (string)entry.Value;
                    }
                }

                // Facebook Name
                else if (entry.Key == "FacebookName")
                {
                    ReleaseAssert.IsTrue(entry.Value is string, "Invalid serialised type.");
                    FacebookName = (string)entry.Value;
                }

                // Date Created
                else if (entry.Key == "DateCreated")
                {
                    ReleaseAssert.IsTrue(entry.Value is string, "Invalid serialised type.");
                    DateCreated = JsonSerialisation.DeserialiseDate((string)entry.Value);
                }

                // Date Modified
                else if (entry.Key == "DateModified")
                {
                    ReleaseAssert.IsTrue(entry.Value is string, "Invalid serialised type.");
                    DateModified = JsonSerialisation.DeserialiseDate((string)entry.Value);
                }
            }
        }
 /// <summary>
 /// Initialises a new instance from the given error code.
 /// </summary>
 ///
 /// <param name="errorCode">The error code.</param>
 public LookupFacebookPlayersError(Error errorCode)
 {
     ErrorCode        = errorCode;
     ErrorData        = MultiTypeValue.Null;
     ErrorDescription = GetErrorDescription(ErrorCode);
 }
 /// <summary>
 /// Initialises a new instance from the given error code.
 /// </summary>
 ///
 /// <param name="errorCode">The error code.</param>
 public GetDlcUsingTagsError(Error errorCode)
 {
     ErrorCode        = errorCode;
     ErrorData        = MultiTypeValue.Null;
     ErrorDescription = GetErrorDescription(ErrorCode);
 }
 /// <summary>
 /// Initialises a new instance from the given error code.
 /// </summary>
 ///
 /// <param name="errorCode">The error code.</param>
 public GetInventoryForItemIdsError(Error errorCode)
 {
     ErrorCode        = errorCode;
     ErrorData        = MultiTypeValue.Null;
     ErrorDescription = GetErrorDescription(ErrorCode);
 }
Пример #9
0
 /// <summary>
 /// Initialises a new instance from the given error code.
 /// </summary>
 ///
 /// <param name="errorCode">The error code.</param>
 public GetRealMoneyPurchaseDefinitionsError(Error errorCode)
 {
     ErrorCode        = errorCode;
     ErrorData        = MultiTypeValue.Null;
     ErrorDescription = GetErrorDescription(ErrorCode);
 }
 /// <summary>
 /// Initialises a new instance from the given error code.
 /// </summary>
 ///
 /// <param name="errorCode">The error code.</param>
 public GetPlayerPropertiesError(Error errorCode)
 {
     ErrorCode        = errorCode;
     ErrorData        = MultiTypeValue.Null;
     ErrorDescription = GetErrorDescription(ErrorCode);
 }
Пример #11
0
 /// <summary>
 /// Initialises a new instance from the given error code.
 /// </summary>
 ///
 /// <param name="errorCode">The error code.</param>
 public MakeVirtualPurchaseError(Error errorCode)
 {
     ErrorCode        = errorCode;
     ErrorData        = MultiTypeValue.Null;
     ErrorDescription = GetErrorDescription(ErrorCode);
 }
Пример #12
0
        /// <summary>
        /// Initialises a new instance from the given Json dictionary.
        /// </summary>
        ///
        /// <param name="jsonDictionary">The dictionary containing the Json data.</param>
        public MatchTurn(IDictionary <string, object> jsonDictionary)
        {
            ReleaseAssert.IsNotNull(jsonDictionary, "JSON dictionary cannot be null.");
            ReleaseAssert.IsTrue(jsonDictionary.ContainsKey("TurnNumber"), "Json is missing required field 'TurnNumber'");
            ReleaseAssert.IsTrue(jsonDictionary.ContainsKey("State"), "Json is missing required field 'State'");
            ReleaseAssert.IsTrue(jsonDictionary.ContainsKey("DateStarted"), "Json is missing required field 'DateStarted'");

            foreach (KeyValuePair <string, object> entry in jsonDictionary)
            {
                // Turn Number
                if (entry.Key == "TurnNumber")
                {
                    ReleaseAssert.IsTrue(entry.Value is long, "Invalid serialised type.");
                    TurnNumber = (int)(long)entry.Value;
                }

                // State
                else if (entry.Key == "State")
                {
                    ReleaseAssert.IsTrue(entry.Value is string, "Invalid serialised type.");
                    State = (string)entry.Value;
                }

                // Players Waiting For
                else if (entry.Key == "PlayersWaitingFor")
                {
                    if (entry.Value != null)
                    {
                        ReleaseAssert.IsTrue(entry.Value is IList <object>, "Invalid serialised type.");
                        PlayersWaitingFor = JsonSerialisation.DeserialiseList((IList <object>)entry.Value, (object element) =>
                        {
                            ReleaseAssert.IsTrue(element is IDictionary <string, object>, "Invalid element type.");
                            return(new Player((IDictionary <string, object>)element));
                        });
                    }
                }

                // Player Turns
                else if (entry.Key == "PlayerTurns")
                {
                    if (entry.Value != null)
                    {
                        ReleaseAssert.IsTrue(entry.Value is IList <object>, "Invalid serialised type.");
                        PlayerTurns = JsonSerialisation.DeserialiseList((IList <object>)entry.Value, (object element) =>
                        {
                            ReleaseAssert.IsTrue(element is IDictionary <string, object>, "Invalid element type.");
                            return(new PlayerTurn((IDictionary <string, object>)element));
                        });
                    }
                }

                // Pre State Data
                else if (entry.Key == "PreStateData")
                {
                    if (entry.Value != null)
                    {
                        ReleaseAssert.IsTrue(entry.Value is object, "Invalid serialised type.");
                        PreStateData = new MultiTypeValue((object)entry.Value);
                    }
                }

                // Post State Data
                else if (entry.Key == "PostStateData")
                {
                    if (entry.Value != null)
                    {
                        ReleaseAssert.IsTrue(entry.Value is object, "Invalid serialised type.");
                        PostStateData = new MultiTypeValue((object)entry.Value);
                    }
                }

                // Date Started
                else if (entry.Key == "DateStarted")
                {
                    ReleaseAssert.IsTrue(entry.Value is string, "Invalid serialised type.");
                    DateStarted = JsonSerialisation.DeserialiseDate((string)entry.Value);
                }

                // Date Completed
                else if (entry.Key == "DateCompleted")
                {
                    if (entry.Value != null)
                    {
                        ReleaseAssert.IsTrue(entry.Value is string, "Invalid serialised type.");
                        DateCompleted = JsonSerialisation.DeserialiseDate((string)entry.Value);
                    }
                }
            }
        }
Пример #13
0
        /// <summary>
        /// Initialises a new instance from the given Json dictionary.
        /// </summary>
        ///
        /// <param name="jsonDictionary">The dictionary containing the Json data.</param>
        public PlayerData(IDictionary <string, object> jsonDictionary)
        {
            ReleaseAssert.IsNotNull(jsonDictionary, "JSON dictionary cannot be null.");
            ReleaseAssert.IsTrue(jsonDictionary.ContainsKey("Key"), "Json is missing required field 'Key'");
            ReleaseAssert.IsTrue(jsonDictionary.ContainsKey("DateCreated"), "Json is missing required field 'DateCreated'");
            ReleaseAssert.IsTrue(jsonDictionary.ContainsKey("DateModified"), "Json is missing required field 'DateModified'");

            foreach (KeyValuePair <string, object> entry in jsonDictionary)
            {
                // Key
                if (entry.Key == "Key")
                {
                    ReleaseAssert.IsTrue(entry.Value is string, "Invalid serialised type.");
                    Key = (string)entry.Value;
                }

                // Value
                else if (entry.Key == "Value")
                {
                    if (entry.Value != null)
                    {
                        ReleaseAssert.IsTrue(entry.Value is object, "Invalid serialised type.");
                        Value = new MultiTypeValue((object)entry.Value);
                    }
                }

                // Has Attachment
                else if (entry.Key == "HasAttachment")
                {
                    if (entry.Value != null)
                    {
                        ReleaseAssert.IsTrue(entry.Value is bool, "Invalid serialised type.");
                        HasAttachment = (bool)entry.Value;
                    }
                }

                // Write Lock
                else if (entry.Key == "WriteLock")
                {
                    if (entry.Value != null)
                    {
                        ReleaseAssert.IsTrue(entry.Value is string, "Invalid serialised type.");
                        WriteLock = (string)entry.Value;
                    }
                }

                // Date Created
                else if (entry.Key == "DateCreated")
                {
                    ReleaseAssert.IsTrue(entry.Value is string, "Invalid serialised type.");
                    DateCreated = JsonSerialisation.DeserialiseDate((string)entry.Value);
                }

                // Date Modified
                else if (entry.Key == "DateModified")
                {
                    ReleaseAssert.IsTrue(entry.Value is string, "Invalid serialised type.");
                    DateModified = JsonSerialisation.DeserialiseDate((string)entry.Value);
                }
            }
        }
 /// <summary>
 /// Initialises a new instance from the given error code.
 /// </summary>
 ///
 /// <param name="errorCode">The error code.</param>
 public DeletePlayerDataError(Error errorCode)
 {
     ErrorCode        = errorCode;
     ErrorData        = MultiTypeValue.Null;
     ErrorDescription = GetErrorDescription(ErrorCode);
 }
Пример #15
0
        /// <summary>
        /// Initialises a new instance from the given Json dictionary.
        /// </summary>
        ///
        /// <param name="jsonDictionary">The dictionary containing the Json data.</param>
        public FacebookScore(IDictionary <string, object> jsonDictionary)
        {
            ReleaseAssert.IsNotNull(jsonDictionary, "JSON dictionary cannot be null.");
            ReleaseAssert.IsTrue(jsonDictionary.ContainsKey("ChilliConnectID"), "Json is missing required field 'ChilliConnectID'");
            ReleaseAssert.IsTrue(jsonDictionary.ContainsKey("FacebookName"), "Json is missing required field 'FacebookName'");
            ReleaseAssert.IsTrue(jsonDictionary.ContainsKey("Date"), "Json is missing required field 'Date'");
            ReleaseAssert.IsTrue(jsonDictionary.ContainsKey("Score"), "Json is missing required field 'Score'");
            ReleaseAssert.IsTrue(jsonDictionary.ContainsKey("GlobalRank"), "Json is missing required field 'GlobalRank'");
            ReleaseAssert.IsTrue(jsonDictionary.ContainsKey("GlobalTotal"), "Json is missing required field 'GlobalTotal'");
            ReleaseAssert.IsTrue(jsonDictionary.ContainsKey("LocalRank"), "Json is missing required field 'LocalRank'");

            foreach (KeyValuePair <string, object> entry in jsonDictionary)
            {
                // Chilli Connect Id
                if (entry.Key == "ChilliConnectID")
                {
                    ReleaseAssert.IsTrue(entry.Value is string, "Invalid serialised type.");
                    ChilliConnectId = (string)entry.Value;
                }

                // User Name
                else if (entry.Key == "UserName")
                {
                    if (entry.Value != null)
                    {
                        ReleaseAssert.IsTrue(entry.Value is string, "Invalid serialised type.");
                        UserName = (string)entry.Value;
                    }
                }

                // Display Name
                else if (entry.Key == "DisplayName")
                {
                    if (entry.Value != null)
                    {
                        ReleaseAssert.IsTrue(entry.Value is string, "Invalid serialised type.");
                        DisplayName = (string)entry.Value;
                    }
                }

                // Facebook Name
                else if (entry.Key == "FacebookName")
                {
                    ReleaseAssert.IsTrue(entry.Value is string, "Invalid serialised type.");
                    FacebookName = (string)entry.Value;
                }

                // Date
                else if (entry.Key == "Date")
                {
                    ReleaseAssert.IsTrue(entry.Value is string, "Invalid serialised type.");
                    Date = JsonSerialisation.DeserialiseDate((string)entry.Value);
                }

                // Data
                else if (entry.Key == "Data")
                {
                    if (entry.Value != null)
                    {
                        ReleaseAssert.IsTrue(entry.Value is object, "Invalid serialised type.");
                        Data = new MultiTypeValue((object)entry.Value);
                    }
                }

                // Score
                else if (entry.Key == "Score")
                {
                    ReleaseAssert.IsTrue(entry.Value is long, "Invalid serialised type.");
                    Score = (int)(long)entry.Value;
                }

                // Global Rank
                else if (entry.Key == "GlobalRank")
                {
                    ReleaseAssert.IsTrue(entry.Value is long, "Invalid serialised type.");
                    GlobalRank = (int)(long)entry.Value;
                }

                // Global Total
                else if (entry.Key == "GlobalTotal")
                {
                    ReleaseAssert.IsTrue(entry.Value is long, "Invalid serialised type.");
                    GlobalTotal = (int)(long)entry.Value;
                }

                // Local Rank
                else if (entry.Key == "LocalRank")
                {
                    ReleaseAssert.IsTrue(entry.Value is long, "Invalid serialised type.");
                    LocalRank = (int)(long)entry.Value;
                }

                // An error has occurred.
                else
                {
#if DEBUG
                    throw new ArgumentException("Input Json contains an invalid field.");
#endif
                }
            }
        }
Пример #16
0
 /// <summary>
 /// Initialises a new instance from the given error code.
 /// </summary>
 ///
 /// <param name="errorCode">The error code.</param>
 public RedeemGoogleIapError(Error errorCode)
 {
     ErrorCode        = errorCode;
     ErrorData        = MultiTypeValue.Null;
     ErrorDescription = GetErrorDescription(ErrorCode);
 }
 /// <summary>
 /// Initialises a new instance from the given error code.
 /// </summary>
 ///
 /// <param name="errorCode">The error code.</param>
 public ValidateAppleIapError(Error errorCode)
 {
     ErrorCode        = errorCode;
     ErrorData        = MultiTypeValue.Null;
     ErrorDescription = GetErrorDescription(ErrorCode);
 }
Пример #18
0
 /// <summary>
 /// Initialises a new instance from the given error code.
 /// </summary>
 ///
 /// <param name="errorCode">The error code.</param>
 public UnlinkGameCenterAccountError(Error errorCode)
 {
     ErrorCode        = errorCode;
     ErrorData        = MultiTypeValue.Null;
     ErrorDescription = GetErrorDescription(ErrorCode);
 }
 /// <summary>
 /// Initialises a new instance from the given error code.
 /// </summary>
 ///
 /// <param name="errorCode">The error code.</param>
 public GetMatchTypeDefinitionsError(Error errorCode)
 {
     ErrorCode        = errorCode;
     ErrorData        = MultiTypeValue.Null;
     ErrorDescription = GetErrorDescription(ErrorCode);
 }
Пример #20
0
 /// <summary>
 /// Initialises a new instance from the given error code.
 /// </summary>
 ///
 /// <param name="errorCode">The error code.</param>
 public AddInventoryItemError(Error errorCode)
 {
     ErrorCode        = errorCode;
     ErrorData        = MultiTypeValue.Null;
     ErrorDescription = GetErrorDescription(ErrorCode);
 }
 /// <summary>
 /// Initialises a new instance from the given error code.
 /// </summary>
 ///
 /// <param name="errorCode">The error code.</param>
 public AddCurrencyBalanceError(Error errorCode)
 {
     ErrorCode        = errorCode;
     ErrorData        = MultiTypeValue.Null;
     ErrorDescription = GetErrorDescription(ErrorCode);
 }
Пример #22
0
 /// <summary>
 /// Initialises a new instance from the given error code.
 /// </summary>
 ///
 /// <param name="errorCode">The error code.</param>
 public UpdateMatchError(Error errorCode)
 {
     ErrorCode        = errorCode;
     ErrorData        = MultiTypeValue.Null;
     ErrorDescription = GetErrorDescription(ErrorCode);
 }
Пример #23
0
 /// <summary>
 /// Initialises a new instance from the given error code.
 /// </summary>
 ///
 /// <param name="errorCode">The error code.</param>
 public GetActiveTestError(Error errorCode)
 {
     ErrorCode        = errorCode;
     ErrorData        = MultiTypeValue.Null;
     ErrorDescription = GetErrorDescription(ErrorCode);
 }
Пример #24
0
 /// <summary>
 /// Initialises a new instance from the given error code.
 /// </summary>
 ///
 /// <param name="errorCode">The error code.</param>
 public LinkTwitchAccountError(Error errorCode)
 {
     ErrorCode        = errorCode;
     ErrorData        = MultiTypeValue.Null;
     ErrorDescription = GetErrorDescription(ErrorCode);
 }
 /// <summary>
 /// Initialises a new instance from the given error code.
 /// </summary>
 ///
 /// <param name="errorCode">The error code.</param>
 public LogInUsingFacebookError(Error errorCode)
 {
     ErrorCode        = errorCode;
     ErrorData        = MultiTypeValue.Null;
     ErrorDescription = GetErrorDescription(ErrorCode);
 }
Пример #26
0
        /// <summary>
        /// Initialises a new instance from the given Json dictionary.
        /// </summary>
        ///
        /// <param name="jsonDictionary">The dictionary containing the Json data.</param>
        public GlobalScore(IDictionary <string, object> jsonDictionary)
        {
            ReleaseAssert.IsNotNull(jsonDictionary, "JSON dictionary cannot be null.");
            ReleaseAssert.IsTrue(jsonDictionary.ContainsKey("ChilliConnectID"), "Json is missing required field 'ChilliConnectID'");
            ReleaseAssert.IsTrue(jsonDictionary.ContainsKey("Date"), "Json is missing required field 'Date'");
            ReleaseAssert.IsTrue(jsonDictionary.ContainsKey("Score"), "Json is missing required field 'Score'");
            ReleaseAssert.IsTrue(jsonDictionary.ContainsKey("GlobalRank"), "Json is missing required field 'GlobalRank'");
            ReleaseAssert.IsTrue(jsonDictionary.ContainsKey("GlobalTotal"), "Json is missing required field 'GlobalTotal'");

            foreach (KeyValuePair <string, object> entry in jsonDictionary)
            {
                // Chilli Connect Id
                if (entry.Key == "ChilliConnectID")
                {
                    ReleaseAssert.IsTrue(entry.Value is string, "Invalid serialised type.");
                    ChilliConnectId = (string)entry.Value;
                }

                // User Name
                else if (entry.Key == "UserName")
                {
                    if (entry.Value != null)
                    {
                        ReleaseAssert.IsTrue(entry.Value is string, "Invalid serialised type.");
                        UserName = (string)entry.Value;
                    }
                }

                // Display Name
                else if (entry.Key == "DisplayName")
                {
                    if (entry.Value != null)
                    {
                        ReleaseAssert.IsTrue(entry.Value is string, "Invalid serialised type.");
                        DisplayName = (string)entry.Value;
                    }
                }

                // Date
                else if (entry.Key == "Date")
                {
                    ReleaseAssert.IsTrue(entry.Value is string, "Invalid serialised type.");
                    Date = JsonSerialisation.DeserialiseDate((string)entry.Value);
                }

                // Data
                else if (entry.Key == "Data")
                {
                    if (entry.Value != null)
                    {
                        ReleaseAssert.IsTrue(entry.Value is object, "Invalid serialised type.");
                        Data = new MultiTypeValue((object)entry.Value);
                    }
                }

                // Score
                else if (entry.Key == "Score")
                {
                    ReleaseAssert.IsTrue(entry.Value is long, "Invalid serialised type.");
                    Score = (int)(long)entry.Value;
                }

                // Global Rank
                else if (entry.Key == "GlobalRank")
                {
                    ReleaseAssert.IsTrue(entry.Value is long, "Invalid serialised type.");
                    GlobalRank = (int)(long)entry.Value;
                }

                // Global Total
                else if (entry.Key == "GlobalTotal")
                {
                    ReleaseAssert.IsTrue(entry.Value is long, "Invalid serialised type.");
                    GlobalTotal = (int)(long)entry.Value;
                }
            }
        }
Пример #27
0
        /// <summary>
        /// Initialises a new instance from the given Json dictionary.
        /// </summary>
        ///
        /// <param name="jsonDictionary">The dictionary containing the Json data.</param>
        public Match(IDictionary <string, object> jsonDictionary)
        {
            ReleaseAssert.IsNotNull(jsonDictionary, "JSON dictionary cannot be null.");
            ReleaseAssert.IsTrue(jsonDictionary.ContainsKey("MatchID"), "Json is missing required field 'MatchID'");
            ReleaseAssert.IsTrue(jsonDictionary.ContainsKey("MatchTypeKey"), "Json is missing required field 'MatchTypeKey'");
            ReleaseAssert.IsTrue(jsonDictionary.ContainsKey("State"), "Json is missing required field 'State'");
            ReleaseAssert.IsTrue(jsonDictionary.ContainsKey("WriteLock"), "Json is missing required field 'WriteLock'");
            ReleaseAssert.IsTrue(jsonDictionary.ContainsKey("TurnType"), "Json is missing required field 'TurnType'");
            ReleaseAssert.IsTrue(jsonDictionary.ContainsKey("AutoStart"), "Json is missing required field 'AutoStart'");
            ReleaseAssert.IsTrue(jsonDictionary.ContainsKey("IsPrivate"), "Json is missing required field 'IsPrivate'");
            ReleaseAssert.IsTrue(jsonDictionary.ContainsKey("DateCreated"), "Json is missing required field 'DateCreated'");

            foreach (KeyValuePair <string, object> entry in jsonDictionary)
            {
                // Match Id
                if (entry.Key == "MatchID")
                {
                    ReleaseAssert.IsTrue(entry.Value is string, "Invalid serialised type.");
                    MatchId = (string)entry.Value;
                }

                // Match Type Key
                else if (entry.Key == "MatchTypeKey")
                {
                    ReleaseAssert.IsTrue(entry.Value is string, "Invalid serialised type.");
                    MatchTypeKey = (string)entry.Value;
                }

                // State
                else if (entry.Key == "State")
                {
                    ReleaseAssert.IsTrue(entry.Value is string, "Invalid serialised type.");
                    State = (string)entry.Value;
                }

                // Write Lock
                else if (entry.Key == "WriteLock")
                {
                    ReleaseAssert.IsTrue(entry.Value is string, "Invalid serialised type.");
                    WriteLock = (string)entry.Value;
                }

                // Properties
                else if (entry.Key == "Properties")
                {
                    if (entry.Value != null)
                    {
                        ReleaseAssert.IsTrue(entry.Value is IDictionary <string, object>, "Invalid serialised type.");
                        Properties = JsonSerialisation.DeserialiseMap((IDictionary <string, object>)entry.Value, (object element) =>
                        {
                            ReleaseAssert.IsTrue(element is object, "Invalid element type.");
                            return(new MultiTypeValue((object)element));
                        });
                    }
                }

                // State Data
                else if (entry.Key == "StateData")
                {
                    if (entry.Value != null)
                    {
                        ReleaseAssert.IsTrue(entry.Value is object, "Invalid serialised type.");
                        StateData = new MultiTypeValue((object)entry.Value);
                    }
                }

                // Outcome Data
                else if (entry.Key == "OutcomeData")
                {
                    if (entry.Value != null)
                    {
                        ReleaseAssert.IsTrue(entry.Value is object, "Invalid serialised type.");
                        OutcomeData = new MultiTypeValue((object)entry.Value);
                    }
                }

                // Turn Timeout
                else if (entry.Key == "TurnTimeout")
                {
                    if (entry.Value != null)
                    {
                        ReleaseAssert.IsTrue(entry.Value is IDictionary <string, object>, "Invalid serialised type.");
                        TurnTimeout = new Timeout((IDictionary <string, object>)entry.Value);
                    }
                }

                // Waiting Timeout
                else if (entry.Key == "WaitingTimeout")
                {
                    if (entry.Value != null)
                    {
                        ReleaseAssert.IsTrue(entry.Value is IDictionary <string, object>, "Invalid serialised type.");
                        WaitingTimeout = new Timeout((IDictionary <string, object>)entry.Value);
                    }
                }

                // Turn Type
                else if (entry.Key == "TurnType")
                {
                    ReleaseAssert.IsTrue(entry.Value is string, "Invalid serialised type.");
                    TurnType = (string)entry.Value;
                }

                // Turn Order Type
                else if (entry.Key == "TurnOrderType")
                {
                    if (entry.Value != null)
                    {
                        ReleaseAssert.IsTrue(entry.Value is string, "Invalid serialised type.");
                        TurnOrderType = (string)entry.Value;
                    }
                }

                // Player Limit
                else if (entry.Key == "PlayerLimit")
                {
                    if (entry.Value != null)
                    {
                        ReleaseAssert.IsTrue(entry.Value is long, "Invalid serialised type.");
                        PlayerLimit = (int)(long)entry.Value;
                    }
                }

                // Players
                else if (entry.Key == "Players")
                {
                    if (entry.Value != null)
                    {
                        ReleaseAssert.IsTrue(entry.Value is IList <object>, "Invalid serialised type.");
                        Players = JsonSerialisation.DeserialiseList((IList <object>)entry.Value, (object element) =>
                        {
                            ReleaseAssert.IsTrue(element is IDictionary <string, object>, "Invalid element type.");
                            return(new Player((IDictionary <string, object>)element));
                        });
                    }
                }

                // Auto Start
                else if (entry.Key == "AutoStart")
                {
                    ReleaseAssert.IsTrue(entry.Value is bool, "Invalid serialised type.");
                    AutoStart = (bool)entry.Value;
                }

                // Is Private
                else if (entry.Key == "IsPrivate")
                {
                    ReleaseAssert.IsTrue(entry.Value is bool, "Invalid serialised type.");
                    IsPrivate = (bool)entry.Value;
                }

                // Turn Number
                else if (entry.Key == "TurnNumber")
                {
                    if (entry.Value != null)
                    {
                        ReleaseAssert.IsTrue(entry.Value is long, "Invalid serialised type.");
                        TurnNumber = (int)(long)entry.Value;
                    }
                }

                // Last Turn
                else if (entry.Key == "LastTurn")
                {
                    if (entry.Value != null)
                    {
                        ReleaseAssert.IsTrue(entry.Value is IDictionary <string, object>, "Invalid serialised type.");
                        LastTurn = new MatchTurn((IDictionary <string, object>)entry.Value);
                    }
                }

                // Current Turn
                else if (entry.Key == "CurrentTurn")
                {
                    if (entry.Value != null)
                    {
                        ReleaseAssert.IsTrue(entry.Value is IDictionary <string, object>, "Invalid serialised type.");
                        CurrentTurn = new MatchTurn((IDictionary <string, object>)entry.Value);
                    }
                }

                // Created By
                else if (entry.Key == "CreatedBy")
                {
                    if (entry.Value != null)
                    {
                        ReleaseAssert.IsTrue(entry.Value is IDictionary <string, object>, "Invalid serialised type.");
                        CreatedBy = new Player((IDictionary <string, object>)entry.Value);
                    }
                }

                // Date Created
                else if (entry.Key == "DateCreated")
                {
                    ReleaseAssert.IsTrue(entry.Value is string, "Invalid serialised type.");
                    DateCreated = JsonSerialisation.DeserialiseDate((string)entry.Value);
                }
            }
        }
 /// <summary>
 /// Initialises a new instance from the given error code.
 /// </summary>
 ///
 /// <param name="errorCode">The error code.</param>
 public GetScoresForFacebookFriendsError(Error errorCode)
 {
     ErrorCode        = errorCode;
     ErrorData        = MultiTypeValue.Null;
     ErrorDescription = GetErrorDescription(ErrorCode);
 }
Пример #29
0
 /// <summary>
 /// Initialises a new instance from the given error code.
 /// </summary>
 ///
 /// <param name="errorCode">The error code.</param>
 public UnlinkFacebookAccountError(Error errorCode)
 {
     ErrorCode        = errorCode;
     ErrorData        = MultiTypeValue.Null;
     ErrorDescription = GetErrorDescription(ErrorCode);
 }
 /// <summary>
 /// Initialises a new instance from the given error code.
 /// </summary>
 ///
 /// <param name="errorCode">The error code.</param>
 public GetScoresForChilliConnectIdsError(Error errorCode)
 {
     ErrorCode        = errorCode;
     ErrorData        = MultiTypeValue.Null;
     ErrorDescription = GetErrorDescription(ErrorCode);
 }