You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

DfsStorageInfo.cs 3.6 KiB

пре 8 година
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. /* Copyright (C) 2008-2016 Peter Palotas, Jeffrey Jangli, Alexandr Normuradov
  2. *
  3. * Permission is hereby granted, free of charge, to any person obtaining a copy
  4. * of this software and associated documentation files (the "Software"), to deal
  5. * in the Software without restriction, including without limitation the rights
  6. * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  7. * copies of the Software, and to permit persons to whom the Software is
  8. * furnished to do so, subject to the following conditions:
  9. *
  10. * The above copyright notice and this permission notice shall be included in
  11. * all copies or substantial portions of the Software.
  12. *
  13. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  14. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  15. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  16. * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  17. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  18. * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  19. * THE SOFTWARE.
  20. */
  21. using System.Diagnostics.CodeAnalysis;
  22. namespace Alphaleonis.Win32.Network
  23. {
  24. /// <summary>Contains information about a DFS root or link target in a DFS namespace or from the cache maintained by the DFS client.
  25. /// <para>This class cannot be inherited.</para>
  26. /// </summary>
  27. [SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Dfs")]
  28. public sealed class DfsStorageInfo
  29. {
  30. #region Constructor
  31. /// <summary>Initializes a new instance of the <see cref="DfsStorageInfo"/> class, which acts as a wrapper for a DFS root or link target.</summary>
  32. public DfsStorageInfo()
  33. {
  34. }
  35. /// <summary>Initializes a new instance of the <see cref="DfsStorageInfo"/> class, which acts as a wrapper for a DFS root or link target.</summary>
  36. /// <param name="structure">An initialized <see cref="NativeMethods.DFS_STORAGE_INFO_1"/> instance.</param>
  37. internal DfsStorageInfo(NativeMethods.DFS_STORAGE_INFO_1 structure)
  38. {
  39. ServerName = structure.ServerName;
  40. ShareName = structure.ShareName;
  41. State = structure.State;
  42. TargetPriorityClass = structure.TargetPriority.TargetPriorityClass;
  43. TargetPriorityRank = structure.TargetPriority.TargetPriorityRank;
  44. }
  45. #endregion // Constructor
  46. #region Methods
  47. /// <summary>The share name of the DFS root target or link target.</summary>
  48. /// <returns>A string that represents this instance.</returns>
  49. public override string ToString()
  50. {
  51. return ShareName;
  52. }
  53. #endregion // Methods
  54. #region Properties
  55. /// <summary>The server name of the DFS root target or link target.</summary>
  56. public string ServerName { get; private set; }
  57. /// <summary>The share name of the DFS root target or link target.</summary>
  58. public string ShareName { get; private set; }
  59. /// <summary>An <see cref="DfsStorageStates"/> enum of the DFS root target or link target.</summary>
  60. public DfsStorageStates State { get; private set; }
  61. /// <summary>Contains a DFS target's priority class and rank.</summary>
  62. public DfsTargetPriorityClass TargetPriorityClass { get; private set; }
  63. /// <summary>Specifies the priority rank value of the target. The default value is 0, which indicates the highest priority rank within a priority class.</summary>
  64. public int TargetPriorityRank { get; private set; }
  65. #endregion // Properties
  66. }
  67. }