First commit

This commit is contained in:
EnderIce2
2020-10-25 16:19:43 +02:00
parent 9d78d84acb
commit b91db81473
73 changed files with 7634 additions and 0 deletions

View File

@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace DiscordRPC.Exceptions
{
/// <summary>
/// A BadPresenceException is thrown when invalid, incompatible or conflicting properties and is unable to be sent.
/// </summary>
public class BadPresenceException : Exception
{
internal BadPresenceException(string message) : base(message) { }
}
}

View File

@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace DiscordRPC.Exceptions
{
/// <summary>
/// A InvalidConfigurationException is thrown when trying to perform a action that conflicts with the current configuration.
/// </summary>
public class InvalidConfigurationException : Exception
{
internal InvalidConfigurationException(string message) : base(message) { }
}
}

View File

@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace DiscordRPC.Exceptions
{
/// <summary>
/// The exception that is thrown when a error occurs while communicating with a pipe or when a connection attempt fails.
/// </summary>
[System.Obsolete("Not actually used anywhere")]
public class InvalidPipeException : Exception
{
internal InvalidPipeException(string message) : base(message) { }
}
}

View File

@ -0,0 +1,50 @@
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) { }
}
}

View File

@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace DiscordRPC.Exceptions
{
/// <summary>
/// Thrown when an action is performed on a client that has not yet been initialized
/// </summary>
public class UninitializedException : Exception
{
/// <summary>
/// Creates a new unintialized exception
/// </summary>
/// <param name="message"></param>
internal UninitializedException(string message) : base(message) { }
/// <summary>
/// Creates a new uninitialized exception with default message.
/// </summary>
internal UninitializedException() : this("Cannot perform action because the client has not been initialized yet or has been deinitialized.") { }
}
}