ShareInfo0Container.cs 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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_0_CONTAINER
  16. /// </summary>
  17. public class ShareInfo0Container : IShareInfoContainer
  18. {
  19. public NDRConformantArray<ShareInfo0Entry> Entries = new NDRConformantArray<ShareInfo0Entry>();
  20. public ShareInfo0Container()
  21. {
  22. }
  23. public ShareInfo0Container(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<ShareInfo0Entry>>(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 0;
  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(ShareInfo0Entry entry)
  63. {
  64. Entries.Add(entry);
  65. }
  66. }
  67. }