public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
    {
        var data = new BinaryData {
            binaryData = BinaryFormatterHelper.ToByteArray(value)
        };

        serializer.Serialize(writer, data);
    }
        private void GetGameDataNow(GameDataType gameDataType, object arg)
        {
            if (!Initialized)
            {
                return;
            }

            byte[] bytes = BinaryFormatterHelper.ToByteArray(new[] {
                gameDataType, arg
            });
            WriteMessageGuaranteed(new Message(MessageID.GetData, bytes));
        }
        private void ToggleGameSettingNow(string settingName, object value)
        {
            if (!Initialized)
            {
                return;
            }

            byte[] bytes = BinaryFormatterHelper.ToByteArray(new[] {
                settingName, value
            });
            WriteMessageGuaranteed(new Message(MessageID.ToggleGameSetting, bytes));
        }