Not logged in. · Lost password · Register
Forum: agsXMPP RSS
Avatar
ayyrk #1
Member since Jul 2007 · 92 posts
Group memberships: Members
Show profile · Link to this post
Subject: SetTagBase64
Alex,

I based some code on your Manual "creating own packet types".

I am sending binary data using:

SetTag("bytes", readToBase64String( fileName));

Looking back at this code I now find SetTagBase64.

Question: Is there a benefit to using SetTagBase64 or is my readToBase64String method accomplishing the same thing?

Thanks!
-Ayyrk
Avatar
Alex #2
Member since Feb 2003 · 4449 posts · Location: Germany
Group memberships: Administrators, Members
Show profile · Link to this post
no there is no benefit of using the SetTagBase64 functions.
In contrary, they can use you some encoding troubles with the first overload which is using Encoding.Unicode. I cannot remember right now why I added them. Its on my TODO list to check and refactor this functions with the next release. Because we had some troubles when we tried to use them for IBB file transfers for some custom customer code ;-)

  1. /// <summary>
  2. /// Adds a Tag and encodes the Data to BASE64
  3. /// </summary>
  4. /// <param name="argTagname"></param>
  5. /// <param name="argText"></param>
  6. public void SetTagBase64(string argTagname, string argText)
  7. {
  8.     byte[] b = Encoding.Unicode.GetBytes(argText);
  9.     SetTag(argTagname, Convert.ToBase64String(b, 0, b.Length));
  10. }
  11.  
  12. /// <summary>
  13. /// Adds a Tag end decodes the byte buffer to BASE64
  14. /// </summary>
  15. /// <param name="argTagname"></param>
  16. /// <param name="buffer"></param>
  17. public void SetTagBase64(string argTagname, byte[] buffer)
  18. {
  19.     SetTag(argTagname, Convert.ToBase64String(buffer, 0, buffer.Length));
  20. }

Alex
Close Smaller – Larger + Reply to this post:
Verification code: VeriCode Please enter the word from the image into the text field below. (Type the letters only, lower case is okay.)
Smileys: :-) ;-) :-D :-p :blush: :cool: :rolleyes: :huh: :-/ <_< :-( :'( :#: :scared: 8-( :nuts: :-O
Special characters:
Forum: agsXMPP RSS