Class CountdownModuleBuilder
- Namespace
- Kook
- Assembly
- Kook.Net.Core.dll
Represents a countdown module builder for creating a CountdownModule.
public class CountdownModuleBuilder : IModuleBuilder, IEquatable<CountdownModuleBuilder>, IEquatable<IModuleBuilder>
- Inheritance
-
CountdownModuleBuilder
- Implements
- Inherited Members
Constructors
CountdownModuleBuilder()
Initializes a new instance of the CountdownModuleBuilder class.
public CountdownModuleBuilder()
CountdownModuleBuilder(CountdownMode, DateTimeOffset, DateTimeOffset?)
Initializes a new instance of the CountdownModuleBuilder class.
public CountdownModuleBuilder(CountdownMode mode, DateTimeOffset endTime, DateTimeOffset? startTime = null)
Parameters
mode
CountdownModeendTime
DateTimeOffsetstartTime
DateTimeOffset?
Properties
EndTime
Gets or sets the ending time of the countdown.
public DateTimeOffset EndTime { get; set; }
Property Value
- DateTimeOffset
The time at which the countdown ends.
Mode
Gets or sets how the countdown should be displayed.
public CountdownMode Mode { get; set; }
Property Value
- CountdownMode
A CountdownMode representing how the countdown should be displayed.
StartTime
Gets or sets the beginning time of the countdown.
public DateTimeOffset? StartTime { get; set; }
Property Value
- DateTimeOffset?
The time at which the countdown begins.
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 CountdownModule.
public CountdownModule Build()
Returns
- CountdownModule
A CountdownModule representing the built countdown module object.
Exceptions
- ArgumentOutOfRangeException
CountdownMode is not Second but StartTime is set.
- ArgumentOutOfRangeException
EndTime is before the current time.
- ArgumentOutOfRangeException
StartTime is before the Unix epoch.
- ArgumentOutOfRangeException
Equals(CountdownModuleBuilder?)
Determines whether the specified CountdownModuleBuilder is equal to the current CountdownModuleBuilder.
public bool Equals(CountdownModuleBuilder? countdownModuleBuilder)
Parameters
countdownModuleBuilder
CountdownModuleBuilderThe CountdownModuleBuilder to compare with the current CountdownModuleBuilder.
Returns
- bool
true
if the specified CountdownModuleBuilder is equal to the current CountdownModuleBuilder; otherwise,false
.
Equals(object?)
Determines whether the specified CountdownModuleBuilder is equal to the current CountdownModuleBuilder.
public override bool Equals(object? obj)
Parameters
obj
objectThe object to compare with the current CountdownModuleBuilder.
Returns
- bool
true
if the specified CountdownModuleBuilder is equal to the current CountdownModuleBuilder; otherwise,false
.
Remarks
If the object passes is an CountdownModuleBuilder, Equals(CountdownModuleBuilder?) 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.
WithEndTime(DateTimeOffset)
Sets the beginning time of the countdown.
public CountdownModuleBuilder WithEndTime(DateTimeOffset endTime)
Parameters
endTime
DateTimeOffsetThe time at which the countdown ends.
Returns
- CountdownModuleBuilder
The current builder.
WithMode(CountdownMode)
Sets how the countdown should be displayed.
public CountdownModuleBuilder WithMode(CountdownMode mode)
Parameters
mode
CountdownModeA CountdownMode representing how the countdown should be displayed.
Returns
- CountdownModuleBuilder
The current builder.
WithStartTime(DateTimeOffset?)
Sets the beginning time of the countdown.
public CountdownModuleBuilder WithStartTime(DateTimeOffset? startTime)
Parameters
startTime
DateTimeOffset?The time at which the countdown begins.
Returns
- CountdownModuleBuilder
The current builder.
Operators
operator ==(CountdownModuleBuilder?, CountdownModuleBuilder?)
Determines whether the specified CountdownModuleBuilder is equal to the current CountdownModuleBuilder.
public static bool operator ==(CountdownModuleBuilder? left, CountdownModuleBuilder? right)
Parameters
left
CountdownModuleBuilderright
CountdownModuleBuilder
Returns
- bool
true
if the specified CountdownModuleBuilder is equal to the current CountdownModuleBuilder; otherwise,false
.
operator !=(CountdownModuleBuilder?, CountdownModuleBuilder?)
Determines whether the specified CountdownModuleBuilder is not equal to the current CountdownModuleBuilder.
public static bool operator !=(CountdownModuleBuilder? left, CountdownModuleBuilder? right)
Parameters
left
CountdownModuleBuilderright
CountdownModuleBuilder
Returns
- bool
true
if the specified CountdownModuleBuilder is not equal to the current CountdownModuleBuilder; otherwise,false
.