RegisterResponseInfo.cs 1.8 KB

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