mirror of
https://github.com/Ellpeck/MLEM.git
synced 2024-11-25 22:18:34 +01:00
added text field input rules for file and path names
This commit is contained in:
parent
90d7aeb633
commit
7e89efec69
1 changed files with 9 additions and 0 deletions
|
@ -1,4 +1,5 @@
|
||||||
using System;
|
using System;
|
||||||
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using Microsoft.Xna.Framework;
|
using Microsoft.Xna.Framework;
|
||||||
|
@ -36,6 +37,14 @@ namespace MLEM.Ui.Elements {
|
||||||
/// A <see cref="Rule"/> that only allows letters and numerals
|
/// A <see cref="Rule"/> that only allows letters and numerals
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static readonly Rule LettersNumbers = (field, add) => add.All(c => char.IsLetter(c) || char.IsNumber(c));
|
public static readonly Rule LettersNumbers = (field, add) => add.All(c => char.IsLetter(c) || char.IsNumber(c));
|
||||||
|
/// <summary>
|
||||||
|
/// A <see cref="Rule"/> that only allows characters not contained in <see cref="Path.GetInvalidPathChars"/>
|
||||||
|
/// </summary>
|
||||||
|
public static readonly Rule PathNames = (field, add) => add.IndexOfAny(Path.GetInvalidPathChars()) < 0;
|
||||||
|
/// <summary>
|
||||||
|
/// A <see cref="Rule"/> that only allows characters not contained in <see cref="Path.GetInvalidFileNameChars"/>
|
||||||
|
/// </summary>
|
||||||
|
public static readonly Rule FileNames = (field, add) => add.IndexOfAny(Path.GetInvalidFileNameChars()) < 0;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The color that this text field's text should display with
|
/// The color that this text field's text should display with
|
||||||
|
|
Loading…
Reference in a new issue