/src/StreamingClient.Silverlight.Lightstreamer/Lightstreamer.Silverlight/ConnectionInfo.cs

https://github.com/psrodriguez/CIAPI.CS · C# · 355 lines · 330 code · 25 blank · 0 comment · 43 complexity · 9b876d6b0fa2444a0277194661250c01 MD5 · raw file

  1. namespace Lightstreamer.DotNet.Client
  2. {
  3. using System;
  4. public class ConnectionInfo
  5. {
  6. [Obsolete("Use the Adapter property instead of the adapter member.")]
  7. public string adapter = null;
  8. [Obsolete("Use the Constraints property instead of the constraints member; the configuration object should be modified rather than replaced.")]
  9. public ConnectionConstraints constraints = new ConnectionConstraints();
  10. [Obsolete("Use the ContentLength property instead of the contentLength member.")]
  11. public int contentLength = 0x2faf080;
  12. [Obsolete("Use the EnableStreamSense property instead of the enableStreamSense member.")]
  13. public bool enableStreamSense = true;
  14. [Obsolete("Use the Polling property instead of the isPolling member.")]
  15. public bool isPolling = false;
  16. [Obsolete("Use the KeepaliveMillis property instead of the keepaliveMillis member.")]
  17. public long keepaliveMillis = 0L;
  18. [Obsolete("Use the Password property instead of the password member.")]
  19. public string password = null;
  20. [Obsolete("Use the PollingIdleMillis property instead of the pollingIdleMillis member.")]
  21. public long pollingIdleMillis = 0x7530L;
  22. [Obsolete("Use the PollingMillis property instead of the pollingMillis member.")]
  23. public long pollingMillis = 0L;
  24. [Obsolete("Use the ProbeTimeoutMillis property instead of the probeTimeoutMillis member.")]
  25. public long probeTimeoutMillis = 0x3a98L;
  26. [Obsolete("Use the ProbeWarningMillis property instead of the probeWarningMillis member.")]
  27. public long probeWarningMillis = 0x7d0L;
  28. [Obsolete("Use the PushServerControlUrl property instead of the pushServerControlUrl member.")]
  29. public string pushServerControlUrl = null;
  30. [Obsolete("Use the PushServerUrl property instead of the pushServerUrl member.")]
  31. public string pushServerUrl = null;
  32. [Obsolete("Use the ReconnectionTimeoutMillis property instead of the reconnectionTimeoutMillis member.")]
  33. public long reconnectionTimeoutMillis = 0x1388L;
  34. [Obsolete("Use the StreamingTimeoutMillis property instead of the streamingTimeoutMillis member.")]
  35. public long streamingTimeoutMillis = 0x1388L;
  36. internal bool useGetForStreaming = false;
  37. [Obsolete("Use the User property instead of the user member.")]
  38. public string user = null;
  39. public virtual object Clone()
  40. {
  41. ConnectionInfo info = (ConnectionInfo) base.MemberwiseClone();
  42. info.constraints = (ConnectionConstraints) info.constraints.Clone();
  43. return info;
  44. }
  45. public override bool Equals(object other)
  46. {
  47. if (other != this)
  48. {
  49. if (other == null)
  50. {
  51. return false;
  52. }
  53. ConnectionInfo info = (ConnectionInfo) other;
  54. if (info.probeTimeoutMillis != this.probeTimeoutMillis)
  55. {
  56. return false;
  57. }
  58. if (info.probeWarningMillis != this.probeWarningMillis)
  59. {
  60. return false;
  61. }
  62. if (info.keepaliveMillis != this.keepaliveMillis)
  63. {
  64. return false;
  65. }
  66. if (info.reconnectionTimeoutMillis != this.reconnectionTimeoutMillis)
  67. {
  68. return false;
  69. }
  70. if (info.enableStreamSense != this.enableStreamSense)
  71. {
  72. return false;
  73. }
  74. if (info.streamingTimeoutMillis != this.streamingTimeoutMillis)
  75. {
  76. return false;
  77. }
  78. if (info.contentLength != this.contentLength)
  79. {
  80. return false;
  81. }
  82. if (info.isPolling != this.isPolling)
  83. {
  84. return false;
  85. }
  86. if (info.useGetForStreaming != this.useGetForStreaming)
  87. {
  88. return false;
  89. }
  90. if (info.pollingMillis != this.pollingMillis)
  91. {
  92. return false;
  93. }
  94. if (info.pollingIdleMillis != this.pollingIdleMillis)
  95. {
  96. return false;
  97. }
  98. if (!this.Equals(info.pushServerUrl, this.pushServerUrl))
  99. {
  100. return false;
  101. }
  102. if (!this.Equals(info.pushServerControlUrl, this.pushServerControlUrl))
  103. {
  104. return false;
  105. }
  106. if (!this.Equals(info.user, this.user))
  107. {
  108. return false;
  109. }
  110. if (!this.Equals(info.password, this.password))
  111. {
  112. return false;
  113. }
  114. if (!this.Equals(info.GetAdapterSet(), this.GetAdapterSet()))
  115. {
  116. return false;
  117. }
  118. if (!this.Equals(info.constraints, this.constraints))
  119. {
  120. return false;
  121. }
  122. }
  123. return true;
  124. }
  125. private bool Equals(object o1, object o2)
  126. {
  127. if ((o1 == null) && (o2 == null))
  128. {
  129. return true;
  130. }
  131. if ((o1 == null) || (o2 == null))
  132. {
  133. return false;
  134. }
  135. return o1.Equals(o2);
  136. }
  137. internal string GetAdapterSet()
  138. {
  139. if (this.adapter != null)
  140. {
  141. return this.adapter;
  142. }
  143. return "DEFAULT";
  144. }
  145. public override int GetHashCode()
  146. {
  147. return base.GetHashCode();
  148. }
  149. internal bool StartsWithPoll()
  150. {
  151. return (this.isPolling || this.useGetForStreaming);
  152. }
  153. public override string ToString()
  154. {
  155. return (this.pushServerUrl + " - " + this.constraints.ToString());
  156. }
  157. public string Adapter
  158. {
  159. get
  160. {
  161. return this.adapter;
  162. }
  163. set
  164. {
  165. this.adapter = value;
  166. }
  167. }
  168. public ConnectionConstraints Constraints
  169. {
  170. get
  171. {
  172. return this.constraints;
  173. }
  174. }
  175. public int ContentLength
  176. {
  177. get
  178. {
  179. return this.contentLength;
  180. }
  181. set
  182. {
  183. this.contentLength = value;
  184. }
  185. }
  186. public bool EnableStreamSense
  187. {
  188. get
  189. {
  190. return this.enableStreamSense;
  191. }
  192. set
  193. {
  194. this.enableStreamSense = value;
  195. }
  196. }
  197. public long KeepaliveMillis
  198. {
  199. get
  200. {
  201. return this.keepaliveMillis;
  202. }
  203. set
  204. {
  205. this.keepaliveMillis = value;
  206. }
  207. }
  208. public string Password
  209. {
  210. get
  211. {
  212. return this.password;
  213. }
  214. set
  215. {
  216. this.password = value;
  217. }
  218. }
  219. public bool Polling
  220. {
  221. get
  222. {
  223. return this.isPolling;
  224. }
  225. set
  226. {
  227. this.isPolling = value;
  228. }
  229. }
  230. public long PollingIdleMillis
  231. {
  232. get
  233. {
  234. return this.pollingIdleMillis;
  235. }
  236. set
  237. {
  238. this.pollingIdleMillis = value;
  239. }
  240. }
  241. public long PollingMillis
  242. {
  243. get
  244. {
  245. return this.pollingMillis;
  246. }
  247. set
  248. {
  249. this.pollingMillis = value;
  250. }
  251. }
  252. public long ProbeTimeoutMillis
  253. {
  254. get
  255. {
  256. return this.probeTimeoutMillis;
  257. }
  258. set
  259. {
  260. this.probeTimeoutMillis = value;
  261. }
  262. }
  263. public long ProbeWarningMillis
  264. {
  265. get
  266. {
  267. return this.probeWarningMillis;
  268. }
  269. set
  270. {
  271. this.probeWarningMillis = value;
  272. }
  273. }
  274. public string PushServerControlUrl
  275. {
  276. get
  277. {
  278. return this.pushServerControlUrl;
  279. }
  280. set
  281. {
  282. this.pushServerControlUrl = value;
  283. }
  284. }
  285. public string PushServerUrl
  286. {
  287. get
  288. {
  289. return this.pushServerUrl;
  290. }
  291. set
  292. {
  293. this.pushServerUrl = value;
  294. }
  295. }
  296. public long ReconnectionTimeoutMillis
  297. {
  298. get
  299. {
  300. return this.reconnectionTimeoutMillis;
  301. }
  302. set
  303. {
  304. this.reconnectionTimeoutMillis = value;
  305. }
  306. }
  307. public long StreamingTimeoutMillis
  308. {
  309. get
  310. {
  311. return this.streamingTimeoutMillis;
  312. }
  313. set
  314. {
  315. this.streamingTimeoutMillis = value;
  316. }
  317. }
  318. public string User
  319. {
  320. get
  321. {
  322. return this.user;
  323. }
  324. set
  325. {
  326. this.user = value;
  327. }
  328. }
  329. }
  330. }