Class FileModuleBuilder
- Namespace
- Kook
- Assembly
- Kook.Net.Core.dll
Represents a file module builder for creating a FileModule.
public class FileModuleBuilder : IModuleBuilder, IEquatable<FileModuleBuilder>, IEquatable<IModuleBuilder>
- Inheritance
-
FileModuleBuilder
- Implements
- Inherited Members
Constructors
FileModuleBuilder()
Initializes a new instance of the FileModuleBuilder class.
public FileModuleBuilder()
FileModuleBuilder(string, string?)
Initializes a new instance of the FileModuleBuilder class.
public FileModuleBuilder(string source, string? title = null)
Parameters
Properties
Source
Gets or sets the source URL of the file.
public string? Source { get; set; }
Property Value
- string
The source URL of the file.
Title
Gets or sets the title of the file.
public string? Title { get; set; }
Property Value
- string
The title of the file.
Type
Specifies the module type of the IModule this builder creates.
public ModuleType Type { get; }
Property Value
- ModuleType
A ModuleType representing the module type of the IModule this builder creates.
Methods
Build()
Builds this builder into a FileModule.
public FileModule Build()
Returns
- FileModule
A FileModule representing the built file module object.
Exceptions
- ArgumentNullException
The Source url is null.
- ArgumentException
The Source url is empty.
- InvalidOperationException
The Source url does not include a protocol (either HTTP or HTTPS).
Equals(FileModuleBuilder?)
Determines whether the specified FileModuleBuilder is equal to the current FileModuleBuilder.
public bool Equals(FileModuleBuilder? fileModuleBuilder)
Parameters
fileModuleBuilder
FileModuleBuilderThe FileModuleBuilder to compare with the current FileModuleBuilder.
Returns
- bool
true
if the specified FileModuleBuilder is equal to the current FileModuleBuilder; otherwise,false
.
Equals(object?)
Determines whether the specified FileModuleBuilder is equal to the current FileModuleBuilder.
public override bool Equals(object? obj)
Parameters
obj
objectThe object to compare with the current FileModuleBuilder.
Returns
- bool
true
if the specified FileModuleBuilder is equal to the current FileModuleBuilder; otherwise,false
.
Remarks
If the object passes is an FileModuleBuilder, Equals(FileModuleBuilder?) will be called to compare the 2 instances.
GetHashCode()
Serves as the default hash function.
public override int GetHashCode()
Returns
- int
A hash code for the current object.
WithSource(string?)
Sets the source URL of the file.
public FileModuleBuilder WithSource(string? source)
Parameters
source
stringThe source URL of the file to be set.
Returns
- FileModuleBuilder
The current builder.
WithTitle(string)
Sets the title of the file.
public FileModuleBuilder WithTitle(string title)
Parameters
title
stringThe title of the file to be set.
Returns
- FileModuleBuilder
The current builder.
Operators
operator ==(FileModuleBuilder?, FileModuleBuilder?)
Determines whether the specified FileModuleBuilder is equal to the current FileModuleBuilder.
public static bool operator ==(FileModuleBuilder? left, FileModuleBuilder? right)
Parameters
left
FileModuleBuilderright
FileModuleBuilder
Returns
- bool
true
if the specified FileModuleBuilder is equal to the current FileModuleBuilder; otherwise,false
.
operator !=(FileModuleBuilder?, FileModuleBuilder?)
Determines whether the specified FileModuleBuilder is not equal to the current FileModuleBuilder.
public static bool operator !=(FileModuleBuilder? left, FileModuleBuilder? right)
Parameters
left
FileModuleBuilderright
FileModuleBuilder
Returns
- bool
true
if the specified FileModuleBuilder is not equal to the current FileModuleBuilder; otherwise,false
.