Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ' ***********************************************************************
- ' Author : Elektro
- ' Modified : 17-December-2015
- ' ***********************************************************************
- #Region " Imports "
- Imports System
- Imports System.ComponentModel
- Imports System.Diagnostics
- Imports System.Linq
- #End Region
- #Region " INI Key "
- Namespace Types
- ''' ----------------------------------------------------------------------------------------------------
- ''' <summary>
- ''' Represents a initialization file (INI) key.
- ''' </summary>
- ''' ----------------------------------------------------------------------------------------------------
- Public NotInheritable Class IniKey
- #Region " Properties "
- ''' ----------------------------------------------------------------------------------------------------
- ''' <summary>
- ''' Gets or sets the key name.
- ''' </summary>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <value>
- ''' The key name.
- ''' </value>
- ''' ----------------------------------------------------------------------------------------------------
- Public Property Name As String
- ''' ----------------------------------------------------------------------------------------------------
- ''' <summary>
- ''' Gets or sets the key value.
- ''' </summary>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <value>
- ''' The key value.
- ''' </value>
- ''' ----------------------------------------------------------------------------------------------------
- Public Property Value As String
- ''' ----------------------------------------------------------------------------------------------------
- ''' <summary>
- ''' Gets or sets the key comment-line.
- ''' </summary>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <value>
- ''' The key comment-line.
- ''' </value>
- ''' ----------------------------------------------------------------------------------------------------
- Public Property CommentLine As String
- #End Region
- #Region " Constructors "
- ''' ----------------------------------------------------------------------------------------------------
- ''' <summary>
- ''' Prevents a default instance of the <see cref="IniKey"/> class from being created.
- ''' </summary>
- ''' ----------------------------------------------------------------------------------------------------
- <DebuggerNonUserCode>
- Private Sub New()
- End Sub
- ''' ----------------------------------------------------------------------------------------------------
- ''' <summary>
- ''' Initializes a new instance of the <see cref="IniKey"/> class.
- ''' </summary>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <param name="name">
- ''' The key name.
- ''' </param>
- ''' ----------------------------------------------------------------------------------------------------
- <DebuggerStepThrough>
- Public Sub New(ByVal name As String)
- Me.New(name, "", "")
- End Sub
- ''' ----------------------------------------------------------------------------------------------------
- ''' <summary>
- ''' Initializes a new instance of the <see cref="IniKey"/> class.
- ''' </summary>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <param name="name">
- ''' The key name.
- ''' </param>
- '''
- ''' <param name="value">
- ''' The key value.
- ''' </param>
- '''
- ''' <param name="comment">
- ''' The key commentary-line.
- ''' </param>
- ''' ----------------------------------------------------------------------------------------------------
- ''' <exception cref="System.ArgumentNullException">
- ''' name
- ''' </exception>
- '''
- ''' <exception cref="System.ArgumentException">
- ''' The key name cannot contain the ';' symbol because it identifies a commentary line.,name
- ''' or
- ''' The key name cannot contain the '=' symbol because it delimits the name from the value.,name
- ''' </exception>
- ''' ----------------------------------------------------------------------------------------------------
- <DebuggerStepThrough>
- Public Sub New(ByVal name As String, ByVal value As String, Optional ByVal comment As String = "")
- If (String.IsNullOrEmpty(name)) Then
- Throw New ArgumentNullException(paramName:="name")
- ElseIf (name.Contains(";"c)) Then
- Throw New ArgumentException(
- message:="The key name cannot contain the ';' symbol because it identifies a commentary line.",
- paramName:="name")
- ElseIf (name.Contains("="c)) Then
- Throw New ArgumentException(
- message:="The key name cannot contain the '=' symbol because it delimits the name from the value.",
- paramName:="name")
- Else
- Me.Name = name
- Me.Value = value
- Me.CommentLine = comment
- End If
- End Sub
- #End Region
- End Class
- End Namespace
- #End Region
Add Comment
Please, Sign In to add comment