// This function uses the ASWBXML class to decode // a WBXML stream into XML. private string DecodeWBXML(byte[] wbxml) { try { ASWBXML decoder = new ASWBXML(); decoder.LoadBytes(wbxml); return(decoder.GetXml()); } catch (Exception ex) { ASError.ReportException(ex); return(""); } }
/* * public ASCommandResponse(HttpWebResponse httpResponse) * { * Stream responseStream = httpResponse.GetResponseStream(); * List<byte> bytes = new List<byte>(); * byte[] byteBuffer = new byte[256]; * int count = 0; * * count = responseStream.Read(byteBuffer, 0, 256); * while (count > 0) * { * bytes.AddRange(byteBuffer); * * if (count < 256) * { * int excess = 256 - count; * bytes.RemoveRange(bytes.Count - excess, excess); * } * * count = responseStream.Read(byteBuffer, 0, 256); * } * * wbxmlBytes = bytes.ToArray(); * * DecodeWBXML(wbxmlBytes); * } */ public ASCommandResponse(byte[] wbxml) { wbxmlBytes = wbxml; ASWBXML decoder = new ASWBXML(); if (wbxml.Length > 0) { // Decode without smart view parsing decoder.LoadBytes(wbxml); xmlString = decoder.GetXml(); // Decode with smart view parsing decoder.LoadBytes(wbxml, true); XmlDoc = decoder.GetXmlDoc(); } }
private string DecodeWBXML(byte[] wbxml) { try { ASWBXML decoder = new ASWBXML(); decoder.LoadBytes(wbxml); return(decoder.GetXml()); } catch (Exception ex) { System.Windows.Forms.MessageBox.Show(ex.Message, "Error calling DecodeWBXML"); //VSError.ReportException(ex); return(""); } }
internal static string Decode(byte[] wbxml) { if (wbxml == null || wbxml.Length == 0) { return(string.Empty); } try { ASWBXML decoder = new ASWBXML(); decoder.LoadBytes(wbxml); return(decoder.GetXml()); } catch (Exception ex) { LogService.Log("ASXML", "Failed to decode content: " + ex.Message); throw; } }
private string DecodeWBXML(byte[] wbxml) { try { ASWBXML decoder = new ASWBXML(); decoder.LoadBytes(wbxml); return(decoder.GetXml()); } catch (Exception ex) { //VSError.ReportException(ex); MessageBox.Show("Exception: \r\n" + ex.ToString(), "Error"); System.Diagnostics.Debug.WriteLine("--------------------------"); System.Diagnostics.Debug.WriteLine("Exception:"); System.Diagnostics.Debug.WriteLine(" Message: " + ex.Message); System.Diagnostics.Debug.WriteLine(" Stack: " + ex.StackTrace); return(""); } }