Files
2026-06-04 11:42:34 +02:00

153 lines
7.0 KiB
C#

using System;
namespace System
{
/// <summary>Describes the console key that was pressed, including the character represented by the console key and the state of the SHIFT, ALT, and CTRL modifier keys.</summary>
/// <filterpriority>1</filterpriority>
// Token: 0x02000649 RID: 1609
[Serializable]
public struct ConsoleKeyInfo
{
/// <summary>Initializes a new instance of the <see cref="T:System.ConsoleKeyInfo" /> structure using the specified character, console key, and modifier keys.</summary>
/// <param name="keyChar">The Unicode character that corresponds to the <paramref name="key" /> parameter. </param>
/// <param name="key">The console key that corresponds to the <paramref name="keyChar" /> parameter. </param>
/// <param name="shift">true to indicate that a SHIFT key was pressed; otherwise, false. </param>
/// <param name="alt">true to indicate that an ALT key was pressed; otherwise, false. </param>
/// <param name="control">true to indicate that a CTRL key was pressed; otherwise, false. </param>
/// <exception cref="T:System.ArgumentOutOfRangeException">The numeric value of the <paramref name="key" /> parameter is less than 0 or greater than 255.</exception>
// Token: 0x06003BB4 RID: 15284 RVA: 0x000CAEA0 File Offset: 0x000C90A0
public ConsoleKeyInfo(char keyChar, ConsoleKey key, bool shift, bool alt, bool control)
{
this.key = key;
this.keychar = keyChar;
this.modifiers = (ConsoleModifiers)0;
this.SetModifiers(shift, alt, control);
}
// Token: 0x06003BB5 RID: 15285 RVA: 0x000CAED0 File Offset: 0x000C90D0
internal ConsoleKeyInfo(ConsoleKeyInfo other)
{
this.key = other.key;
this.keychar = other.keychar;
this.modifiers = other.modifiers;
}
// Token: 0x06003BB7 RID: 15287 RVA: 0x000CAF10 File Offset: 0x000C9110
internal void SetKey(ConsoleKey key)
{
this.key = key;
}
// Token: 0x06003BB8 RID: 15288 RVA: 0x000CAF1C File Offset: 0x000C911C
internal void SetKeyChar(char keyChar)
{
this.keychar = keyChar;
}
// Token: 0x06003BB9 RID: 15289 RVA: 0x000CAF28 File Offset: 0x000C9128
internal void SetModifiers(bool shift, bool alt, bool control)
{
this.modifiers = ((!shift) ? ((ConsoleModifiers)0) : ConsoleModifiers.Shift);
this.modifiers |= ((!alt) ? ((ConsoleModifiers)0) : ConsoleModifiers.Alt);
this.modifiers |= ((!control) ? ((ConsoleModifiers)0) : ConsoleModifiers.Control);
}
/// <summary>Gets the console key represented by the current <see cref="T:System.ConsoleKeyInfo" /> object.</summary>
/// <returns>A <see cref="T:System.ConsoleKey" /> value that identifies the console key that was pressed.</returns>
/// <filterpriority>1</filterpriority>
// Token: 0x17000B64 RID: 2916
// (get) Token: 0x06003BBA RID: 15290 RVA: 0x000CAF7C File Offset: 0x000C917C
public ConsoleKey Key
{
get
{
return this.key;
}
}
/// <summary>Gets the Unicode character represented by the current <see cref="T:System.ConsoleKeyInfo" /> object.</summary>
/// <returns>A <see cref="T:System.Char" /> object that corresponds to the console key represented by the current <see cref="T:System.ConsoleKeyInfo" /> object.</returns>
/// <filterpriority>1</filterpriority>
// Token: 0x17000B65 RID: 2917
// (get) Token: 0x06003BBB RID: 15291 RVA: 0x000CAF84 File Offset: 0x000C9184
public char KeyChar
{
get
{
return this.keychar;
}
}
/// <summary>Gets a bitwise combination of <see cref="T:System.ConsoleModifiers" /> values that specifies one or more modifier keys pressed simultaneously with the console key.</summary>
/// <returns>A bitwise combination of <see cref="T:System.ConsoleModifiers" /> values. There is no default value.</returns>
/// <filterpriority>1</filterpriority>
// Token: 0x17000B66 RID: 2918
// (get) Token: 0x06003BBC RID: 15292 RVA: 0x000CAF8C File Offset: 0x000C918C
public ConsoleModifiers Modifiers
{
get
{
return this.modifiers;
}
}
/// <summary>Gets a value indicating whether the specified object is equal to the current <see cref="T:System.ConsoleKeyInfo" /> object.</summary>
/// <returns>true if <paramref name="value" /> is a <see cref="T:System.ConsoleKeyInfo" /> object and is equal to the current <see cref="T:System.ConsoleKeyInfo" /> object; otherwise, false.</returns>
/// <param name="value">An object to compare to the current <see cref="T:System.ConsoleKeyInfo" /> object.</param>
// Token: 0x06003BBD RID: 15293 RVA: 0x000CAF94 File Offset: 0x000C9194
public override bool Equals(object value)
{
return value is ConsoleKeyInfo && this.Equals((ConsoleKeyInfo)value);
}
/// <summary>Gets a value indicating whether the specified <see cref="T:System.ConsoleKeyInfo" /> object is equal to the current <see cref="T:System.ConsoleKeyInfo" /> object.</summary>
/// <returns>true if <paramref name="obj" /> is equal to the current <see cref="T:System.ConsoleKeyInfo" /> object; otherwise, false.</returns>
/// <param name="obj">A <see cref="T:System.ConsoleKeyInfo" /> object to compare to the current <see cref="T:System.ConsoleKeyInfo" /> object.</param>
// Token: 0x06003BBE RID: 15294 RVA: 0x000CAFB0 File Offset: 0x000C91B0
public bool Equals(ConsoleKeyInfo obj)
{
return this.key == obj.key && obj.keychar == this.keychar && obj.modifiers == this.modifiers;
}
/// <summary>Returns the hash code for the current <see cref="T:System.ConsoleKeyInfo" /> object.</summary>
/// <returns>A 32-bit signed integer hash code.</returns>
// Token: 0x06003BBF RID: 15295 RVA: 0x000CAFF4 File Offset: 0x000C91F4
public override int GetHashCode()
{
return this.key.GetHashCode() ^ this.keychar.GetHashCode() ^ this.modifiers.GetHashCode();
}
/// <summary>Indicates whether the specified <see cref="T:System.ConsoleKeyInfo" /> objects are equal.</summary>
/// <returns>true if <paramref name="a" /> is equal to <paramref name="b" />; otherwise, false.</returns>
/// <param name="a">A <see cref="T:System.ConsoleKeyInfo" /> object.</param>
/// <param name="b">A <see cref="T:System.ConsoleKeyInfo" /> object.</param>
// Token: 0x06003BC0 RID: 15296 RVA: 0x000CB030 File Offset: 0x000C9230
public static bool operator ==(ConsoleKeyInfo a, ConsoleKeyInfo b)
{
return a.Equals(b);
}
/// <summary>Indicates whether the specified <see cref="T:System.ConsoleKeyInfo" /> objects are not equal.</summary>
/// <returns>true if <paramref name="a" /> is not equal to <paramref name="b" />; otherwise, false.</returns>
/// <param name="a">A <see cref="T:System.ConsoleKeyInfo" /> object.</param>
/// <param name="b">A <see cref="T:System.ConsoleKeyInfo" /> object.</param>
// Token: 0x06003BC1 RID: 15297 RVA: 0x000CB03C File Offset: 0x000C923C
public static bool operator !=(ConsoleKeyInfo a, ConsoleKeyInfo b)
{
return !a.Equals(b);
}
// Token: 0x04001872 RID: 6258
internal static ConsoleKeyInfo Empty = new ConsoleKeyInfo('\0', (ConsoleKey)0, false, false, false);
// Token: 0x04001873 RID: 6259
private ConsoleKey key;
// Token: 0x04001874 RID: 6260
private char keychar;
// Token: 0x04001875 RID: 6261
private ConsoleModifiers modifiers;
}
}