Advertisement
Guest User

Untitled

a guest
Dec 17th, 2015
186
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 4.74 KB | None | 0 0
  1. ' ***********************************************************************
  2. ' Author   : Elektro
  3. ' Modified : 17-December-2015
  4. ' ***********************************************************************
  5.  
  6. #Region " Imports "
  7.  
  8. Imports System
  9. Imports System.ComponentModel
  10. Imports System.Diagnostics
  11. Imports System.Linq
  12.  
  13. #End Region
  14.  
  15. #Region " INI Section "
  16.  
  17. Namespace Types
  18.  
  19.     ''' ----------------------------------------------------------------------------------------------------
  20.     ''' <summary>
  21.     ''' Represents a initialization file (INI) section.
  22.     ''' </summary>
  23.     ''' ----------------------------------------------------------------------------------------------------
  24.     Public NotInheritable Class IniSection
  25.  
  26. #Region " Properties "
  27.  
  28.         ''' ----------------------------------------------------------------------------------------------------
  29.         ''' <summary>
  30.         ''' Gets or sets the section name.
  31.         ''' </summary>
  32.         ''' ----------------------------------------------------------------------------------------------------
  33.         ''' <value>
  34.         ''' The section name.
  35.         ''' </value>
  36.         ''' ----------------------------------------------------------------------------------------------------
  37.         Public Property Name As String
  38.  
  39.         ''' ----------------------------------------------------------------------------------------------------
  40.         ''' <summary>
  41.         ''' Gets or sets the section keys.
  42.         ''' </summary>
  43.         ''' ----------------------------------------------------------------------------------------------------
  44.         ''' <value>
  45.         ''' The section keys.
  46.         ''' </value>
  47.         ''' ----------------------------------------------------------------------------------------------------
  48.         Public Property Keys As IniKeyCollection
  49.  
  50. #End Region
  51.  
  52. #Region " Constructors "
  53.  
  54.         ''' ----------------------------------------------------------------------------------------------------
  55.         ''' <summary>
  56.         ''' Prevents a default instance of the <see cref="IniSection"/> class from being created.
  57.         ''' </summary>
  58.         ''' ----------------------------------------------------------------------------------------------------
  59.         <DebuggerNonUserCode>
  60.         Private Sub New()
  61.         End Sub
  62.  
  63.         ''' ----------------------------------------------------------------------------------------------------
  64.         ''' <summary>
  65.         ''' Initializes a new instance of the <see cref="IniSection"/> class.
  66.         ''' </summary>
  67.         ''' ----------------------------------------------------------------------------------------------------
  68.         ''' <param name="name">
  69.         ''' The section name.
  70.         ''' </param>
  71.         ''' ----------------------------------------------------------------------------------------------------
  72.         <DebuggerStepThrough>
  73.         Public Sub New(ByVal name As String)
  74.  
  75.             Me.New(name, New IniKeyCollection)
  76.  
  77.         End Sub
  78.  
  79.         ''' ----------------------------------------------------------------------------------------------------
  80.         ''' <summary>
  81.         ''' Initializes a new instance of the <see cref="IniSection"/> class.
  82.         ''' </summary>
  83.         ''' ----------------------------------------------------------------------------------------------------
  84.         ''' <param name="name">
  85.         ''' The section name.
  86.         ''' </param>
  87.         '''
  88.         ''' <param name="keys">
  89.         ''' The section keys.
  90.         ''' </param>
  91.         ''' ----------------------------------------------------------------------------------------------------
  92.         ''' <exception cref="System.ArgumentNullException">
  93.         ''' name
  94.         ''' </exception>
  95.         '''
  96.         ''' <exception cref="System.ArgumentException">
  97.         ''' The section name cannot contain the '[' or ']' symbols because it identifies a section.,name
  98.         ''' </exception>
  99.         ''' ----------------------------------------------------------------------------------------------------
  100.         <DebuggerStepThrough>
  101.         Public Sub New(ByVal name As String, ByVal keys As IniKeyCollection)
  102.  
  103.             If (String.IsNullOrEmpty(name)) Then
  104.                 Throw New ArgumentNullException(paramName:="name")
  105.  
  106.             ElseIf (name.Contains("["c)) OrElse (name.Contains("]"c)) Then
  107.                 Throw New ArgumentException(
  108.                     message:="The section name cannot contain the '[' or ']' symbols because it identifies a section.",
  109.                     paramName:="name")
  110.  
  111.             Else
  112.                 Me.Name = name
  113.                 Me.Keys = keys
  114.  
  115.             End If
  116.  
  117.         End Sub
  118.  
  119. #End Region
  120.  
  121.     End Class
  122.  
  123. End Namespace
  124.  
  125. #End Region
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement