⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 constructors.cls

📁 VB 加密----------能够加密解密控件
💻 CLS
📖 第 1 页 / 共 5 页
字号:
Public Function NewResourceReader(ByRef Source As Variant) As ResourceReader
    Set NewResourceReader = New ResourceReader
    Call NewResourceReader.Init(Source)
End Function

''
' Provides a method to create a new .RES file.
'
' @param Source A .RES filename or Stream.
' @return A ResourceWriter used to create a resource file.
'
Public Function NewResourceWriter(ByRef Source As Variant) As ResourceWriter
    Set NewResourceWriter = New ResourceWriter
    Call NewResourceWriter.Init(Source)
End Function

' for internal use only
Friend Function NewRegistryKey(ByVal Key As Long, ByVal Name As String, ByVal Writable As Boolean) As RegistryKey
    Set NewRegistryKey = New RegistryKey
    Call NewRegistryKey.Init(Key, Name, Writable)
End Function

''
' Allows for quickly creating a cDateTime object from a VB Date value.
'
' @param Value The date of the new cDateTime.
' @param Kind Specifies whether the cDateTime is a UTC, Local, or unspecified time type.
' @return A cDateTime object.
'
Public Function NewDate(ByVal Value As Date, Optional ByVal Kind As DateTimeKind = UnspecifiedKind) As cDateTime
    Set NewDate = modStaticClasses.cDateTime.FromOADate(Value, Kind)
End Function

''
' Creates a new set of resources for a specific culture.
'
' @param CultureID The specific culture to retrieve resources for.
' @param Source A .RES filename, IResourceReader, or Stream object.
' @return A new ResourceSet.
'
Public Function NewResourceSet(ByVal CultureID As Variant, ByRef Source As Variant) As ResourceSet
    Set NewResourceSet = New ResourceSet
    Call NewResourceSet.Init(CultureID, Source)
End Function

''
' Loads all resources from a source for all cultures in the source.
'
' @param Source A .RES file, IResourceReader or Stream to read all resources from.
' @return A new ResourceManager object.
' @remarks If a set of resource files is to be loaded into a resource manager
' then use the <b>ResourceManager.CreateFileBasedResourceManager</b> method.
'
' @see ResourceManager
' @see ResourceManagerStatic
'
Public Function NewResourceManager(ByRef Source As Variant) As ResourceManager
    Set NewResourceManager = New ResourceManager
    Call NewResourceManager.InitFromFile(Source)
End Function

''
' Creates a new Hashtable object with specific settings.
'
' @param d An IDictionary object containing keys and values to be added to the Hashtable.
' @param hcp A hashcode generator used in place of the default hashcode algorithm.
' @param Comparer A custom comparer used to compare specific values.
' @return A new Hashtable object.
'
Public Function NewHashtable(Optional ByVal d As IDictionary, Optional ByVal hcp As IHashcodeProvider, Optional ByVal Comparer As IComparer) As Hashtable
    Set NewHashtable = New Hashtable
    Call NewHashtable.InitDictionary(d, hcp, Comparer)
End Function

''
' Creates a new WinResourceReader reader object.
'
' @param FileName The path and name of the EXE or DLL from which to read the resources.
' @return A new WinResourceReader object.
'
Public Function NewWinResourceReader(ByVal FileName As String) As WinResourceReader
    Set NewWinResourceReader = New WinResourceReader
    Call NewWinResourceReader.Init(FileName)
End Function

''
' Creates a new DriveInfo object used to inspect a drive's information.
'
' @param Name The name of the drive (C:\, \\Server\Share).
' @return A <b>DriveInfo</b> object representing the specified drive.
'
Public Function NewDriveInfo(ByVal Name As String) As DriveInfo
    Set NewDriveInfo = New DriveInfo
    Call NewDriveInfo.Init(Name)
End Function

''
' Returns a new ConsoleKeyInfo object that represents the state of a key press.
'
' @param KeyChar The Asc value of the key pressed.
' @param Key The key code of the pressed key.
' @param Shift Whether the shift key was pressed.
' @param Alt Wheter the alt key was pressed.
' @param Control Whether the control key was pressed.
' @return A new ConsoleKeyInfo object.
'
Public Function NewConsoleKeyInfo(ByVal KeyChar As Integer, ByVal Key As ConsoleKey, ByVal Shift As Boolean, ByVal Alt As Boolean, ByVal Control As Boolean) As ConsoleKeyInfo
    Set NewConsoleKeyInfo = New ConsoleKeyInfo
    Call NewConsoleKeyInfo.Init(KeyChar, Key, Shift, Alt, Control)
