2
0

ServiceActionListBuilder.cs 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415
  1. using System.Collections.Generic;
  2. using Emby.Dlna.Common;
  3. namespace Emby.Dlna.ContentDirectory
  4. {
  5. /// <summary>
  6. /// Defines the <see cref="ServiceActionListBuilder" />.
  7. /// </summary>
  8. public static class ServiceActionListBuilder
  9. {
  10. /// <summary>
  11. /// Returns a list of services that this instance provides.
  12. /// </summary>
  13. /// <returns>An <see cref="IEnumerable{ServiceAction}"/>.</returns>
  14. public static IEnumerable<ServiceAction> GetActions()
  15. {
  16. return new[]
  17. {
  18. GetSearchCapabilitiesAction(),
  19. GetSortCapabilitiesAction(),
  20. GetGetSystemUpdateIDAction(),
  21. GetBrowseAction(),
  22. GetSearchAction(),
  23. GetX_GetFeatureListAction(),
  24. GetXSetBookmarkAction(),
  25. GetBrowseByLetterAction()
  26. };
  27. }
  28. /// <summary>
  29. /// Returns the action details for "GetSystemUpdateID".
  30. /// </summary>
  31. /// <returns>The <see cref="ServiceAction"/>.</returns>
  32. private static ServiceAction GetGetSystemUpdateIDAction()
  33. {
  34. var action = new ServiceAction
  35. {
  36. Name = "GetSystemUpdateID"
  37. };
  38. action.ArgumentList.Add(new Argument
  39. {
  40. Name = "Id",
  41. Direction = "out",
  42. RelatedStateVariable = "SystemUpdateID"
  43. });
  44. return action;
  45. }
  46. /// <summary>
  47. /// Returns the action details for "GetSearchCapabilities".
  48. /// </summary>
  49. /// <returns>The <see cref="ServiceAction"/>.</returns>
  50. private static ServiceAction GetSearchCapabilitiesAction()
  51. {
  52. var action = new ServiceAction
  53. {
  54. Name = "GetSearchCapabilities"
  55. };
  56. action.ArgumentList.Add(new Argument
  57. {
  58. Name = "SearchCaps",
  59. Direction = "out",
  60. RelatedStateVariable = "SearchCapabilities"
  61. });
  62. return action;
  63. }
  64. /// <summary>
  65. /// Returns the action details for "GetSortCapabilities".
  66. /// </summary>
  67. /// <returns>The <see cref="ServiceAction"/>.</returns>
  68. private static ServiceAction GetSortCapabilitiesAction()
  69. {
  70. var action = new ServiceAction
  71. {
  72. Name = "GetSortCapabilities"
  73. };
  74. action.ArgumentList.Add(new Argument
  75. {
  76. Name = "SortCaps",
  77. Direction = "out",
  78. RelatedStateVariable = "SortCapabilities"
  79. });
  80. return action;
  81. }
  82. /// <summary>
  83. /// Returns the action details for "X_GetFeatureList".
  84. /// </summary>
  85. /// <returns>The <see cref="ServiceAction"/>.</returns>
  86. private static ServiceAction GetX_GetFeatureListAction()
  87. {
  88. var action = new ServiceAction
  89. {
  90. Name = "X_GetFeatureList"
  91. };
  92. action.ArgumentList.Add(new Argument
  93. {
  94. Name = "FeatureList",
  95. Direction = "out",
  96. RelatedStateVariable = "A_ARG_TYPE_Featurelist"
  97. });
  98. return action;
  99. }
  100. /// <summary>
  101. /// Returns the action details for "Search".
  102. /// </summary>
  103. /// <returns>The <see cref="ServiceAction"/>.</returns>
  104. private static ServiceAction GetSearchAction()
  105. {
  106. var action = new ServiceAction
  107. {
  108. Name = "Search"
  109. };
  110. action.ArgumentList.Add(new Argument
  111. {
  112. Name = "ContainerID",
  113. Direction = "in",
  114. RelatedStateVariable = "A_ARG_TYPE_ObjectID"
  115. });
  116. action.ArgumentList.Add(new Argument
  117. {
  118. Name = "SearchCriteria",
  119. Direction = "in",
  120. RelatedStateVariable = "A_ARG_TYPE_SearchCriteria"
  121. });
  122. action.ArgumentList.Add(new Argument
  123. {
  124. Name = "Filter",
  125. Direction = "in",
  126. RelatedStateVariable = "A_ARG_TYPE_Filter"
  127. });
  128. action.ArgumentList.Add(new Argument
  129. {
  130. Name = "StartingIndex",
  131. Direction = "in",
  132. RelatedStateVariable = "A_ARG_TYPE_Index"
  133. });
  134. action.ArgumentList.Add(new Argument
  135. {
  136. Name = "RequestedCount",
  137. Direction = "in",
  138. RelatedStateVariable = "A_ARG_TYPE_Count"
  139. });
  140. action.ArgumentList.Add(new Argument
  141. {
  142. Name = "SortCriteria",
  143. Direction = "in",
  144. RelatedStateVariable = "A_ARG_TYPE_SortCriteria"
  145. });
  146. action.ArgumentList.Add(new Argument
  147. {
  148. Name = "Result",
  149. Direction = "out",
  150. RelatedStateVariable = "A_ARG_TYPE_Result"
  151. });
  152. action.ArgumentList.Add(new Argument
  153. {
  154. Name = "NumberReturned",
  155. Direction = "out",
  156. RelatedStateVariable = "A_ARG_TYPE_Count"
  157. });
  158. action.ArgumentList.Add(new Argument
  159. {
  160. Name = "TotalMatches",
  161. Direction = "out",
  162. RelatedStateVariable = "A_ARG_TYPE_Count"
  163. });
  164. action.ArgumentList.Add(new Argument
  165. {
  166. Name = "UpdateID",
  167. Direction = "out",
  168. RelatedStateVariable = "A_ARG_TYPE_UpdateID"
  169. });
  170. return action;
  171. }
  172. /// <summary>
  173. /// Returns the action details for "Browse".
  174. /// </summary>
  175. /// <returns>The <see cref="ServiceAction"/>.</returns>
  176. private static ServiceAction GetBrowseAction()
  177. {
  178. var action = new ServiceAction
  179. {
  180. Name = "Browse"
  181. };
  182. action.ArgumentList.Add(new Argument
  183. {
  184. Name = "ObjectID",
  185. Direction = "in",
  186. RelatedStateVariable = "A_ARG_TYPE_ObjectID"
  187. });
  188. action.ArgumentList.Add(new Argument
  189. {
  190. Name = "BrowseFlag",
  191. Direction = "in",
  192. RelatedStateVariable = "A_ARG_TYPE_BrowseFlag"
  193. });
  194. action.ArgumentList.Add(new Argument
  195. {
  196. Name = "Filter",
  197. Direction = "in",
  198. RelatedStateVariable = "A_ARG_TYPE_Filter"
  199. });
  200. action.ArgumentList.Add(new Argument
  201. {
  202. Name = "StartingIndex",
  203. Direction = "in",
  204. RelatedStateVariable = "A_ARG_TYPE_Index"
  205. });
  206. action.ArgumentList.Add(new Argument
  207. {
  208. Name = "RequestedCount",
  209. Direction = "in",
  210. RelatedStateVariable = "A_ARG_TYPE_Count"
  211. });
  212. action.ArgumentList.Add(new Argument
  213. {
  214. Name = "SortCriteria",
  215. Direction = "in",
  216. RelatedStateVariable = "A_ARG_TYPE_SortCriteria"
  217. });
  218. action.ArgumentList.Add(new Argument
  219. {
  220. Name = "Result",
  221. Direction = "out",
  222. RelatedStateVariable = "A_ARG_TYPE_Result"
  223. });
  224. action.ArgumentList.Add(new Argument
  225. {
  226. Name = "NumberReturned",
  227. Direction = "out",
  228. RelatedStateVariable = "A_ARG_TYPE_Count"
  229. });
  230. action.ArgumentList.Add(new Argument
  231. {
  232. Name = "TotalMatches",
  233. Direction = "out",
  234. RelatedStateVariable = "A_ARG_TYPE_Count"
  235. });
  236. action.ArgumentList.Add(new Argument
  237. {
  238. Name = "UpdateID",
  239. Direction = "out",
  240. RelatedStateVariable = "A_ARG_TYPE_UpdateID"
  241. });
  242. return action;
  243. }
  244. /// <summary>
  245. /// Returns the action details for "X_BrowseByLetter".
  246. /// </summary>
  247. /// <returns>The <see cref="ServiceAction"/>.</returns>
  248. private static ServiceAction GetBrowseByLetterAction()
  249. {
  250. var action = new ServiceAction
  251. {
  252. Name = "X_BrowseByLetter"
  253. };
  254. action.ArgumentList.Add(new Argument
  255. {
  256. Name = "ObjectID",
  257. Direction = "in",
  258. RelatedStateVariable = "A_ARG_TYPE_ObjectID"
  259. });
  260. action.ArgumentList.Add(new Argument
  261. {
  262. Name = "BrowseFlag",
  263. Direction = "in",
  264. RelatedStateVariable = "A_ARG_TYPE_BrowseFlag"
  265. });
  266. action.ArgumentList.Add(new Argument
  267. {
  268. Name = "Filter",
  269. Direction = "in",
  270. RelatedStateVariable = "A_ARG_TYPE_Filter"
  271. });
  272. action.ArgumentList.Add(new Argument
  273. {
  274. Name = "StartingLetter",
  275. Direction = "in",
  276. RelatedStateVariable = "A_ARG_TYPE_BrowseLetter"
  277. });
  278. action.ArgumentList.Add(new Argument
  279. {
  280. Name = "RequestedCount",
  281. Direction = "in",
  282. RelatedStateVariable = "A_ARG_TYPE_Count"
  283. });
  284. action.ArgumentList.Add(new Argument
  285. {
  286. Name = "SortCriteria",
  287. Direction = "in",
  288. RelatedStateVariable = "A_ARG_TYPE_SortCriteria"
  289. });
  290. action.ArgumentList.Add(new Argument
  291. {
  292. Name = "Result",
  293. Direction = "out",
  294. RelatedStateVariable = "A_ARG_TYPE_Result"
  295. });
  296. action.ArgumentList.Add(new Argument
  297. {
  298. Name = "NumberReturned",
  299. Direction = "out",
  300. RelatedStateVariable = "A_ARG_TYPE_Count"
  301. });
  302. action.ArgumentList.Add(new Argument
  303. {
  304. Name = "TotalMatches",
  305. Direction = "out",
  306. RelatedStateVariable = "A_ARG_TYPE_Count"
  307. });
  308. action.ArgumentList.Add(new Argument
  309. {
  310. Name = "UpdateID",
  311. Direction = "out",
  312. RelatedStateVariable = "A_ARG_TYPE_UpdateID"
  313. });
  314. action.ArgumentList.Add(new Argument
  315. {
  316. Name = "StartingIndex",
  317. Direction = "out",
  318. RelatedStateVariable = "A_ARG_TYPE_Index"
  319. });
  320. return action;
  321. }
  322. /// <summary>
  323. /// Returns the action details for "X_SetBookmark".
  324. /// </summary>
  325. /// <returns>The <see cref="ServiceAction"/>.</returns>
  326. private static ServiceAction GetXSetBookmarkAction()
  327. {
  328. var action = new ServiceAction
  329. {
  330. Name = "X_SetBookmark"
  331. };
  332. action.ArgumentList.Add(new Argument
  333. {
  334. Name = "CategoryType",
  335. Direction = "in",
  336. RelatedStateVariable = "A_ARG_TYPE_CategoryType"
  337. });
  338. action.ArgumentList.Add(new Argument
  339. {
  340. Name = "RID",
  341. Direction = "in",
  342. RelatedStateVariable = "A_ARG_TYPE_RID"
  343. });
  344. action.ArgumentList.Add(new Argument
  345. {
  346. Name = "ObjectID",
  347. Direction = "in",
  348. RelatedStateVariable = "A_ARG_TYPE_ObjectID"
  349. });
  350. action.ArgumentList.Add(new Argument
  351. {
  352. Name = "PosSecond",
  353. Direction = "in",
  354. RelatedStateVariable = "A_ARG_TYPE_PosSec"
  355. });
  356. return action;
  357. }
  358. }
  359. }