format
This commit is contained in:
parent
37b7ad2a1f
commit
d17b051da7
@ -16,7 +16,8 @@ public abstract class Configuration
|
|||||||
Binder.Configuration? configuration = configurationSection.Get<Binder.Configuration>();
|
Binder.Configuration? configuration = configurationSection.Get<Binder.Configuration>();
|
||||||
string json = JsonSerializer.Serialize(configuration, new JsonSerializerOptions() { WriteIndented = true });
|
string json = JsonSerializer.Serialize(configuration, new JsonSerializerOptions() { WriteIndented = true });
|
||||||
result = JsonSerializer.Deserialize<Models.Configuration>(json);
|
result = JsonSerializer.Deserialize<Models.Configuration>(json);
|
||||||
if (result is null) throw new Exception(json);
|
if (result is null)
|
||||||
|
throw new Exception(json);
|
||||||
string jsonThis = result.ToString();
|
string jsonThis = result.ToString();
|
||||||
if (jsonThis != json)
|
if (jsonThis != json)
|
||||||
{
|
{
|
||||||
@ -29,7 +30,8 @@ public abstract class Configuration
|
|||||||
check = i;
|
check = i;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (check is null) throw new Exception();
|
if (check is null)
|
||||||
|
throw new Exception();
|
||||||
string a = json[..check.Value].Split(',')[^1];
|
string a = json[..check.Value].Split(',')[^1];
|
||||||
string b = json[check.Value..].Split(',')[0];
|
string b = json[check.Value..].Split(',')[0];
|
||||||
throw new Exception($"{a}{b}");
|
throw new Exception($"{a}{b}");
|
||||||
|
@ -95,17 +95,28 @@ public class Configuration : Shared.Models.Properties.IPropertyConfiguration
|
|||||||
|
|
||||||
public static void Verify(Configuration propertyConfiguration, bool requireExist)
|
public static void Verify(Configuration propertyConfiguration, bool requireExist)
|
||||||
{
|
{
|
||||||
if (propertyConfiguration is null) throw new NullReferenceException(nameof(propertyConfiguration));
|
if (propertyConfiguration is null)
|
||||||
if (propertyConfiguration.IgnoreExtensions is null || propertyConfiguration.IgnoreExtensions.Length == 0) throw new NullReferenceException(nameof(propertyConfiguration.IgnoreExtensions));
|
throw new NullReferenceException(nameof(propertyConfiguration));
|
||||||
if (propertyConfiguration.IgnoreRulesKeyWords is null || propertyConfiguration.IgnoreRulesKeyWords.Length == 0) throw new NullReferenceException(nameof(propertyConfiguration.IgnoreRulesKeyWords));
|
if (propertyConfiguration.IgnoreExtensions is null || propertyConfiguration.IgnoreExtensions.Length == 0)
|
||||||
if (propertyConfiguration.PropertyContentCollectionFiles is null) throw new NullReferenceException(nameof(propertyConfiguration.PropertyContentCollectionFiles));
|
throw new NullReferenceException(nameof(propertyConfiguration.IgnoreExtensions));
|
||||||
if (propertyConfiguration.ValidImageFormatExtensions is null || propertyConfiguration.ValidImageFormatExtensions.Length == 0) throw new NullReferenceException(nameof(propertyConfiguration.ValidImageFormatExtensions));
|
if (propertyConfiguration.IgnoreRulesKeyWords is null || propertyConfiguration.IgnoreRulesKeyWords.Length == 0)
|
||||||
if (propertyConfiguration is null) throw new NullReferenceException(nameof(propertyConfiguration));
|
throw new NullReferenceException(nameof(propertyConfiguration.IgnoreRulesKeyWords));
|
||||||
if (string.IsNullOrEmpty(propertyConfiguration.DateGroup)) throw new NullReferenceException(nameof(propertyConfiguration.DateGroup));
|
if (propertyConfiguration.PropertyContentCollectionFiles is null)
|
||||||
if (string.IsNullOrEmpty(propertyConfiguration.FileNameDirectorySeparator)) throw new NullReferenceException(nameof(propertyConfiguration.FileNameDirectorySeparator));
|
throw new NullReferenceException(nameof(propertyConfiguration.PropertyContentCollectionFiles));
|
||||||
if (string.IsNullOrEmpty(propertyConfiguration.Pattern)) throw new NullReferenceException(nameof(propertyConfiguration.Pattern));
|
if (propertyConfiguration.ValidImageFormatExtensions is null || propertyConfiguration.ValidImageFormatExtensions.Length == 0)
|
||||||
if (string.IsNullOrEmpty(propertyConfiguration.RootDirectory) || (requireExist && !Directory.Exists(propertyConfiguration.RootDirectory))) throw new NullReferenceException(nameof(propertyConfiguration.RootDirectory));
|
throw new NullReferenceException(nameof(propertyConfiguration.ValidImageFormatExtensions));
|
||||||
if (propertyConfiguration.RootDirectory != Path.GetFullPath(propertyConfiguration.RootDirectory)) throw new Exception();
|
if (propertyConfiguration is null)
|
||||||
|
throw new NullReferenceException(nameof(propertyConfiguration));
|
||||||
|
if (string.IsNullOrEmpty(propertyConfiguration.DateGroup))
|
||||||
|
throw new NullReferenceException(nameof(propertyConfiguration.DateGroup));
|
||||||
|
if (string.IsNullOrEmpty(propertyConfiguration.FileNameDirectorySeparator))
|
||||||
|
throw new NullReferenceException(nameof(propertyConfiguration.FileNameDirectorySeparator));
|
||||||
|
if (string.IsNullOrEmpty(propertyConfiguration.Pattern))
|
||||||
|
throw new NullReferenceException(nameof(propertyConfiguration.Pattern));
|
||||||
|
if (string.IsNullOrEmpty(propertyConfiguration.RootDirectory) || (requireExist && !Directory.Exists(propertyConfiguration.RootDirectory)))
|
||||||
|
throw new NullReferenceException(nameof(propertyConfiguration.RootDirectory));
|
||||||
|
if (propertyConfiguration.RootDirectory != Path.GetFullPath(propertyConfiguration.RootDirectory))
|
||||||
|
throw new Exception();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user