Example #1
0
        void LogRedisInfo(string info, string key, string data)
        {
#if DEBUG
            //ConsoleManager.WriteLine(string.Format("{0}, {1}, {2}", info, key, data), ConsoleMessageType.Debug);
#endif

            Logger.Log(Log_Type.INFO, LowercaseContractResolver.SerializeObject(new { info, key, data }));
        }
Example #2
0
        string SerializeChatMetadata(Dictionary <string, string> meta)
        {
            if (meta == null)
            {
                return(null);
            }

            return(LowercaseContractResolver.SerializeObject(meta));
        }
Example #3
0
        public static string ToClientJson(this ChatlineObject chat)
        {
            var clientsideChat = new
            {
                chatline  = chat.ChatFragments,
                timestamp = TimeKeeper.GetUnixTime()
            };

            return(LowercaseContractResolver.SerializeObject(clientsideChat));
        }
Example #4
0
        void LogRedisError(Exception e, string key, string data)
        {
            var highLevelMessage = "Redis error.";

#if DEBUG
            ConsoleManager.WriteLine(e.ToString(), ConsoleMessageType.Error);
#endif

            Logger.Log(Log_Type.ERROR, LowercaseContractResolver.SerializeObject(new { key, data, e, highLevelMessage }));
        }
Example #5
0
        public Response ReturnJsonResponse(object message, HttpStatusCode statusCode = HttpStatusCode.OK)
        {
            // Extra new line for curl output
            var responseJson = (Response)(LowercaseContractResolver.SerializeObject(message) + "\n");

            responseJson.ContentType = "application/json";
            responseJson.StatusCode  = statusCode;

            return(responseJson);
        }
        public void SwitchActiveState(UIStateManagerContainer container)
        {
            if (!WebLayer.IsLoaded)
            {
                return;
            }

            var stateJson = LowercaseContractResolver.SerializeObject(container);

            WebLayer.CallJavascriptFunctionAsync("SwitchActiveState", stateJson);
        }
        public override void Update(IGameTimeService gameTime)
        {
            ViewModel.Update(gameTime);

            _gameUserInterface.Update(gameTime);

            if (!IsLoaded)
            {
                return;
            }

            var interfaceJson = LowercaseContractResolver.SerializeObject(ViewModel.CurrentGlobalGameInterfaceState);

            WebLayer.CallJavascriptFunctionAsync(
                "UpdateGameInterface",
                interfaceJson
                );
        }
        /// <summary>
        /// Calls a registered async function and returns a stringified RegistryResponse.
        /// </summary>
        /// <param name="name">Name of the async function to call.</param>
        /// <param name="json">The marshallContainer in json format.</param>
        /// <returns>A stringified RegistryResponse from result.</returns>
        public async Task <string> ExecuteAsync(string json)
        {
            var marshallContainer = JsonConvert.DeserializeObject <JSMarshallContainer>(json);

            return(LowercaseContractResolver.SerializeObject(await CallRegisteredFunctionAsync(marshallContainer)));
        }
        /// <summary>
        /// Calls a registered function and returns a stringified RegistryResponse.
        /// </summary>
        /// <param name="name">Name of the function to call.</param>
        /// <param name="json">The marshallContainer in json format.</param>
        /// <returns>A stringified RegistryResponse from result.</returns>
        public string Execute(string name, string json)
        {
            var marshallContainer = JsonConvert.DeserializeObject <JSMarshallContainer>(json);

            return(LowercaseContractResolver.SerializeObject(CallRegisteredFunction(marshallContainer)));
        }
Example #10
0
 public string GetChatsJson()
 {
     return(LowercaseContractResolver.SerializeObject(_viewModel.Chats));
 }