End Function

''
' Returns a new TimeSpan representing the time portion of the date.
'
' @param DateValue The date to retrieve the time portion of.
' @return A TimeSpan object representing the time portion.
'
Public Function NewTime(ByVal DateValue As Variant) As TimeSpan
    Select Case VarType(DateValue)
        Case vbDate:    Set NewTime = NewTimeSpan(, Hour(DateValue), Minute(DateValue), Second(DateValue))
        Case Else:      Set NewTime = cDateTime.GetcDateTime(DateValue).TimeOfDay
    End Select
End Function

''
' Returns an object used to manipulate an INI file.
'
' @param FileName The INI filename.
' @return The INIFile object.
'
Public Function NewINIFile(ByVal FileName As String) As INIFile
    Set NewINIFile = New INIFile
    Call NewINIFile.Init(FileName)
End Function

''
' Creates a new Ticker.
'
' @param Interval The delay between events in milliseconds.
' @param Data A user supplied value to be associated with the timer.
' @param AutoReset <b>True</b> to have the timer event recur, <b>False</b> for one event.
' @param AddressOfCallback An address to a callback method that can be called when the timer has elapsed.
' Setting this to zero will stop the callback.
' @return A new Ticker object.
' @remarks A callback method is used to allow a timer object to
' notify the function without having to use an Event. A function callback
' must have the following signature, or the application may crash.
' <pre>
' Public Sub TickerCallback(ByRef Ticker As Ticker, ByRef Data As Variant)
'     ' do stuff
' End Sub
' </pre>
' The two parameters must be declared as ByRef.
'
Public Function NewTicker(ByVal Interval As Long, Optional ByVal Data As Variant, Optional ByVal AutoReset As Boolean = True, Optional ByVal AddressOfCallback As Long) As Ticker
    Set NewTicker = New Ticker
    Call NewTicker.Init(Interval, Data, AutoReset, AddressOfCallback)
End Function

''
' Creates an array of values.
'
' @param arraytype The target datatype of the resultant array and the values to be converted to.
' @param arrayelements The values to be put into the new array.
' @return An array of the specified datatype and containing the array elements with conversion,
' or an empty array if no elements are defined.
' <p>Elements of a size that are a multiple of 4 will not create a new array
' when being returned. All other datatype sizes will cause a new array
' to be created.</p>
'
Public Function NewArray(ByVal ArrayType As ciArrayTypes, ParamArray ArrayElements() As Variant) As Variant
    Dim args() As Variant
    Call Helper.Swap4(ByVal ArrPtr(args), ByVal Helper.DerefEBP(16))
    NewArray = cArray.InternalNewArray(ArrayType, args)
End Function

''
' Creates a new base utility class that can be contained within an exception class.
'
' @param Subclass The containing exception class that will contain this object instance.
' @param AppTitle The title of the application that contains the exception class.
' @param Message An understandable message that describes the exception being thrown.
' @param InnerException The exception that caused the current exception to be thrown.
' @param HResult The error code for the current exception.
' @param Source A description of the source of the current exception.
' @param HelpLink A file or URL link to a help resource.
' @return A new base class used for default handling of exception routines.
' @remarks Most exception classes simply contain this information to be retrieved for
' viewing. Few exception classes have additional requirements. This class can be used
' to handle the default set of information for an exception class. By containing this
' class inside the exception class, the exception class can delegate calls to this class
' for standard handling.
' <p>If additional values need to be maintained, then this class also supports the ability
' to set and get additional values using a String name as the key. The <b>ArgumentException</b>
' class uses this to hold the name of the parameter that caused the exception.</p>
' <p>This class is persistable and will also attempt to persist the custom values that
' have been added to it. If the persistence fails, then an error will occur.</p>
'
Public Function NewExceptionBase(Optional ByVal Subclass As Object, Optional ByVal AppTitle As String, Optional ByVal Message As String, Optional ByVal InnerException As Exception, Optional ByVal HResult As Long = 5, Optional ByVal Source As String, Optional ByVal HelpLink As String) As ExceptionBase
    Set NewExceptionBase = New ExceptionBase
    Call NewExceptionBase.Init(Subclass, AppTitle, Message, InnerException, HResult, Source, HelpLink)
