public String GetMessageXML() { String xml = "<message direction='" + direction.ToString() + "' type='" + type + "' datatype='" + dataType.ToString() + "' scope='" + scope + "' version='" + version + "'>"; xml += "<![CDATA[" + Payload + "]]>"; xml += "</message>"; return(xml); }
private static void a(byte[] A_0, MessageDirection A_1, Exception A_2) { int key = BitConverter.ToInt32(A_0, 0); string str = "???"; if (!a.ContainsKey(key)) { a[key] = 1; } else { Dictionary <int, int> dictionary; int num3; (dictionary = a)[num3 = key] = dictionary[num3] + 1; } try { str = a(); } catch { } StringBuilder builder = new StringBuilder(); builder.AppendFormat("[VTank] Decal parse failure logged for {0} message with type {1}, messages ver {2}, data: ", A_1, key, str); builder.AppendFormat("[{0:0000}:{1:00}:{2:00}:{3:00}:{4:00}:{5:00}] ", new object[] { DateTimeOffset.Now.Year, DateTimeOffset.Now.Month, DateTimeOffset.Now.Day, DateTimeOffset.Now.Hour, DateTimeOffset.Now.Minute, DateTimeOffset.Now.Second }); builder.Append("["); builder.Append(key.ToString("X")); builder.Append(","); builder.Append(A_1.ToString()); builder.Append("] "); foreach (byte num2 in A_0) { builder.AppendFormat("{0:X2}:", num2); } builder.Append(" "); builder.Append(A_2.ToString()); string message = builder.ToString(); Debug.Print(message); if (a[key] <= 3) { dj.a(new Exception(message), false); } string path = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Personal), @"Decal Plugins\Virindi Tank\parseerrors.txt"); string directoryName = Path.GetDirectoryName(path); if (!Directory.Exists(directoryName)) { Directory.CreateDirectory(directoryName); } using (StreamWriter writer = new StreamWriter(path, true)) { writer.Write(message); writer.WriteLine(); } }
public static void WriteMessageLog(WechatBaseMessage message, MessageDirection direction, string rawData) { using (WechatDBDataContext db = new WechatDBDataContext(Settings.Default.WechatDBConnectionString)) { WechatMessage data = new WechatMessage(); data.CreateTime = message.CreateTime; data.FromUserName = message.FromUserName; data.MsgType = message.MsgType; data.Direction = direction.ToString(); data.ToUserName = message.ToUserName; data.RawData = rawData; db.WechatMessages.InsertOnSubmit(data); db.SubmitChanges(); } }
/// <summary> /// Gets the messages log /// </summary> /// <param name="StartDate">FROM this date</param> /// <param name="EndDate">TO this date</param> /// <param name="Start">From this message on the list</param> /// <param name="Limit">Maximun number of records</param> /// <param name="Msisdn">Country code and phone number</param> /// <param name="ShortName">Filter all messages sent to specified group's short_name</param> /// <param name="Include_Recipients">If true it will include the list of recipients for each message</param> /// <returns>Object with the message list</returns> public ResponseObjects.ApiResponse <List <MessageResponse> > GetList(DateTime?StartDate = null, DateTime?EndDate = null, Int32 Start = -1, Int32 Limit = -1, String Msisdn = null, String ShortName = null, Boolean IncludeRecipients = false, MessageDirection Direction = MessageDirection.MT, String Username = null) { Dictionary <string, string> UrlParameters = new Dictionary <string, string>(); if (StartDate.HasValue) { UrlParameters.Add("start_date", StartDate.Value.ToString("yyyy-MM-dd HH:mm:ss")); } if (EndDate.HasValue) { UrlParameters.Add("end_date", EndDate.Value.ToString("yyyy-MM-dd HH:mm:ss")); } if (Start != -1) { UrlParameters.Add("start", Start.ToString()); } if (Limit != -1) { UrlParameters.Add("limit", Limit.ToString()); } if (Msisdn != null) { UrlParameters.Add("msisdn", Msisdn); } if (ShortName != null) { UrlParameters.Add("short_name", ShortName); } if (Username != null) { UrlParameters.Add("user", Username); } UrlParameters.Add("direction", Direction.ToString().ToUpper()); UrlParameters.Add("include_recipients", IncludeRecipients.ToString().ToLower()); ResponseObjects.ApiResponse <List <MessageResponse> > serverResponse = this.RequestToApi <List <MessageResponse> >("messages", request.get, UrlParameters, null, true); return(serverResponse); //object serverResponse = this.RequestToApi("messages", request.get, UrlParameters, null, true); //if (serverResponse.GetType() == typeof(List<string>)) // return serverResponse; //else // return JsonConvert.DeserializeObject<List<MessageResponse>>((string)serverResponse); }
/// <summary> /// Gets the messages log /// </summary> /// <param name="StartDate">FROM this date</param> /// <param name="EndDate">TO this date</param> /// <param name="Start">From this message on the list</param> /// <param name="Limit">Maximun number of records</param> /// <param name="Msisdn">Country code and phone number</param> /// <param name="ShortName">Filter all messages sent to specified group's short_name</param> /// <param name="Include_Recipients">If true it will include the list of recipients for each message</param> /// <returns>Object with the message list</returns> public ResponseObjects.ApiResponse<List<MessageResponse>> GetList(DateTime? StartDate = null, DateTime? EndDate = null, Int32 Start = -1, Int32 Limit = -1, String Msisdn = null, String ShortName = null, Boolean IncludeRecipients = false, MessageDirection Direction = MessageDirection.MT, String Username = null) { Dictionary<string, string> UrlParameters = new Dictionary<string, string>(); if( StartDate.HasValue) { UrlParameters.Add("start_date", StartDate.Value.ToString("yyyy-MM-dd HH:mm:ss")); } if (EndDate.HasValue) { UrlParameters.Add("end_date", EndDate.Value.ToString("yyyy-MM-dd HH:mm:ss")); } if ( Start != -1) UrlParameters.Add("start", Start.ToString()); if ( Limit != -1) UrlParameters.Add("limit", Limit.ToString()); if ( Msisdn != null) UrlParameters.Add("msisdn", Msisdn); if ( ShortName != null) UrlParameters.Add("short_name", ShortName); if (Username != null) UrlParameters.Add("user", Username); UrlParameters.Add("direction", Direction.ToString().ToUpper()); UrlParameters.Add("include_recipients", IncludeRecipients.ToString().ToLower()); ResponseObjects.ApiResponse<List<MessageResponse>> serverResponse = this.RequestToApi<List<MessageResponse>>("messages", request.get, UrlParameters, null, true); return serverResponse; //object serverResponse = this.RequestToApi("messages", request.get, UrlParameters, null, true); //if (serverResponse.GetType() == typeof(List<string>)) // return serverResponse; //else // return JsonConvert.DeserializeObject<List<MessageResponse>>((string)serverResponse); }