private void ExtractMessageWithTimetokens(object element, string cipherKey, out PNHistoryItemResult pnHistoryItemResult) { //[[{"message":{"text":"hey"},"timetoken":14985452911089049}],14985452911089049,14985452911089049] //[[{"message":{"text":"hey"},"timetoken":14986549102032676},{"message":"E8VOcbfrYqLyHMtoVGv9UQ==","timetoken":14986619049105442},{"message":"E8VOcbfrYqLyHMtoVGv9UQ==","timetoken":14986619291068634}],14986549102032676,14986619291068634] pnHistoryItemResult = new PNHistoryItemResult(); Dictionary <string, object> historyMessage = element as Dictionary <string, object>; #if (ENABLE_PUBNUB_LOGGING) this.PubNubInstance.PNLog.WriteToLog(string.Format("ExtractMessageWithTimetokens: historyMessage {0}", historyMessage), PNLoggingMethod.LevelInfo); #endif object v; historyMessage.TryGetValue("message", out v); if (!string.IsNullOrEmpty(cipherKey) && (cipherKey.Length > 0)) { //TODO: handle exception pnHistoryItemResult.Entry = Helpers.DecodeMessage(cipherKey, v, OperationType, this.PubNubInstance); } else { pnHistoryItemResult.Entry = v; } #if (ENABLE_PUBNUB_LOGGING) this.PubNubInstance.PNLog.WriteToLog(string.Format("ExtractMessageWithTimetokens: v {0}", pnHistoryItemResult.Entry), PNLoggingMethod.LevelInfo); #endif object t; historyMessage.TryGetValue("timetoken", out t); pnHistoryItemResult.Timetoken = Utility.ValidateTimetoken(t.ToString(), false); #if (ENABLE_PUBNUB_LOGGING) this.PubNubInstance.PNLog.WriteToLog(string.Format("ExtractMessageWithTimetokens: t {0}", t), PNLoggingMethod.LevelInfo); #endif }
private void ExtractMessage(object element, string cipherKey, out PNHistoryItemResult pnHistoryItemResult) { //[[{"text":"hey"}],14985452911089049,14985452911089049] //[[{"text":"hey"},"E8VOcbfrYqLyHMtoVGv9UQ==","E8VOcbfrYqLyHMtoVGv9UQ=="],14986549102032676,14986619291068634] pnHistoryItemResult = new PNHistoryItemResult(); if (!string.IsNullOrEmpty(cipherKey) && (cipherKey.Length > 0)) { //TODO: handle exception pnHistoryItemResult.Entry = Helpers.DecodeMessage(cipherKey, element, OperationType, this.PubNubInstance); } else { pnHistoryItemResult.Entry = element; } #if (ENABLE_PUBNUB_LOGGING) this.PubNubInstance.PNLog.WriteToLog(string.Format("ExtractMessage: v {0}", pnHistoryItemResult.Entry), PNLoggingMethod.LevelInfo); #endif }