End Function

''
' Creates a new Queue initialized with the elements in the collection.
'
' @param Col The elements to place in the queue upon creation.
' @return A Queue object with the elements placed in it.
' @remarks The <i>Col</i> parameter can be a VBA.Collection, ICollection object or an Array.
'
Public Function NewQueue(ByRef Col As Variant) As Queue
    Set NewQueue = New Queue
    Call NewQueue.Init(Col)
End Function

''
' Creates a new object used to uniquely identify a resource.
'
' @param Name The name of the resource being identified.
' @param ResourceType The type of resource being identified.
' @param LanguageID The Locale ID associated with the resource.
' @return An object that can be used to uniquely identify a resource.
' @remarks Name and ResourceType can be a string or number.
'
Public Function NewResourceKey(ByRef Name As Variant, ByRef ResourceType As Variant, ByVal LanguageID As Long) As ResourceKey
    Set NewResourceKey = New ResourceKey
    Call NewResourceKey.Init(Name, ResourceType, LanguageID)
End Function

''
' Creates a picture group object used to contain information
' about resources that are grouped together.
'
' @param GroupType The type of resource the group represents.
' @return A group of container for a specific resource type.
'
Public Function NewResPictureGroup(ByVal GroupType As PictureGroupTypes) As ResPictureGroup
    Set NewResPictureGroup = New ResPictureGroup
    Call NewResPictureGroup.InitNew(GroupType)
End Function

''
' Creates a new ExternalException object.
'
' @param Message A user-defined message specific to the exception.
' @param InnerException A reference to an exception that caused this exception.
' @return A new ExternalException object.
'
Public Function NewExternalException(ByVal Message As String, Optional ByVal InnerException As Exception) As ExternalException
    Set NewExternalException = New ExternalException
    Call NewExternalException.Init(Message, InnerException)
End Function

''
' Creates a new CspParameters object.
'
' @param TypeIn The type code used to specify the kind of provider to create.
' @param ProviderNameIn The provider name.
' @param ContainerNameIn The provider container name.
' @return Returns a new CspParameters object.
'
Public Function NewCspParameters(ByVal TypeIn As Long, Optional ByVal ProviderNameIn As String, Optional ByVal ContainerNameIn As String) As CspParameters
    Set NewCspParameters = New CspParameters
    Call NewCspParameters.Init(TypeIn, ProviderNameIn, ContainerNameIn)
End Function

''
' Creates a new random number generator that uses a crypto service provider to generate random numbers.
'
' @param CspParams Parameters used to allow a specific crypto service provider to be used instead of the default.
' @return A new RNGCryptoServiceProvider object that generated random numbers using a crypto service provider.
' @remarks Crypto service providers generally produce a more random set of numbers than the standard
' Windows API set of random number generators. This is because cryptography depends a great deal on
' go random number generation to be effective.
' <p>The default provider will be one of Microsoft's cryptography service providers such as
' "Microsoft Base Cryptographic Provider v1.0" or "Microsoft Enhanced Cryptographic Provider v1.0."</p>
' <p>Using the <b>CspParams</b> allows for a specific or custom provider to be used instead of the
' Microsoft providers.</p>
' @see RNGCryptoServiceProvider
'
Public Function NewRNGCryptoServiceProvider(ByVal CspParams As CspParameters) As RNGCryptoServiceProvider
    Set NewRNGCryptoServiceProvider = New RNGCryptoServiceProvider
    Call NewRNGCryptoServiceProvider.Init(CspParams)
End Function

''
' Creates a new CryptographicException object.
'
' @param Message The message contained within the exception object.
' @param InnerException A reference to an exception that may have cause this exception to occur.
' @return A new CryptoGraphicException object.
' @remarks Most of the exceptions that occur within the cryptography set of classes will be
' a CryptographicException.
' @see CryptographicException
'
Public Function NewCryptographicException(ByVal Message As String, Optional ByVal InnerException As Exception) As CryptographicException
    Set NewCryptographicException = New CryptographicException
    Call NewCryptographicException.Init(Message, InnerException)
End Function

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -