'  
'   Rebex Sample Code License
' 
'   Copyright 2026, REBEX CR s.r.o.
'   All rights reserved.
'   https://www.rebex.net/
' 
'   Permission to use, copy, modify, and/or distribute this software for any
'   purpose with or without fee is hereby granted.
' 
'   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
'   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
'   OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
'   NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
'   HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
'   WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
'   FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
'   OTHER DEALINGS IN THE SOFTWARE.
' 

Imports System
Imports System.Collections.Generic
Imports System.Text
Imports Rebex.IO.Compression

''' <summary>
''' Command line arguments parser and storage.
''' </summary>
Public Class Arguments
    ''' <summary>
    ''' Parses the command line and creates the instance of Arguments class
    ''' </summary>
    ''' <param name="args">Command line arguments.</param>
    Public Sub New(ByVal args As String())
        If args.Length = 0 Then
            Throw New SampleException("Archive name is missing.")
        End If

        If args.Length > 2 Then
            Throw New SampleException("Too many arguments.")
        End If

        _zipArchivePath = args(0)

        If args.Length = 2 Then
            _sourcePath = args(1)
        End If
    End Sub

    ''' <summary>
    ''' Path to the ZIP archive on the disk.
    ''' </summary>
    Public ReadOnly Property ZipArchivePath() As String
        Get
            Return _zipArchivePath
        End Get
    End Property
    Private _zipArchivePath As String

    ''' <summary>
    ''' Specifies which files will be added. Supported wildcards: '*' and '?'.
    ''' </summary>
    ''' <example>"C:\data", "C:\file.txt", "C:\*.txt", "data", "file.txt", "*.txt", "*", etc.</example>
    Public ReadOnly Property SourcePath() As String
        Get
            Return _sourcePath
        End Get
    End Property
    Private _sourcePath As String = "*"

End Class
