mirror of
				https://github.com/esiur/esiur-dotnet.git
				synced 2025-10-30 23:51:34 +00:00 
			
		
		
		
	AsyncReply
This commit is contained in:
		| @@ -48,6 +48,7 @@ public class Instance | ||||
|     List<ulong?> ages = new(); | ||||
|     List<DateTime?> modificationDates = new(); | ||||
|     private ulong instanceAge; | ||||
|     private byte hops; | ||||
|     private DateTime instanceModificationDate; | ||||
|  | ||||
|     uint id; | ||||
| @@ -389,6 +390,16 @@ public class Instance | ||||
|         internal set { instanceAge = value; } | ||||
|     } | ||||
|  | ||||
|     /// <summary> | ||||
|     /// Number of nodes to reach the original resource. | ||||
|     /// </summary> | ||||
|     public ulong Hops | ||||
|     { | ||||
|         get { return hops; } | ||||
|         internal set { hops = value; } | ||||
|     } | ||||
|  | ||||
|  | ||||
|     /// <summary> | ||||
|     /// Last modification date. | ||||
|     /// </summary> | ||||
| @@ -443,7 +454,7 @@ public class Instance | ||||
|     /// <returns></returns> | ||||
|     public PropertyValue[] Serialize() | ||||
|     { | ||||
|         List<PropertyValue> props = new List<PropertyValue>(); | ||||
|         var props = new List<PropertyValue>(); | ||||
|  | ||||
|         foreach (var pt in template.Properties) | ||||
|         { | ||||
| @@ -459,6 +470,33 @@ public class Instance | ||||
|         return props.ToArray(); | ||||
|     } | ||||
|  | ||||
|     /// <summary> | ||||
|     /// Export all properties with ResourceProperty attributed as bytes array after a specific age. | ||||
|     /// </summary> | ||||
|     /// <returns></returns> | ||||
|     public Map<byte, PropertyValue> SerializeAfter(ulong age = 0) | ||||
|     { | ||||
|         var props = new Map<byte, PropertyValue>(); | ||||
|  | ||||
|         foreach (var pt in template.Properties) | ||||
|         { | ||||
|             IResource res; | ||||
|             if (resource.TryGetTarget(out res)) | ||||
|             { | ||||
|                 if (res.Instance.GetAge(pt.Index) > age) | ||||
|                 { | ||||
|                     var rt = pt.PropertyInfo.GetValue(res, null); | ||||
|                     props.Add(pt.Index, | ||||
|                         new PropertyValue(rt,  | ||||
|                         ages[pt.Index],  | ||||
|                         modificationDates[pt.Index])); | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|  | ||||
|         return props; | ||||
|     } | ||||
|  | ||||
|     /* | ||||
|     public bool Deserialize(byte[] data, uint offset, uint length) | ||||
|     { | ||||
| @@ -588,7 +626,7 @@ public class Instance | ||||
|         } | ||||
|     } | ||||
|  | ||||
|   | ||||
|  | ||||
|  | ||||
|     //        internal void EmitResourceEvent(string name, string[] users, DistributedConnection[] connections, object[] args) | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user