diff --git a/Pilz.Collections/App.config b/Pilz.Collections/App.config
deleted file mode 100644
index a932133..0000000
--- a/Pilz.Collections/App.config
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
diff --git a/Pilz.Collections/Pilz.Collections.csproj b/Pilz.Collections/Pilz.Collections.csproj
new file mode 100644
index 0000000..03d7757
--- /dev/null
+++ b/Pilz.Collections/Pilz.Collections.csproj
@@ -0,0 +1,16 @@
+
+
+
+
+
+ net8.0
+ latest
+ enable
+ enable
+
+
+
+ 2.0.0
+
+
+
\ No newline at end of file
diff --git a/Pilz.Collections/Pilz.Collections.vbproj b/Pilz.Collections/Pilz.Collections.vbproj
deleted file mode 100644
index c95b375..0000000
--- a/Pilz.Collections/Pilz.Collections.vbproj
+++ /dev/null
@@ -1,62 +0,0 @@
-
-
-
- netstandard2.0;net8.0
- Pilz.Collections.xml
- true
-
-
- true
- 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022,40008
-
-
- false
- 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022
- true
-
-
- On
-
-
- Binary
-
-
- Off
- On
-
-
- 2.0.0
-
-
- true
- bin\$(Platform)\$(Configuration)\
- 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022,40008
- MinimumRecommendedRules.ruleset
- true
-
-
- bin\$(Platform)\$(Configuration)\
- true
- 42016,41999,42017,42018,42019,42032,42036,42020,42021,42022
- MinimumRecommendedRules.ruleset
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/Pilz.Collections/SimpleHistory/Enums.vb b/Pilz.Collections/SimpleHistory/Enums.vb
deleted file mode 100644
index 8438552..0000000
--- a/Pilz.Collections/SimpleHistory/Enums.vb
+++ /dev/null
@@ -1,12 +0,0 @@
-Namespace SimpleHistory
-
- '''
- ''' Specify which member types you would include.
- '''
- Public Enum ObjectValueType
- None = 0
- Field = 1
- [Property] = 2
- End Enum
-
-End Namespace
\ No newline at end of file
diff --git a/Pilz.Collections/SimpleHistory/HistoryPoint.cs b/Pilz.Collections/SimpleHistory/HistoryPoint.cs
new file mode 100644
index 0000000..bb92aa9
--- /dev/null
+++ b/Pilz.Collections/SimpleHistory/HistoryPoint.cs
@@ -0,0 +1,615 @@
+using System.Data;
+using System.Reflection;
+
+namespace Pilz.Collections.SimpleHistory;
+
+///
+/// Represent some Object States and Actions.
+///
+public class HistoryPoint
+{
+ ///
+ /// Represents the Name of this History Point
+ ///
+ ///
+ public string Name { get; set; } = string.Empty;
+
+ ///
+ /// A List of Object States and Actions.
+ ///
+ ///
+ public List Entries { get; } = [];
+
+ ///
+ /// Some data can be refered on this HistoryPoint. Don't know, in some situations this can be helpful.
+ ///
+ public readonly object? Tag = null;
+
+ public bool HasEntries() where T : ObjectBase
+ {
+ return Entries.Where(n => n is T).Any();
+ }
+
+ internal void Undo()
+ {
+ foreach (var s in Entries.OrderBy(n => n.UndoPriority))
+ {
+ switch (s)
+ {
+ case ObjectState state:
+ state.Patch();
+ break;
+ case ObjectAction action:
+ action.Undo();
+ break;
+ }
+ }
+ }
+
+ internal void Redo()
+ {
+ foreach (var s in Entries.OrderBy(n => n.RedoPriority))
+ {
+ switch (s)
+ {
+ case ObjectState state:
+ state.Patch();
+ break;
+ case ObjectAction action:
+ action.Redo();
+ break;
+ }
+ }
+ }
+
+ ///
+ /// Creates an History Point with Object States automaticly from input.
+ ///
+ /// The objects that should be included.
+ /// Specify which members to include.
+ /// A History Point with Object States.
+ public static HistoryPoint FromObject(object[] obj, MemberWhiteList whiteList)
+ {
+ return FromObject([obj], ObjectValueType.None, (object)whiteList, BindingFlags.Default);
+ }
+
+ ///
+ /// Creates an History Point with Object States automaticly from input.
+ ///
+ /// The objects that should be included.
+ /// Specify which members to exclude.
+ /// A History Point with Object States.
+ public static HistoryPoint FromObject(object[] obj, MemberBlackList blackList)
+ {
+ return FromObject([obj], ObjectValueType.None, (object)blackList, BindingFlags.Default);
+ }
+
+ ///
+ /// Creates an History Point with Object States automaticly from input.
+ ///
+ /// The objects that should be included.
+ /// The member names to include.
+ /// A History Point with Object States.
+ public static HistoryPoint FromObject(object[] obj, params string[] memberName)
+ {
+ return FromObject(obj, true, memberName);
+ }
+
+ ///
+ /// Creates an History Point with Object States automaticly from input.
+ ///
+ /// The objects that should be included.
+ /// If true, the memberName-Array has member names that should be included.
+ /// The member names to include/exclude.
+ /// A History Point with Object States.
+ public static HistoryPoint FromObject(object[] obj, bool isWhiteList, params string[] memberName)
+ {
+ if (isWhiteList)
+ return FromObject([obj], ObjectValueType.None, (object)new MemberWhiteList(memberName), BindingFlags.Default);
+ else
+ return FromObject([obj], ObjectValueType.None, (object)new MemberBlackList(memberName), BindingFlags.Default);
+ }
+
+ ///
+ /// Creates an History Point with Object States automaticly from input.
+ ///
+ /// The objects that should be included.
+ /// Specify what member types to include.
+ /// The member names to include.
+ /// A History Point with Object States.
+ public static HistoryPoint FromObject(object[] obj, ObjectValueType membersToStore, params string[] memberName)
+ {
+ return FromObject(obj, membersToStore, true, memberName);
+ }
+
+ ///
+ /// Creates an History Point with Object States automaticly from input.
+ ///
+ /// The objects that should be included.
+ /// Specify what member types to include.
+ /// If true, the memberName-Array has member names that should be included.
+ /// The member names to include/exclude.
+ /// A History Point with Object States.
+ public static HistoryPoint FromObject(object[] obj, ObjectValueType membersToStore, bool isWhiteList, params string[] memberName)
+ {
+ if (isWhiteList)
+ return FromObject([obj], membersToStore, (object)new MemberWhiteList(memberName), BindingFlags.Default);
+ else
+ return FromObject([obj], membersToStore, (object)new MemberBlackList(memberName), BindingFlags.Default);
+ }
+
+ ///
+ /// Creates an History Point with Object States automaticly from input.
+ ///
+ /// The objects that should be included.
+ /// The Binding Flags that the members should have.
+ /// The member names to include.
+ /// A History Point with Object States.
+ public static HistoryPoint FromObject(object[] obj, BindingFlags flags, params string[] memberName)
+ {
+ return FromObject(obj, flags, true, memberName);
+ }
+
+ ///
+ /// Creates an History Point with Object States automaticly from input.
+ ///
+ /// The objects that should be included.
+ /// The Binding Flags that the members should have.
+ /// If true, the memberName-Array has member names that should be included.
+ /// The member names to include/exclude.
+ /// A History Point with Object States.
+ public static HistoryPoint FromObject(object[] obj, BindingFlags flags, bool isWhiteList, params string[] memberName)
+ {
+ if (isWhiteList)
+ return FromObject([obj], ObjectValueType.None, (object)new MemberWhiteList(memberName), flags);
+ else
+ return FromObject([obj], ObjectValueType.None, (object)new MemberBlackList(memberName), flags);
+ }
+
+ ///
+ /// Creates an History Point with Object States automaticly from input.
+ ///
+ /// The objects that should be included.
+ /// Specify what member types to include.
+ /// The Binding Flags that the members should have.
+ /// The member names to include.
+ /// A History Point with Object States.
+ public static HistoryPoint FromObject(object[] obj, ObjectValueType membersToStore, BindingFlags flags, params string[] memberName)
+ {
+ return FromObject(obj, flags, true, memberName);
+ }
+
+ ///
+ /// Creates an History Point with Object States automaticly from input.
+ ///
+ /// The objects that should be included.
+ /// Specify what member types to include.
+ /// The Binding Flags that the members should have.
+ /// If true, the memberName-Array has member names that should be included.
+ /// The member names to include/exclude.
+ /// A History Point with Object States.
+ public static HistoryPoint FromObject(object[] obj, ObjectValueType membersToStore, BindingFlags flags, bool isWhiteList, params string[] memberName)
+ {
+ if (isWhiteList)
+ return FromObject([obj], membersToStore, (object)new MemberWhiteList(memberName), flags);
+ else
+ return FromObject([obj], membersToStore, (object)new MemberBlackList(memberName), flags);
+ }
+
+ ///
+ /// Creates an History Point with Object States automaticly from input.
+ ///
+ /// The object that should be included.
+ /// Specify which members to include.
+ /// A History Point with Object States.
+ public static HistoryPoint FromObject(object obj, MemberWhiteList whiteList)
+ {
+ return FromObject([obj], ObjectValueType.None, (object)whiteList, BindingFlags.Default);
+ }
+
+ ///
+ /// Creates an History Point with Object States automaticly from input.
+ ///
+ /// The object that should be included.
+ /// Specify which members to exclude.
+ /// A History Point with Object States.
+ public static HistoryPoint FromObject(object obj, MemberBlackList blackList)
+ {
+ return FromObject([obj], ObjectValueType.None, (object)blackList, BindingFlags.Default);
+ }
+
+ ///
+ /// Creates an History Point with Object States automaticly from input.
+ ///
+ /// The object that should be included.
+ /// The member names to include/exclude.
+ /// A History Point with Object States.
+ public static HistoryPoint FromObject(object obj, params string[] memberName)
+ {
+ return FromObject(obj, true, memberName);
+ }
+
+ ///
+ /// Creates an History Point with Object States automaticly from input.
+ ///
+ /// The object that should be included.
+ /// If true, the memberName-Array has member names that should be included.
+ /// The member names to include/exclude.
+ /// A History Point with Object States.
+ public static HistoryPoint FromObject(object obj, bool isWhiteList, params string[] memberName)
+ {
+ if (isWhiteList)
+ return FromObject([obj], ObjectValueType.None, (object)new MemberWhiteList(memberName), BindingFlags.Default);
+ else
+ return FromObject([obj], ObjectValueType.None, (object)new MemberBlackList(memberName), BindingFlags.Default);
+ }
+
+ ///
+ /// Creates an History Point with Object States automaticly from input.
+ ///
+ /// The object that should be included.
+ /// Specify what member types to include.
+ /// The member names to include.
+ /// A History Point with Object States.
+ public static HistoryPoint FromObject(object obj, ObjectValueType membersToStore, params string[] memberName)
+ {
+ return FromObject(obj, membersToStore, true, memberName);
+ }
+
+ ///
+ /// Creates an History Point with Object States automaticly from input.
+ ///
+ /// The object that should be included.
+ /// Specify what member types to include.
+ /// If true, the memberName-Array has member names that should be included.
+ /// The member names to include/exclude.
+ /// A History Point with Object States.
+ public static HistoryPoint FromObject(object obj, ObjectValueType membersToStore, bool isWhiteList, params string[] memberName)
+ {
+ if (isWhiteList)
+ return FromObject([obj], membersToStore, (object)new MemberWhiteList(memberName), BindingFlags.Default);
+ else
+ return FromObject([obj], membersToStore, (object)new MemberBlackList(memberName), BindingFlags.Default);
+ }
+
+ ///
+ /// Creates an History Point with Object States automaticly from input.
+ ///
+ /// The object that should be included.
+ /// The Binding Flags that the members should have.
+ /// The member names to include.
+ /// A History Point with Object States.
+ public static HistoryPoint FromObject(object obj, BindingFlags flags, params string[] memberName)
+ {
+ return FromObject(obj, flags, true, memberName);
+ }
+
+ ///
+ /// Creates an History Point with Object States automaticly from input.
+ ///
+ /// The object that should be included.
+ /// The Binding Flags that the members should have.
+ /// If true, the memberName-Array has member names that should be included.
+ /// The member names to include/exclude.
+ /// A History Point with Object States.
+ public static HistoryPoint FromObject(object obj, BindingFlags flags, bool isWhiteList, params string[] memberName)
+ {
+ if (isWhiteList)
+ return FromObject([obj], ObjectValueType.None, (object)new MemberWhiteList(memberName), flags);
+ else
+ return FromObject([obj], ObjectValueType.None, (object)new MemberBlackList(memberName), flags);
+ }
+
+ ///
+ /// Creates an History Point with Object States automaticly from input.
+ ///
+ /// The object that should be included.
+ /// Specify what member types to include.
+ /// The Binding Flags that the members should have.
+ /// The member names to include.
+ /// A History Point with Object States.
+ public static HistoryPoint FromObject(object obj, ObjectValueType membersToStore, BindingFlags flags, params string[] memberName)
+ {
+ return FromObject(obj, flags, true, memberName);
+ }
+
+ ///
+ /// Creates an History Point with Object States automaticly from input.
+ ///
+ /// The object that should be included.
+ /// Specify what member types to include.
+ /// The Binding Flags that the members should have.
+ /// If true, the memberName-Array has member names that should be included.
+ /// The member names to include/exclude.
+ /// A History Point with Object States.
+ public static HistoryPoint FromObject(object obj, ObjectValueType membersToStore, BindingFlags flags, bool isWhiteList, params string[] memberName)
+ {
+ if (isWhiteList)
+ return FromObject([obj], membersToStore, (object)new MemberWhiteList(memberName), flags);
+ else
+ return FromObject([obj], membersToStore, (object)new MemberBlackList(memberName), flags);
+ }
+
+ ///
+ /// Creates an History Point with Object States automaticly from input.
+ ///
+ /// The object that should be included.
+ /// A History Point with Object States.
+ public static HistoryPoint FromObject(object obj)
+ {
+ return FromObject([obj], ObjectValueType.None, default(object), BindingFlags.Default);
+ }
+ ///
+ /// Creates an History Point with Object States automaticly from input.
+ ///
+ /// The object that should be included.
+ /// Specify what member types to include.
+ /// A History Point with Object States.
+ public static HistoryPoint FromObject(object obj, ObjectValueType membersToStore)
+ {
+ return FromObject([obj], membersToStore, default(object), BindingFlags.Default);
+ }
+
+ ///
+ /// Creates an History Point with Object States automaticly from input.
+ ///
+ /// The object that should be included.
+ /// Specify what member types to include.
+ /// Specify which members to include.
+ /// A History Point with Object States.
+ public static HistoryPoint FromObject(object obj, ObjectValueType membersToStore, MemberWhiteList whiteList)
+ {
+ return FromObject([obj], membersToStore, (object)whiteList, BindingFlags.Default);
+ }
+
+ ///
+ /// Creates an History Point with Object States automaticly from input.
+ ///
+ /// The object that should be included.
+ /// Specify what member types to include.
+ /// Specify which members to exclude.
+ /// A History Point with Object States.
+ public static HistoryPoint FromObject(object obj, ObjectValueType membersToStore, MemberBlackList blackList)
+ {
+ return FromObject([obj], membersToStore, (object)blackList, BindingFlags.Default);
+ }
+
+ ///
+ /// Creates an History Point with Object States automaticly from input.
+ ///
+ /// The object that should be included.
+ /// The Binding Flags that the members should have.
+ /// A History Point with Object States.
+ public static HistoryPoint FromObject(object obj, BindingFlags flags)
+ {
+ return FromObject([obj], ObjectValueType.None, default(object), flags);
+ }
+
+ ///
+ /// Creates an History Point with Object States automaticly from input.
+ ///
+ /// The object that should be included.
+ /// Specify what member types to include.
+ /// The Binding Flags that the members should have.
+ /// A History Point with Object States.
+ public static HistoryPoint FromObject(object obj, ObjectValueType membersToStore, BindingFlags flags)
+ {
+ return FromObject([obj], membersToStore, default(object), flags);
+ }
+
+ ///
+ /// Creates an History Point with Object States automaticly from input.
+ ///
+ /// The object that should be included.
+ /// Specify what member types to include.
+ /// Specify which members to include.
+ /// The Binding Flags that the members should have.
+ /// A History Point with Object States.
+ public static HistoryPoint FromObject(object obj, ObjectValueType membersToStore, MemberWhiteList whiteList, BindingFlags flags)
+ {
+ return FromObject([obj], membersToStore, (object)whiteList, flags);
+ }
+
+ ///
+ /// Creates an History Point with Object States automaticly from input.
+ ///
+ /// The object that should be included.
+ /// Specify what member types to include.
+ /// Specify which members to exclude.
+ /// The Binding Flags that the members should have.
+ /// A History Point with Object States.
+ public static HistoryPoint FromObject(object obj, ObjectValueType membersToStore, MemberBlackList blackList, BindingFlags flags)
+ {
+ return FromObject([obj], membersToStore, (object)blackList, flags);
+ }
+
+ ///
+ /// Creates an History Point with Object States automaticly from input.
+ ///
+ /// The objects that should be included.
+ /// A History Point with Object States.
+ public static HistoryPoint FromObject(object[] objs)
+ {
+ return FromObject(objs, ObjectValueType.None, default(object), BindingFlags.Default);
+ }
+
+ ///
+ /// Creates an History Point with Object States automaticly from input.
+ ///
+ /// The objects that should be included.
+ /// Specify what member types to include.
+ /// A History Point with Object States.
+ public static HistoryPoint FromObject(object[] objs, ObjectValueType membersToStore)
+ {
+ return FromObject(objs, membersToStore, default(object), BindingFlags.Default);
+ }
+
+ ///
+ /// Creates an History Point with Object States automaticly from input.
+ ///
+ /// The objects that should be included.
+ /// Specify what member types to include.
+ /// Specify which members to include.
+ /// A History Point with Object States.
+ public static HistoryPoint FromObject(object[] objs, ObjectValueType membersToStore, MemberWhiteList whiteList)
+ {
+ return FromObject(objs, membersToStore, (object)whiteList, BindingFlags.Default);
+ }
+
+ ///
+ /// Creates an History Point with Object States automaticly from input.
+ ///
+ /// The objects that should be included.
+ /// Specify what member types to include.
+ /// Specify which members to exclude.
+ /// A History Point with Object States.
+ public static HistoryPoint FromObject(object[] objs, ObjectValueType membersToStore, MemberBlackList blackList)
+ {
+ return FromObject(objs, membersToStore, (object)blackList, BindingFlags.Default);
+ }
+
+ ///
+ /// Creates an History Point with Object States automaticly from input.
+ ///
+ /// The objects that should be included.
+ /// The Binding Flags that the members should have.
+ /// A History Point with Object States.
+ public static HistoryPoint FromObject(object[] objs, BindingFlags flags)
+ {
+ return FromObject(objs, ObjectValueType.None, default(object), flags);
+ }
+ ///
+ /// Creates an History Point with Object States automaticly from input.
+ ///
+ /// The objects that should be included.
+ /// Specify what member types to include.
+ /// The Binding Flags that the members should have.
+ /// A History Point with Object States.
+ public static HistoryPoint FromObject(object[] objs, ObjectValueType membersToStore, BindingFlags flags)
+ {
+ return FromObject(objs, membersToStore, default(object), flags);
+ }
+ ///
+ /// Creates an History Point with Object States automaticly from input.
+ ///
+ /// The objects that should be included.
+ /// Specify what member types to include.
+ /// Specify which members to include.
+ /// The Binding Flags that the members should have.
+ /// A History Point with Object States.
+ public static HistoryPoint FromObject(object[] objs, ObjectValueType membersToStore, MemberWhiteList whiteList, BindingFlags flags)
+ {
+ return FromObject(objs, membersToStore, (object)whiteList, flags);
+ }
+ ///
+ /// Creates an History Point with Object States automaticly from input.
+ ///
+ /// The objects that should be included.
+ /// Specify what member types to include.
+ /// Specify which members to exclude.
+ /// The Binding Flags that the members should have.
+ /// A History Point with Object States.
+ public static HistoryPoint FromObject(object[] objs, ObjectValueType membersToStore, MemberBlackList blackList, BindingFlags flags)
+ {
+ return FromObject(objs, membersToStore, (object)blackList, flags);
+ }
+
+ ///
+ /// Creates an History Point with Object States automaticly from input.
+ ///
+ /// The objects that should be included.
+ /// Specify what member types to include.
+ /// Specify which members to include.
+ /// The Binding Flags that the members should have.
+ /// A History Point with Object States.
+ private static HistoryPoint FromObject(object[] objs, ObjectValueType membersToStore, object? whiteOrBlackList, BindingFlags flags)
+ {
+ var hp = new HistoryPoint();
+
+ whiteOrBlackList ??= new MemberBlackList();
+ var isWhiteList = whiteOrBlackList is MemberWhiteList;
+
+ if (flags == BindingFlags.Default)
+ flags = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic;
+
+ if (membersToStore == ObjectValueType.None)
+ membersToStore = ObjectValueType.Field | ObjectValueType.Property;
+
+ foreach (var obj in objs)
+ {
+ if ((membersToStore & ObjectValueType.Field) == ObjectValueType.Field)
+ {
+ foreach (var fi in obj.GetType().GetFields(flags))
+ {
+ var contains = ((List)whiteOrBlackList).Contains(fi.Name);
+ if (isWhiteList ? contains : !contains)
+ {
+ var os = new ObjectState
+ {
+ Object = obj,
+ MemberName = fi.Name,
+ MemberType = ObjectValueType.Field,
+ MemberFlags = flags,
+ ValueToPatch = fi.GetValue(obj)
+ };
+ hp.Entries.Add(os);
+ }
+ }
+ }
+
+ if ((membersToStore & ObjectValueType.Property) == ObjectValueType.Property)
+ {
+ foreach (var pi in obj.GetType().GetProperties(flags))
+ {
+ var contains = ((List)whiteOrBlackList).Contains(pi.Name);
+ if (isWhiteList ? contains : !contains)
+ {
+ var os = new ObjectState
+ {
+ Object = obj,
+ MemberName = pi.Name,
+ MemberType = ObjectValueType.Property,
+ MemberFlags = flags,
+ ValueToPatch = pi.GetValue(obj)
+ };
+ hp.Entries.Add(os);
+ }
+ }
+ }
+ }
+
+ return hp;
+ }
+
+ ///
+ /// Combines some History Points to one.
+ ///
+ /// An array of History Points to combine.
+ /// One History Point that contains all Data of inputted History Points.
+ public static HistoryPoint Concat(params HistoryPoint[] hps)
+ {
+ return Concat(null, hps);
+ }
+
+ ///
+ /// Combines some History Points to one.
+ ///
+ /// An array of History Points to combine.
+ /// The new name for the History Point after concating.
+ /// One History Point that contains all Data of inputted History Points.
+ public static HistoryPoint Concat(string? newName, params HistoryPoint[] hps)
+ {
+ var hp = new HistoryPoint();
+
+ foreach (var _hp in hps)
+ hp.Entries.AddRange(_hp.Entries);
+
+ if (newName != null)
+ hp.Name = newName;
+ else
+ hp.Name = hps.FirstOrDefault()?.Name ?? string.Empty;
+
+ return hp;
+ }
+
+}
\ No newline at end of file
diff --git a/Pilz.Collections/SimpleHistory/HistoryPoint.vb b/Pilz.Collections/SimpleHistory/HistoryPoint.vb
deleted file mode 100644
index daf5755..0000000
--- a/Pilz.Collections/SimpleHistory/HistoryPoint.vb
+++ /dev/null
@@ -1,543 +0,0 @@
-Imports System.Reflection
-
-Namespace SimpleHistory
-
- '''
- ''' Represent some Object States and Actions.
- '''
- Public Class HistoryPoint
-
- '''
- ''' Represents the Name of this History Point
- '''
- '''
- Public Property Name As String = ""
- '''
- ''' A List of Object States and Actions.
- '''
- '''
- Public ReadOnly Property Entries As New List(Of ObjectBase)
- '''
- ''' Some data can be refered on this HistoryPoint. Don't know, in some situations this can be helpful.
- '''
- Public ReadOnly Tag As Object = Nothing
-
- Public Function HasEntries(Of T As ObjectBase)() As Boolean
- Return Entries.Where(Function(n) TypeOf n Is T).Count > 0
- End Function
-
- Friend Sub Undo()
- For Each s As ObjectBase In Entries.OrderBy(Function(n) n.UndoPriority)
- If TypeOf s Is ObjectState Then
- CType(s, ObjectState).Patch()
- ElseIf TypeOf s Is ObjectAction Then
- CType(s, ObjectAction).Undo()
- End If
- Next
- End Sub
-
- Friend Sub Redo()
- For Each s As ObjectBase In Entries.OrderBy(Function(n) n.RedoPriority)
- If TypeOf s Is ObjectState Then
- CType(s, ObjectState).Patch()
- ElseIf TypeOf s Is ObjectAction Then
- CType(s, ObjectAction).Redo()
- End If
- Next
- End Sub
-
- '''
- ''' Creates an History Point with Object States automaticly from input.
- '''
- ''' The objects that should be included.
- ''' Specify which members to include.
- ''' A History Point with Object States.
- Public Shared Function FromObject(obj As Object(), whiteList As MemberWhiteList) As HistoryPoint
- Return FromObject({obj}, ObjectValueType.None, CObj(whiteList), BindingFlags.Default)
- End Function
- '''
- ''' Creates an History Point with Object States automaticly from input.
- '''
- ''' The objects that should be included.
- ''' Specify which members to exclude.
- ''' A History Point with Object States.
- Public Shared Function FromObject(obj As Object(), blackList As MemberBlackList) As HistoryPoint
- Return FromObject({obj}, ObjectValueType.None, CObj(blackList), BindingFlags.Default)
- End Function
-
- '''
- ''' Creates an History Point with Object States automaticly from input.
- '''
- ''' The objects that should be included.
- ''' The member names to include.
- ''' A History Point with Object States.
- Public Shared Function FromObject(obj As Object(), ParamArray memberName As String()) As HistoryPoint
- Return FromObject(obj, True, memberName)
- End Function
- '''
- ''' Creates an History Point with Object States automaticly from input.
- '''
- ''' The objects that should be included.
- ''' If true, the memberName-Array has member names that should be included.
- ''' The member names to include/exclude.
- ''' A History Point with Object States.
- Public Shared Function FromObject(obj As Object(), isWhiteList As Boolean, ParamArray memberName As String()) As HistoryPoint
- If isWhiteList Then
- Return FromObject({obj}, ObjectValueType.None, CObj(New MemberWhiteList(memberName)), BindingFlags.Default)
- Else
- Return FromObject({obj}, ObjectValueType.None, CObj(New MemberBlackList(memberName)), BindingFlags.Default)
- End If
- End Function
- '''
- ''' Creates an History Point with Object States automaticly from input.
- '''
- ''' The objects that should be included.
- ''' Specify what member types to include.
- ''' The member names to include.
- ''' A History Point with Object States.
- Public Shared Function FromObject(obj As Object(), membersToStore As ObjectValueType, ParamArray memberName As String()) As HistoryPoint
- Return FromObject(obj, membersToStore, True, memberName)
- End Function
- '''
- ''' Creates an History Point with Object States automaticly from input.
- '''
- ''' The objects that should be included.
- ''' Specify what member types to include.
- ''' If true, the memberName-Array has member names that should be included.
- ''' The member names to include/exclude.
- ''' A History Point with Object States.
- Public Shared Function FromObject(obj As Object(), membersToStore As ObjectValueType, isWhiteList As Boolean, ParamArray memberName As String()) As HistoryPoint
- If isWhiteList Then
- Return FromObject({obj}, membersToStore, CObj(New MemberWhiteList(memberName)), BindingFlags.Default)
- Else
- Return FromObject({obj}, membersToStore, CObj(New MemberBlackList(memberName)), BindingFlags.Default)
- End If
- End Function
- '''
- ''' Creates an History Point with Object States automaticly from input.
- '''
- ''' The objects that should be included.
- ''' The Binding Flags that the members should have.
- ''' The member names to include.
- ''' A History Point with Object States.
- Public Shared Function FromObject(obj As Object(), flags As BindingFlags, ParamArray memberName As String()) As HistoryPoint
- Return FromObject(obj, flags, True, memberName)
- End Function
- '''
- ''' Creates an History Point with Object States automaticly from input.
- '''
- ''' The objects that should be included.
- ''' The Binding Flags that the members should have.
- ''' If true, the memberName-Array has member names that should be included.
- ''' The member names to include/exclude.
- ''' A History Point with Object States.
- Public Shared Function FromObject(obj As Object(), flags As BindingFlags, isWhiteList As Boolean, ParamArray memberName As String()) As HistoryPoint
- If isWhiteList Then
- Return FromObject({obj}, ObjectValueType.None, CObj(New MemberWhiteList(memberName)), flags)
- Else
- Return FromObject({obj}, ObjectValueType.None, CObj(New MemberBlackList(memberName)), flags)
- End If
- End Function
- '''
- ''' Creates an History Point with Object States automaticly from input.
- '''
- ''' The objects that should be included.
- ''' Specify what member types to include.
- ''' The Binding Flags that the members should have.
- ''' The member names to include.
- ''' A History Point with Object States.
- Public Shared Function FromObject(obj As Object(), membersToStore As ObjectValueType, flags As BindingFlags, ParamArray memberName As String()) As HistoryPoint
- Return FromObject(obj, flags, True, memberName)
- End Function
- '''
- ''' Creates an History Point with Object States automaticly from input.
- '''
- ''' The objects that should be included.
- ''' Specify what member types to include.
- ''' The Binding Flags that the members should have.
- ''' If true, the memberName-Array has member names that should be included.
- ''' The member names to include/exclude.
- ''' A History Point with Object States.
- Public Shared Function FromObject(obj As Object(), membersToStore As ObjectValueType, flags As BindingFlags, isWhiteList As Boolean, ParamArray memberName As String()) As HistoryPoint
- If isWhiteList Then
- Return FromObject({obj}, membersToStore, CObj(New MemberWhiteList(memberName)), flags)
- Else
- Return FromObject({obj}, membersToStore, CObj(New MemberBlackList(memberName)), flags)
- End If
- End Function
-
- '''
- ''' Creates an History Point with Object States automaticly from input.
- '''
- ''' The object that should be included.
- ''' Specify which members to include.
- ''' A History Point with Object States.
- Public Shared Function FromObject(obj As Object, whiteList As MemberWhiteList) As HistoryPoint
- Return FromObject({obj}, ObjectValueType.None, CObj(whiteList), BindingFlags.Default)
- End Function
- '''
- ''' Creates an History Point with Object States automaticly from input.
- '''
- ''' The object that should be included.
- ''' Specify which members to exclude.
- ''' A History Point with Object States.
- Public Shared Function FromObject(obj As Object, blackList As MemberBlackList) As HistoryPoint
- Return FromObject({obj}, ObjectValueType.None, CObj(blackList), BindingFlags.Default)
- End Function
-
- '''
- ''' Creates an History Point with Object States automaticly from input.
- '''
- ''' The object that should be included.
- ''' The member names to include/exclude.
- ''' A History Point with Object States.
- Public Shared Function FromObject(obj As Object, ParamArray memberName As String()) As HistoryPoint
- Return FromObject(obj, True, memberName)
- End Function
- '''
- ''' Creates an History Point with Object States automaticly from input.
- '''
- ''' The object that should be included.
- ''' If true, the memberName-Array has member names that should be included.
- ''' The member names to include/exclude.
- ''' A History Point with Object States.
- Public Shared Function FromObject(obj As Object, isWhiteList As Boolean, ParamArray memberName As String()) As HistoryPoint
- If isWhiteList Then
- Return FromObject({obj}, ObjectValueType.None, CObj(New MemberWhiteList(memberName)), BindingFlags.Default)
- Else
- Return FromObject({obj}, ObjectValueType.None, CObj(New MemberBlackList(memberName)), BindingFlags.Default)
- End If
- End Function
- '''
- ''' Creates an History Point with Object States automaticly from input.
- '''
- ''' The object that should be included.
- ''' Specify what member types to include.
- ''' The member names to include.
- ''' A History Point with Object States.
- Public Shared Function FromObject(obj As Object, membersToStore As ObjectValueType, ParamArray memberName As String()) As HistoryPoint
- Return FromObject(obj, membersToStore, True, memberName)
- End Function
- '''
- ''' Creates an History Point with Object States automaticly from input.
- '''
- ''' The object that should be included.
- ''' Specify what member types to include.
- ''' If true, the memberName-Array has member names that should be included.
- ''' The member names to include/exclude.
- ''' A History Point with Object States.
- Public Shared Function FromObject(obj As Object, membersToStore As ObjectValueType, isWhiteList As Boolean, ParamArray memberName As String()) As HistoryPoint
- If isWhiteList Then
- Return FromObject({obj}, membersToStore, CObj(New MemberWhiteList(memberName)), BindingFlags.Default)
- Else
- Return FromObject({obj}, membersToStore, CObj(New MemberBlackList(memberName)), BindingFlags.Default)
- End If
- End Function
- '''
- ''' Creates an History Point with Object States automaticly from input.
- '''
- ''' The object that should be included.
- ''' The Binding Flags that the members should have.
- ''' The member names to include.
- ''' A History Point with Object States.
- Public Shared Function FromObject(obj As Object, flags As BindingFlags, ParamArray memberName As String()) As HistoryPoint
- Return FromObject(obj, flags, True, memberName)
- End Function
- '''
- ''' Creates an History Point with Object States automaticly from input.
- '''
- ''' The object that should be included.
- ''' The Binding Flags that the members should have.
- ''' If true, the memberName-Array has member names that should be included.
- ''' The member names to include/exclude.
- ''' A History Point with Object States.
- Public Shared Function FromObject(obj As Object, flags As BindingFlags, isWhiteList As Boolean, ParamArray memberName As String()) As HistoryPoint
- If isWhiteList Then
- Return FromObject({obj}, ObjectValueType.None, CObj(New MemberWhiteList(memberName)), flags)
- Else
- Return FromObject({obj}, ObjectValueType.None, CObj(New MemberBlackList(memberName)), flags)
- End If
- End Function
- '''
- ''' Creates an History Point with Object States automaticly from input.
- '''
- ''' The object that should be included.
- ''' Specify what member types to include.
- ''' The Binding Flags that the members should have.
- ''' The member names to include.
- ''' A History Point with Object States.
- Public Shared Function FromObject(obj As Object, membersToStore As ObjectValueType, flags As BindingFlags, ParamArray memberName As String()) As HistoryPoint
- Return FromObject(obj, flags, True, memberName)
- End Function
- '''
- ''' Creates an History Point with Object States automaticly from input.
- '''
- ''' The object that should be included.
- ''' Specify what member types to include.
- ''' The Binding Flags that the members should have.
- ''' If true, the memberName-Array has member names that should be included.
- ''' The member names to include/exclude.
- ''' A History Point with Object States.
- Public Shared Function FromObject(obj As Object, membersToStore As ObjectValueType, flags As BindingFlags, isWhiteList As Boolean, ParamArray memberName As String()) As HistoryPoint
- If isWhiteList Then
- Return FromObject({obj}, membersToStore, CObj(New MemberWhiteList(memberName)), flags)
- Else
- Return FromObject({obj}, membersToStore, CObj(New MemberBlackList(memberName)), flags)
- End If
- End Function
-
- '''
- ''' Creates an History Point with Object States automaticly from input.
- '''
- ''' The object that should be included.
- ''' A History Point with Object States.
- Public Shared Function FromObject(obj As Object) As HistoryPoint
- Return FromObject({obj}, ObjectValueType.None, CObj(Nothing), BindingFlags.Default)
- End Function
- '''
- ''' Creates an History Point with Object States automaticly from input.
- '''
- ''' The object that should be included.
- ''' Specify what member types to include.
- ''' A History Point with Object States.
- Public Shared Function FromObject(obj As Object, membersToStore As ObjectValueType) As HistoryPoint
- Return FromObject({obj}, membersToStore, CObj(Nothing), BindingFlags.Default)
- End Function
- '''
- ''' Creates an History Point with Object States automaticly from input.
- '''
- ''' The object that should be included.
- ''' Specify what member types to include.
- ''' Specify which members to include.
- ''' A History Point with Object States.
- Public Shared Function FromObject(obj As Object, membersToStore As ObjectValueType, whiteList As MemberWhiteList) As HistoryPoint
- Return FromObject({obj}, membersToStore, CObj(whiteList), BindingFlags.Default)
- End Function
- '''
- ''' Creates an History Point with Object States automaticly from input.
- '''
- ''' The object that should be included.
- ''' Specify what member types to include.
- ''' Specify which members to exclude.
- ''' A History Point with Object States.
- Public Shared Function FromObject(obj As Object, membersToStore As ObjectValueType, blackList As MemberBlackList) As HistoryPoint
- Return FromObject({obj}, membersToStore, CObj(blackList), BindingFlags.Default)
- End Function
-
- '''
- ''' Creates an History Point with Object States automaticly from input.
- '''
- ''' The object that should be included.
- ''' The Binding Flags that the members should have.
- ''' A History Point with Object States.
- Public Shared Function FromObject(obj As Object, flags As BindingFlags) As HistoryPoint
- Return FromObject({obj}, ObjectValueType.None, CObj(Nothing), flags)
- End Function
- '''
- ''' Creates an History Point with Object States automaticly from input.
- '''
- ''' The object that should be included.
- ''' Specify what member types to include.
- ''' The Binding Flags that the members should have.
- ''' A History Point with Object States.
- Public Shared Function FromObject(obj As Object, membersToStore As ObjectValueType, flags As BindingFlags) As HistoryPoint
- Return FromObject({obj}, membersToStore, CObj(Nothing), flags)
- End Function
- '''
- ''' Creates an History Point with Object States automaticly from input.
- '''
- ''' The object that should be included.
- ''' Specify what member types to include.
- ''' Specify which members to include.
- ''' The Binding Flags that the members should have.
- ''' A History Point with Object States.
- Public Shared Function FromObject(obj As Object, membersToStore As ObjectValueType, whiteList As MemberWhiteList, flags As BindingFlags) As HistoryPoint
- Return FromObject({obj}, membersToStore, CObj(whiteList), flags)
- End Function
- '''
- ''' Creates an History Point with Object States automaticly from input.
- '''
- ''' The object that should be included.
- ''' Specify what member types to include.
- ''' Specify which members to exclude.
- ''' The Binding Flags that the members should have.
- ''' A History Point with Object States.
- Public Shared Function FromObject(obj As Object, membersToStore As ObjectValueType, blackList As MemberBlackList, flags As BindingFlags) As HistoryPoint
- Return FromObject({obj}, membersToStore, CObj(blackList), flags)
- End Function
-
- '''
- ''' Creates an History Point with Object States automaticly from input.
- '''
- ''' The objects that should be included.
- ''' A History Point with Object States.
- Public Shared Function FromObject(objs As Object()) As HistoryPoint
- Return FromObject(objs, ObjectValueType.None, CObj(Nothing), BindingFlags.Default)
- End Function
- '''
- ''' Creates an History Point with Object States automaticly from input.
- '''
- ''' The objects that should be included.
- ''' Specify what member types to include.
- ''' A History Point with Object States.
- Public Shared Function FromObject(objs As Object(), membersToStore As ObjectValueType) As HistoryPoint
- Return FromObject(objs, membersToStore, CObj(Nothing), BindingFlags.Default)
- End Function
- '''
- ''' Creates an History Point with Object States automaticly from input.
- '''
- ''' The objects that should be included.
- ''' Specify what member types to include.
- ''' Specify which members to include.
- ''' A History Point with Object States.
- Public Shared Function FromObject(objs As Object(), membersToStore As ObjectValueType, whiteList As MemberWhiteList) As HistoryPoint
- Return FromObject(objs, membersToStore, CObj(whiteList), BindingFlags.Default)
- End Function
- '''
- ''' Creates an History Point with Object States automaticly from input.
- '''
- ''' The objects that should be included.
- ''' Specify what member types to include.
- ''' Specify which members to exclude.
- ''' A History Point with Object States.
- Public Shared Function FromObject(objs As Object(), membersToStore As ObjectValueType, blackList As MemberBlackList) As HistoryPoint
- Return FromObject(objs, membersToStore, CObj(blackList), BindingFlags.Default)
- End Function
-
- '''
- ''' Creates an History Point with Object States automaticly from input.
- '''
- ''' The objects that should be included.
- ''' The Binding Flags that the members should have.
- ''' A History Point with Object States.
- Public Shared Function FromObject(objs As Object(), flags As BindingFlags) As HistoryPoint
- Return FromObject(objs, ObjectValueType.None, CObj(Nothing), flags)
- End Function
- '''
- ''' Creates an History Point with Object States automaticly from input.
- '''
- ''' The objects that should be included.
- ''' Specify what member types to include.
- ''' The Binding Flags that the members should have.
- ''' A History Point with Object States.
- Public Shared Function FromObject(objs As Object(), membersToStore As ObjectValueType, flags As BindingFlags) As HistoryPoint
- Return FromObject(objs, membersToStore, CObj(Nothing), flags)
- End Function
- '''
- ''' Creates an History Point with Object States automaticly from input.
- '''
- ''' The objects that should be included.
- ''' Specify what member types to include.
- ''' Specify which members to include.
- ''' The Binding Flags that the members should have.
- ''' A History Point with Object States.
- Public Shared Function FromObject(objs As Object(), membersToStore As ObjectValueType, whiteList As MemberWhiteList, flags As BindingFlags) As HistoryPoint
- Return FromObject(objs, membersToStore, CObj(whiteList), flags)
- End Function
- '''
- ''' Creates an History Point with Object States automaticly from input.
- '''
- ''' The objects that should be included.
- ''' Specify what member types to include.
- ''' Specify which members to exclude.
- ''' The Binding Flags that the members should have.
- ''' A History Point with Object States.
- Public Shared Function FromObject(objs As Object(), membersToStore As ObjectValueType, blackList As MemberBlackList, flags As BindingFlags) As HistoryPoint
- Return FromObject(objs, membersToStore, CObj(blackList), flags)
- End Function
-
- '''
- ''' Creates an History Point with Object States automaticly from input.
- '''
- ''' The objects that should be included.
- ''' Specify what member types to include.
- ''' Specify which members to include.
- ''' The Binding Flags that the members should have.
- ''' A History Point with Object States.
- Private Shared Function FromObject(objs As Object(), membersToStore As ObjectValueType, whiteOrBlackList As Object, flags As BindingFlags) As HistoryPoint
- Dim hp As New HistoryPoint
-
- If whiteOrBlackList Is Nothing Then whiteOrBlackList = New MemberBlackList
- Dim isWhiteList As Boolean = TypeOf whiteOrBlackList Is MemberWhiteList
-
- If flags = BindingFlags.Default Then
- flags = BindingFlags.Instance Or BindingFlags.Public Or BindingFlags.NonPublic
- End If
- If membersToStore = ObjectValueType.None Then
- membersToStore = ObjectValueType.Field Or ObjectValueType.Property
- End If
-
- For Each obj As Object In objs
- If (membersToStore And ObjectValueType.Field) = ObjectValueType.Field Then
-
- For Each fi As FieldInfo In obj.GetType.GetFields(flags)
-
- Dim contains As Boolean = CType(whiteOrBlackList, List(Of String)).Contains(fi.Name)
- If If(isWhiteList, contains, Not contains) Then
-
- Dim os As New ObjectState
- os.Object = obj
- os.MemberName = fi.Name
- os.MemberType = ObjectValueType.Field
- os.MemberFlags = flags
- os.ValueToPatch = fi.GetValue(obj)
- hp.Entries.Add(os)
-
- End If
-
- Next
-
- End If
-
- If (membersToStore And ObjectValueType.Property) = ObjectValueType.Property Then
-
- For Each pi As PropertyInfo In obj.GetType.GetProperties(flags)
-
- Dim contains As Boolean = CType(whiteOrBlackList, List(Of String)).Contains(pi.Name)
- If If(isWhiteList, contains, Not contains) Then
-
- Dim os As New ObjectState
- os.Object = obj
- os.MemberName = pi.Name
- os.MemberType = ObjectValueType.Property
- os.MemberFlags = flags
- os.ValueToPatch = pi.GetValue(obj)
- hp.Entries.Add(os)
-
- End If
-
- Next
-
- End If
- Next
-
- Return hp
- End Function
-
- '''
- ''' Combines some History Points to one.
- '''
- ''' An array of History Points to combine.
- ''' One History Point that contains all Data of inputted History Points.
- Public Shared Function Concat(ParamArray hps As HistoryPoint()) As HistoryPoint
- Return Concat(hps.FirstOrDefault?.Name, hps)
- End Function
-
- '''
- ''' Combines some History Points to one.
- '''
- ''' An array of History Points to combine.
- ''' One History Point that contains all Data of inputted History Points.
- Public Shared Function Concat(newName As String, ParamArray hps As HistoryPoint()) As HistoryPoint
- Dim hp As New HistoryPoint
-
- For Each _hp As HistoryPoint In hps
- hp.Entries.AddRange(_hp.Entries)
- Next
-
- Return hp
- End Function
-
- End Class
-
-End Namespace
diff --git a/Pilz.Collections/SimpleHistory/MemberLists.cs b/Pilz.Collections/SimpleHistory/MemberLists.cs
new file mode 100644
index 0000000..105135a
--- /dev/null
+++ b/Pilz.Collections/SimpleHistory/MemberLists.cs
@@ -0,0 +1,31 @@
+namespace Pilz.Collections.SimpleHistory;
+
+///
+/// List contianing member names to include.
+///
+public class MemberWhiteList : List
+{
+
+ public MemberWhiteList() : base()
+ {
+ }
+
+ public MemberWhiteList(string[] entries) : base(entries)
+ {
+ }
+}
+
+///
+/// List contianing member names to exclude
+///
+public class MemberBlackList : List
+{
+
+ public MemberBlackList() : base()
+ {
+ }
+
+ public MemberBlackList(string[] entries) : base(entries)
+ {
+ }
+}
\ No newline at end of file
diff --git a/Pilz.Collections/SimpleHistory/MemberLists.vb b/Pilz.Collections/SimpleHistory/MemberLists.vb
deleted file mode 100644
index 05fdf82..0000000
--- a/Pilz.Collections/SimpleHistory/MemberLists.vb
+++ /dev/null
@@ -1,33 +0,0 @@
-Namespace SimpleHistory
-
- '''
- ''' List contianing member names to include.
- '''
- Public Class MemberWhiteList
- Inherits List(Of String)
-
- Public Sub New()
- MyBase.New
- End Sub
-
- Public Sub New(entries As String())
- MyBase.New(entries)
- End Sub
- End Class
-
- '''
- ''' List contianing member names to exclude
- '''
- Public Class MemberBlackList
- Inherits List(Of String)
-
- Public Sub New()
- MyBase.New
- End Sub
-
- Public Sub New(entries As String())
- MyBase.New(entries)
- End Sub
- End Class
-
-End Namespace
\ No newline at end of file
diff --git a/Pilz.Collections/SimpleHistory/ObjectAction.cs b/Pilz.Collections/SimpleHistory/ObjectAction.cs
new file mode 100644
index 0000000..88f5d4c
--- /dev/null
+++ b/Pilz.Collections/SimpleHistory/ObjectAction.cs
@@ -0,0 +1,176 @@
+using System.Reflection;
+
+namespace Pilz.Collections.SimpleHistory;
+
+public class ObjectAction : ObjectBase
+{
+ public object? Object { get; set; } = null;
+ public List