ResolveInfo.cs 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. //
  2. // ResolveInfo.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 ResolveInfo
  14. {
  15. [MessageBodyMember (Name = "Resolve", Namespace = "http://schemas.microsoft.com/net/2006/05/peer")]
  16. ResolveInfoDC body;
  17. public ResolveInfo ()
  18. {
  19. body = new ResolveInfoDC ();
  20. }
  21. public ResolveInfo (Guid clientId, string meshId, int maxAddresses)
  22. : this ()
  23. {
  24. if (clientId == Guid.Empty)
  25. throw new ArgumentException ("Empty Guid");
  26. if (String.IsNullOrEmpty (meshId))
  27. throw new ArgumentNullException ("meshId");
  28. if (maxAddresses <= 0)
  29. throw new ArgumentOutOfRangeException ("maxAddresses must be positive integer");
  30. body.ClientId = clientId;
  31. body.MeshId = meshId;
  32. body.MaxAddresses = maxAddresses;
  33. }
  34. public Guid ClientId {
  35. get { return body.ClientId; }
  36. }
  37. public int MaxAddresses {
  38. get { return body.MaxAddresses; }
  39. }
  40. public string MeshId {
  41. get { return body.MeshId; }
  42. }
  43. [MonoTODO]
  44. public bool HasBody()
  45. {
  46. throw new NotImplementedException ();
  47. }
  48. }
  49. [DataContract (Name = "Resolve", Namespace = "http://schemas.microsoft.com/net/2006/05/peer")]
  50. internal class ResolveInfoDC
  51. {
  52. Guid client_id;
  53. int max_addresses;
  54. string mesh_id;
  55. public ResolveInfoDC ()
  56. {
  57. }
  58. [DataMember]
  59. public Guid ClientId {
  60. get { return client_id; }
  61. set { client_id = value; }
  62. }
  63. [DataMember]
  64. public int MaxAddresses {
  65. get { return max_addresses; }
  66. set { max_addresses = value; }
  67. }
  68. [DataMember]
  69. public string MeshId {
  70. get { return mesh_id; }
  71. set { mesh_id = value; }
  72. }
  73. }
  74. }