mirror of
https://github.com/EnderIce2/SDR-RPC.git
synced 2025-09-19 01:53:15 +00:00
.github
DiscordAPI
Converters
Exceptions
BadPresenceException.cs
InvalidConfigurationException.cs
InvalidPipeException.cs
StringOutOfRangeException.cs
UninitializedException.cs
Helper
IO
Logging
Message
RPC
Registry
Web
Configuration.cs
DiscordRpcClient.cs
EventType.cs
Events.cs
LICENSE.txt
RichPresence.cs
User.cs
Properties
.editorconfig
.gitattributes
.gitignore
LICENSE
LogWriter.cs
MainPlugin.cs
README.md
Register.txt
SDRSharpPlugin.DiscordRPC.csproj
SDRSharpPlugin.DiscordRPC.sln
SettingsPanel.Designer.cs
SettingsPanel.cs
SettingsPanel.resx
TopWindowMessages.Designer.cs
TopWindowMessages.cs
TopWindowMessages.resx
WelcomeForm.Designer.cs
WelcomeForm.cs
WelcomeForm.resx
app.config
packages.config
51 lines
1.9 KiB
C#
51 lines
1.9 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
|
|
namespace DiscordRPC.Exceptions
|
|
{
|
|
/// <summary>
|
|
/// A StringOutOfRangeException is thrown when the length of a string exceeds the allowed limit.
|
|
/// </summary>
|
|
public class StringOutOfRangeException : Exception
|
|
{
|
|
/// <summary>
|
|
/// Maximum length the string is allowed to be.
|
|
/// </summary>
|
|
public int MaximumLength { get; private set; }
|
|
|
|
/// <summary>
|
|
/// Minimum length the string is allowed to be.
|
|
/// </summary>
|
|
public int MinimumLength { get; private set; }
|
|
|
|
/// <summary>
|
|
/// Creates a new string out of range exception with a range of min to max and a custom message
|
|
/// </summary>
|
|
/// <param name="message">The custom message</param>
|
|
/// <param name="min">Minimum length the string can be</param>
|
|
/// <param name="max">Maximum length the string can be</param>
|
|
internal StringOutOfRangeException(string message, int min, int max) : base(message)
|
|
{
|
|
MinimumLength = min;
|
|
MaximumLength = max;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Creates a new sting out of range exception with a range of min to max
|
|
/// </summary>
|
|
/// <param name="minumum"></param>
|
|
/// <param name="max"></param>
|
|
internal StringOutOfRangeException(int minumum, int max)
|
|
: this("Length of string is out of range. Expected a value between " + minumum + " and " + max, minumum, max) { }
|
|
|
|
/// <summary>
|
|
/// Creates a new sting out of range exception with a range of 0 to max
|
|
/// </summary>
|
|
/// <param name="max"></param>
|
|
internal StringOutOfRangeException(int max)
|
|
: this("Length of string is out of range. Expected a value with a maximum length of " + max, 0, max) { }
|
|
}
|
|
}
|