ShareInfo1Container.cs 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. /* Copyright (C) 2014 Tal Aloni <tal.aloni.il@gmail.com>. All rights reserved.
  2. *
  3. * You can redistribute this program and/or modify it under the terms of
  4. * the GNU Lesser Public License as published by the Free Software Foundation,
  5. * either version 3 of the License, or (at your option) any later version.
  6. */
  7. using System;
  8. using System.Collections.Generic;
  9. using System.Text;
  10. using SMBLibrary.RPC;
  11. using Utilities;
  12. namespace SMBLibrary.Services
  13. {
  14. /// <summary>
  15. /// [MS-SRVS] SHARE_INFO_1_CONTAINER
  16. /// </summary>
  17. public class ShareInfo1Container : IShareInfoContainer
  18. {
  19. public NDRConformantArray<ShareInfo1Entry> Entries;
  20. public ShareInfo1Container()
  21. {
  22. }
  23. public ShareInfo1Container(NDRParser parser)
  24. {
  25. Read(parser);
  26. }
  27. public void Read(NDRParser parser)
  28. {
  29. parser.BeginStructure();
  30. uint count = parser.ReadUInt32();
  31. parser.ReadEmbeddedStructureFullPointer<NDRConformantArray<ShareInfo1Entry>>(ref Entries);
  32. parser.EndStructure();
  33. }
  34. public void Write(NDRWriter writer)
  35. {
  36. writer.BeginStructure();
  37. writer.WriteUInt32((uint)this.Count);
  38. writer.WriteEmbeddedStructureFullPointer(Entries);
  39. writer.EndStructure();
  40. }
  41. public uint Level
  42. {
  43. get
  44. {
  45. return 1;
  46. }
  47. }
  48. public int Count
  49. {
  50. get
  51. {
  52. if (Entries != null)
  53. {
  54. return Entries.Count;
  55. }
  56. else
  57. {
  58. return 0;
  59. }
  60. }
  61. }
  62. public void Add(ShareInfo1Entry entry)
  63. {
  64. if (Entries == null)
  65. {
  66. Entries = new NDRConformantArray<ShareInfo1Entry>();
  67. }
  68. Entries.Add(entry);
  69. }
  70. }
  71. }