mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-05-21 12:15:00 +00:00
style: add .editorconfig for code formatting. see issu #25
This commit is contained in:
parent
a8eeea4f78
commit
18aaa0a143
225 changed files with 7781 additions and 3911 deletions
|
@ -1,8 +1,10 @@
|
|||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace SourceGit.Models {
|
||||
public partial class Remote {
|
||||
|
||||
namespace SourceGit.Models
|
||||
{
|
||||
public partial class Remote
|
||||
{
|
||||
|
||||
[GeneratedRegex(@"^http[s]?://([\w\-]+@)?[\w\.\-]+(\:[0-9]+)?/[\w\-]+/[\w\-\.]+\.git$")]
|
||||
private static partial Regex regex1();
|
||||
|
||||
|
@ -10,7 +12,7 @@ namespace SourceGit.Models {
|
|||
private static partial Regex regex2();
|
||||
[GeneratedRegex(@"^ssh://([\w\-]+@)?[\w\.\-]+(\:[0-9]+)?/[\w\-]+/[\w\-\.]+\.git$")]
|
||||
private static partial Regex regex3();
|
||||
|
||||
|
||||
private static readonly Regex[] URL_FORMATS = [
|
||||
regex1(),
|
||||
regex2(),
|
||||
|
@ -20,21 +22,25 @@ namespace SourceGit.Models {
|
|||
public string Name { get; set; }
|
||||
public string URL { get; set; }
|
||||
|
||||
public static bool IsSSH(string url) {
|
||||
public static bool IsSSH(string url)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(url)) return false;
|
||||
|
||||
for (int i = 1; i < URL_FORMATS.Length; i++) {
|
||||
for (int i = 1; i < URL_FORMATS.Length; i++)
|
||||
{
|
||||
if (URL_FORMATS[i].IsMatch(url)) return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static bool IsValidURL(string url) {
|
||||
foreach (var fmt in URL_FORMATS) {
|
||||
public static bool IsValidURL(string url)
|
||||
{
|
||||
foreach (var fmt in URL_FORMATS)
|
||||
{
|
||||
if (fmt.IsMatch(url)) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue