SmbShareInfo.cs 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. // This code is derived from jcifs smb client library <jcifs at samba dot org>
  2. // Ported by J. Arturo <webmaster at komodosoft dot net>
  3. //
  4. // This library is free software; you can redistribute it and/or
  5. // modify it under the terms of the GNU Lesser General Public
  6. // License as published by the Free Software Foundation; either
  7. // version 2.1 of the License, or (at your option) any later version.
  8. //
  9. // This library is distributed in the hope that it will be useful,
  10. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12. // Lesser General Public License for more details.
  13. //
  14. // You should have received a copy of the GNU Lesser General Public
  15. // License along with this library; if not, write to the Free Software
  16. // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  17. using SharpCifs.Util;
  18. namespace SharpCifs.Smb
  19. {
  20. public class SmbShareInfo : IFileEntry
  21. {
  22. protected internal string NetName;
  23. protected internal int Type;
  24. protected internal string Remark;
  25. public SmbShareInfo()
  26. {
  27. }
  28. public SmbShareInfo(string netName, int type, string remark)
  29. {
  30. this.NetName = netName;
  31. this.Type = type;
  32. this.Remark = remark;
  33. }
  34. public virtual string GetName()
  35. {
  36. return NetName;
  37. }
  38. public new virtual int GetType()
  39. {
  40. switch (Type & unchecked(0xFFFF))
  41. {
  42. case 1:
  43. {
  44. return SmbFile.TypePrinter;
  45. }
  46. case 3:
  47. {
  48. return SmbFile.TypeNamedPipe;
  49. }
  50. }
  51. return SmbFile.TypeShare;
  52. }
  53. public virtual int GetAttributes()
  54. {
  55. return SmbFile.AttrReadonly | SmbFile.AttrDirectory;
  56. }
  57. public virtual long CreateTime()
  58. {
  59. return 0L;
  60. }
  61. public virtual long LastModified()
  62. {
  63. return 0L;
  64. }
  65. public virtual long Length()
  66. {
  67. return 0L;
  68. }
  69. public override bool Equals(object obj)
  70. {
  71. if (obj is SmbShareInfo)
  72. {
  73. SmbShareInfo si = (SmbShareInfo)obj;
  74. return NetName.Equals(si.NetName);
  75. }
  76. return false;
  77. }
  78. public override int GetHashCode()
  79. {
  80. int hashCode = NetName.GetHashCode();
  81. return hashCode;
  82. }
  83. public override string ToString()
  84. {
  85. return "SmbShareInfo[" + "netName=" + NetName + ",type=0x" + Hexdump.ToHexString
  86. (Type, 8) + ",remark=" + Remark + "]";
  87. }
  88. }
  89. }