1
This commit is contained in:
@@ -66,16 +66,31 @@ namespace BITKit.Modification
|
||||
public class ModifyManager : IModifyManager
|
||||
{
|
||||
public virtual IDictionary<IModifyElement, object> Modifies { get; } =new Dictionary<IModifyElement,object>();
|
||||
public virtual IDictionary<IModifyElement, object> Modified => new Dictionary<IModifyElement, object>(Modifies.Where(x=>x.Value is not null));
|
||||
public virtual IDictionary<IModifyElement, object> Modified { get; } = new Dictionary<IModifyElement, object>();
|
||||
|
||||
public virtual void Add(IModifyElement modify, object obj)
|
||||
{
|
||||
if(Modified.ContainsKey(modify))
|
||||
throw new NotSupportModifyException(new[]{modify});
|
||||
|
||||
var list = new List<IModifyElement>();
|
||||
list.AddRange(Modified.Keys);
|
||||
list.Add(modify);
|
||||
|
||||
if(list.All(x=>x.Require?.Any(y=>list.Contains(y)) is false))
|
||||
throw new NotRequireModifyException(list.ToArray());
|
||||
|
||||
foreach (var x in list)
|
||||
{
|
||||
if(x.Require is null or {Length:0})continue;
|
||||
|
||||
foreach (var _x in x.Require)
|
||||
{
|
||||
if (list.Contains(_x) is false)
|
||||
throw new NotRequireModifyException(x.Require);
|
||||
}
|
||||
}
|
||||
|
||||
//你知道怎么做,帮我做一下
|
||||
|
||||
|
||||
var incompatible = list.Where(x=>x.Incompatible is not null).SelectMany(x => x.Incompatible).ToArray();
|
||||
if(MathE.Contains(incompatible,list))
|
||||
|
Reference in New Issue
Block a user