' Copyright (C) 2023 Andy https://github.com/AAndyProgram
' This program is free software: you can redistribute it and/or modify
' it under the terms of the GNU General Public License as published by
' the Free Software Foundation, either version 3 of the License, or
' (at your option) any later version.
'
' This program is distributed in the hope that it will be useful,
' but WITHOUT ANY WARRANTY
Imports System.Runtime.CompilerServices
Namespace Plugin.Attributes
''' Create a control for a property
Public NotInheritable Class PropertyOption : Inherits Attribute
''' Property name
Public ReadOnly Property Name As String
''' Property value type
Public Property [Type] As Type
Private _ControlText As String
''' This text will be displayed on the control information.
Default: equals the name (property name)
Public Property ControlText As String
Get
Return If(String.IsNullOrEmpty(_ControlText), Name, _ControlText)
End Get
Set(ByVal NewText As String)
_ControlText = NewText
End Set
End Property
''' This tooltip will be displayed on the control.
Default:
Public Property ControlToolTip As String
''' CheckBox ThreeStates mode
Public Property ThreeStates As Boolean = False
''' Property allows null values
Public Property AllowNull As Boolean = True
''' Offset the control from the left border of the form.
Default: 100
Public Property LeftOffset As Integer = 100
''' This control is an information label.
Default:
Public Property IsInformationLabel As Boolean = False
''' Label text alignment.
Default:
Public Property LabelTextAlign As Drawing.ContentAlignment = Drawing.ContentAlignment.TopCenter
''' This is an authorization property
Public Property IsAuth As Boolean = False
''' Initialize a new property option attribute
''' Property name
Public Sub New( Optional ByVal PropertyName As String = Nothing)
Name = PropertyName
End Sub
End Class
''' Store property value in settings XML file
Public NotInheritable Class PXML : Inherits Attribute
Public ReadOnly ElementName As String
''' Initialize a new XML attribute
''' XML element name
Public Sub New( Optional ByVal XMLElementName As String = Nothing)
ElementName = XMLElementName
End Sub
End Class
''' Attribute to disable some properties for host use
Public NotInheritable Class DoNotUse : Inherits Attribute
End Class
''' Special property updater
Public NotInheritable Class PropertyUpdater : Inherits Attribute
Public ReadOnly Name As String
Public ReadOnly Dependencies As String()
'''
Public Sub New(ByVal UpdatingPropertyName As String)
Name = UpdatingPropertyName
End Sub
''' Initialize a new PropertyUpdater attribute
''' The name of the property to be updated
Public Sub New(ByVal UpdatingPropertyName As String, ByVal Dependent As String())
Name = UpdatingPropertyName
Dependencies = Dependent
End Sub
End Class
''' Plugin key
Public NotInheritable Class Manifest : Inherits Attribute
Public ReadOnly GUID As String
''' Initialize a new Manifest attribute
''' Plugin key
Public Sub New(ByVal ClassGuid As String)
GUID = ClassGuid
End Sub
End Class
''' Special form attribute for settings forms and user creator form
Public NotInheritable Class SpecialForm : Inherits Attribute
Public ReadOnly SettingsForm As Boolean
''' Initialize a new SpecialForm attribute
'''
''' - for setting form
''' - for user creator form
'''
Public Sub New(ByVal IsSettingsForm As Boolean)
SettingsForm = IsSettingsForm
End Sub
End Class
''' Property provider
Public NotInheritable Class Provider : Inherits Attribute
Public ReadOnly Name As String
'''
''' - form field validation provider. Must return null if the value is invalid.
''' - only for conversion
'''
Public FieldsChecker As Boolean = False
''' Interaction with changing text field. Default:
Public Interaction As Boolean = False
''' Initialize a new Provider attribute. is only allowed
''' The name of the property for which this provider is used
Public Sub New(ByVal PropertyName As String)
Name = PropertyName
End Sub
End Class
''' Sort attribute for settings form
Public NotInheritable Class ControlNumber : Inherits Attribute
Public ReadOnly PropertyNumber As String
''' Initialize a new sort attribute instance for the settings form
''' Object position number in the settings form
Public Sub New(ByVal Number As Integer)
PropertyNumber = Number
End Sub
End Class
''' Attribute for properties values validation methods
Public NotInheritable Class PropertiesDataChecker : Inherits Attribute
Public ReadOnly ComparableNames As String()
''' Initialize a new PropertiesDataChecker attribute.
''' Array of the property names
Public Sub New(ByVal Names As String())
ComparableNames = Names
End Sub
End Class
''' This attribute specifies that users should be downloaded on a separate thread.
Public NotInheritable Class SeparatedTasks : Inherits Attribute
Public ReadOnly TasksCount As Integer
''' Initialize a new SeparatedTasks attribute.
'''
''' Predefined task counter.
''' will take precedence if it is defined.
'''
Public Sub New(Optional ByVal TasksCount As Integer = -1)
Me.TasksCount = TasksCount
End Sub
End Class
''' A property attribute that specifies how many users should be downloaded at the same time in one thread
Public NotInheritable Class TaskCounter : Inherits Attribute
End Class
'''
''' This attribute cannot be combined with .
''' If set to , this attribute will be ignored
'''
'''
Public NotInheritable Class TaskGroup : Inherits Attribute
Public ReadOnly Name As String
''' Initialize a new TaskGroup attribute.
''' Group name
Public Sub New(ByVal Name As String)
Me.Name = Name
End Sub
End Class
''' This attribute indicates that the plugin has a SavedPosts environment
Public NotInheritable Class SavedPosts : Inherits Attribute
End Class
''' This is an attribute of the UserData instance. Specifies that the default internal SCrawler downloader should be used.
Public NotInheritable Class UseInternalDownloader : Inherits Attribute
End Class
''' GitHub plugin info
Public NotInheritable Class Github : Inherits Attribute
Public ReadOnly UserName As String
Public ReadOnly Repository As String
''' Initialize a new Github attribute.
''' Developer GitHub username
''' Plugin repository name
Public Sub New(ByVal Name As String, ByVal RepoName As String)
UserName = Name
Repository = RepoName
End Sub
End Class
End Namespace