RegisterResponseInfo.cs 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. //
  2. // RegisterResponseInfo.cs
  3. //
  4. // Author:
  5. // Marcos Cobena ([email protected])
  6. //
  7. // Copyright 2007 Marcos Cobena (http://www.youcannoteatbits.org/)
  8. //
  9. using System.Runtime.Serialization;
  10. namespace System.ServiceModel.PeerResolvers
  11. {
  12. [MessageContract (IsWrapped = false)]
  13. public class RegisterResponseInfo
  14. {
  15. [MessageBodyMember (Name = "Update", Namespace = "http://schemas.microsoft.com/net/2006/05/peer")] // .NET indeed returns "Update" element here.
  16. RegisterResponseInfoDC body;
  17. public RegisterResponseInfo ()
  18. {
  19. body = new RegisterResponseInfoDC ();
  20. }
  21. public RegisterResponseInfo (Guid registrationId, TimeSpan registrationLifetime)
  22. {
  23. body.RegistrationId = registrationId;
  24. body.RegistrationLifetime = registrationLifetime;
  25. }
  26. public Guid RegistrationId {
  27. get { return body.RegistrationId; }
  28. set { body.RegistrationId = value; }
  29. }
  30. public TimeSpan RegistrationLifetime {
  31. get { return body.RegistrationLifetime; }
  32. set { body.RegistrationLifetime = value; }
  33. }
  34. public bool HasBody ()
  35. {
  36. return true; // FIXME: I have no idea when it returns false
  37. }
  38. }
  39. [DataContract (Name = "Update", Namespace = "http://schemas.microsoft.com/net/2006/05/peer")]
  40. internal class RegisterResponseInfoDC
  41. {
  42. Guid registration_id;
  43. TimeSpan registration_lifetime;
  44. public RegisterResponseInfoDC ()
  45. {
  46. }
  47. [DataMember]
  48. public Guid RegistrationId {
  49. get { return registration_id; }
  50. set { registration_id = value; }
  51. }
  52. [DataMember (EmitDefaultValue = false)]
  53. public TimeSpan RegistrationLifetime {
  54. get { return registration_lifetime; }
  55. set { registration_lifetime = value; }
  56. }
  57. }
  58. }