RegisterResponseInfo.cs 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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. get {
  18. if (body == null)
  19. body = new RegisterResponseInfoDC ();
  20. return body;
  21. }
  22. }
  23. RegisterResponseInfoDC body;
  24. public RegisterResponseInfo ()
  25. {
  26. }
  27. public RegisterResponseInfo (Guid registrationId, TimeSpan registrationLifetime)
  28. {
  29. Body.RegistrationId = registrationId;
  30. Body.RegistrationLifetime = registrationLifetime;
  31. }
  32. public Guid RegistrationId {
  33. get { return Body.RegistrationId; }
  34. set { Body.RegistrationId = value; }
  35. }
  36. public TimeSpan RegistrationLifetime {
  37. get { return Body.RegistrationLifetime; }
  38. set { Body.RegistrationLifetime = value; }
  39. }
  40. public bool HasBody ()
  41. {
  42. return true; // FIXME: I have no idea when it returns false
  43. }
  44. }
  45. [DataContract (Name = "Update", Namespace = "http://schemas.microsoft.com/net/2006/05/peer")]
  46. internal class RegisterResponseInfoDC
  47. {
  48. Guid registration_id;
  49. TimeSpan registration_lifetime;
  50. public RegisterResponseInfoDC ()
  51. {
  52. }
  53. [DataMember]
  54. public Guid RegistrationId {
  55. get { return registration_id; }
  56. set { registration_id = value; }
  57. }
  58. [DataMember (EmitDefaultValue = false)]
  59. public TimeSpan RegistrationLifetime {
  60. get { return registration_lifetime; }
  61. set { registration_lifetime = value; }
  62. }
  63. }
  64. }