mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-06-01 17:24:59 +00:00
feature<SubTree>: supports git subtree
feature
This commit is contained in:
parent
6b602e70c5
commit
130b5a66ab
22 changed files with 784 additions and 10 deletions
|
@ -1,17 +1,16 @@
|
|||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace SourceGit.Views.Validations {
|
||||
public class SubmodulePath : ValidationRule {
|
||||
public class RelativePath : ValidationRule {
|
||||
public override ValidationResult Validate(object value, CultureInfo cultureInfo) {
|
||||
var path = value as string;
|
||||
if (string.IsNullOrEmpty(path)) return ValidationResult.ValidResult;
|
||||
|
||||
var regex = new Regex(@"^[\w\-\._/]+$");
|
||||
var succ = regex.IsMatch(path.Trim());
|
||||
return !succ ? new ValidationResult(false, App.Text("BadSubmodulePath")) : ValidationResult.ValidResult;
|
||||
return !succ ? new ValidationResult(false, App.Text("BadRelativePath")) : ValidationResult.ValidResult;
|
||||
}
|
||||
}
|
||||
}
|
13
src/Views/Validations/Required.cs
Normal file
13
src/Views/Validations/Required.cs
Normal file
|
@ -0,0 +1,13 @@
|
|||
using System.Globalization;
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace SourceGit.Views.Validations {
|
||||
public class Required : ValidationRule {
|
||||
public override ValidationResult Validate(object value, CultureInfo cultureInfo) {
|
||||
var path = value as string;
|
||||
return string.IsNullOrEmpty(path) ?
|
||||
new ValidationResult(false, App.Text("Required")) :
|
||||
ValidationResult.ValidResult;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue