| 
					
				 | 
			
			
				@@ -5,10 +5,10 @@ using System.Linq; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 using System.Reflection; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 using System.Runtime.InteropServices; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 using System.Text; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-using WCS.Core.DataTrans; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+using WCS.Core.IL; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 using WCS.Entity; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-namespace WCS.Core 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+namespace WCS.Core.DataTrans 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     public static class Extentions 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -80,7 +80,7 @@ namespace WCS.Core 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     if (!ToBytesMethods.TryGetValue(t, out mi)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        var ms = typeof(BitConverter).GetMethods(System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Static); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        var ms = typeof(BitConverter).GetMethods(BindingFlags.Public | BindingFlags.Static); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         ms = ms.Where(v => v.Name == "GetBytes").ToArray(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         mi = ms.FirstOrDefault(v => v.GetParameters()[0].ParameterType == t); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         ToBytesMethods.Add(t, mi); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -107,7 +107,7 @@ namespace WCS.Core 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 foreach (var o in obj as Array) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    var data = GetData(o); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    var data = o.GetData(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     st.Write(data, 0, data.Length); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -227,7 +227,7 @@ namespace WCS.Core 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 while (i < data.Length) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    var obj = GetObj(data.Skip(i).Take(datasize).ToArray(), t, datasize); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    var obj = data.Skip(i).Take(datasize).ToArray().GetObj(t, datasize); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     lst.Add(obj); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     i += datasize; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 } 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -265,7 +265,7 @@ namespace WCS.Core 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         /// <returns></returns> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         public static ushort SetBit(this ushort value, int position, bool flag) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            return SetBits(value, position, 1, flag ? (byte)1 : (byte)0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return value.SetBits(position, 1, flag ? (byte)1 : (byte)0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         /// <summary> 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -280,7 +280,7 @@ namespace WCS.Core 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             if (length <= 0 || position >= 16) return value; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            var mask = (2 << (length - 1)) - 1; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            var mask = (2 << length - 1) - 1; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             value &= (ushort)~(mask << position); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             value |= (ushort)((bits & mask) << position); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -296,7 +296,7 @@ namespace WCS.Core 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         /// <returns></returns> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         public static bool GetBit(this ushort value, int position) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            return GetBits(value, position, 1) == 1; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return value.GetBits(position, 1) == 1; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         /// <summary> 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -310,9 +310,9 @@ namespace WCS.Core 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             if (length <= 0 || position >= 16) return 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            var mask = (2 << (length - 1)) - 1; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            var mask = (2 << length - 1) - 1; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            return (ushort)((value >> position) & mask); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return (ushort)(value >> position & mask); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         #endregion ushort 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -330,7 +330,7 @@ namespace WCS.Core 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             if (position >= 8) return value; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            var mask = (2 << (1 - 1)) - 1; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            var mask = (2 << 1 - 1) - 1; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             value &= (byte)~(mask << position); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             value |= (byte)(((flag ? 1 : 0) & mask) << position); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -348,9 +348,9 @@ namespace WCS.Core 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             if (position >= 8) return false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            var mask = (2 << (1 - 1)) - 1; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            var mask = (2 << 1 - 1) - 1; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            return (byte)((value >> position) & mask) == 1; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return (byte)(value >> position & mask) == 1; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         #endregion byte 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -366,7 +366,7 @@ namespace WCS.Core 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         /// <returns></returns> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         public static uint SetBit(this uint value, int position, bool flag) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            return SetBits(value, position, 1, flag ? (byte)1 : (byte)0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return value.SetBits(position, 1, flag ? (byte)1 : (byte)0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         /// <summary> 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -381,7 +381,7 @@ namespace WCS.Core 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             if (length <= 0 || position >= 32) return value; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            var mask = (2 << (length - 1)) - 1; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            var mask = (2 << length - 1) - 1; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             value &= (uint)~(mask << position); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             value |= (uint)((bits & mask) << position); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -397,7 +397,7 @@ namespace WCS.Core 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         /// <returns></returns> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         public static bool GetBit(this uint value, int position) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            return GetBits(value, position, 1) == 1; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return value.GetBits(position, 1) == 1; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         /// <summary> 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -411,9 +411,9 @@ namespace WCS.Core 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             if (length <= 0 || position >= 32) return 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            var mask = (2 << (length - 1)) - 1; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            var mask = (2 << length - 1) - 1; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            return (uint)((value >> position) & mask); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return (uint)(value >> position & mask); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         #endregion uint 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -429,7 +429,7 @@ namespace WCS.Core 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         /// <returns></returns> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         public static ulong SetBit(this ulong value, int position, bool flag) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            return SetBits(value, position, 1, flag ? (byte)1 : (byte)0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return value.SetBits(position, 1, flag ? (byte)1 : (byte)0); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         /// <summary> 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -444,7 +444,7 @@ namespace WCS.Core 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             if (length <= 0 || position >= 64) return value; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            var mask = (ulong)(2 << (length - 1)) - 1; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            var mask = (ulong)(2 << length - 1) - 1; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             value &= ~(mask << position); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             value |= (bits & mask) << position; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -460,7 +460,7 @@ namespace WCS.Core 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         /// <returns></returns> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         public static bool GetBit(this ulong value, int position) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            return GetBits(value, position, 1) == 1; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return value.GetBits(position, 1) == 1; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         /// <summary> 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -474,9 +474,9 @@ namespace WCS.Core 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             if (length <= 0 || position >= 64) return 0; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            var mask = (ulong)(2 << (length - 1)) - 1; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            var mask = (ulong)(2 << length - 1) - 1; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            return (value >> position) & mask; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return value >> position & mask; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         #endregion ulong 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -490,7 +490,7 @@ namespace WCS.Core 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         public static T Data<T>(this WCS_DEVICEPROTOCOL obj) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            return (T)Data(obj); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            return (T)obj.Data(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         public static object Data(this WCS_DEVICEPROTOCOL obj) 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -499,7 +499,7 @@ namespace WCS.Core 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 var type = typeof(Generator<,>); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 type = type.MakeGenericType(obj.DB.GetProtocolType(), Configs.ProtocolProxyBaseType); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                var m = type.GetMethod("Create", System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Static); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                var m = type.GetMethod("Create", BindingFlags.Public | BindingFlags.Static); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 Datas[obj] = m.Invoke(null, new object[] { new object[] { obj.DEVICE.CODE.ToString(), obj.DB, (ushort)obj.POSITION, obj } }); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             return Datas[obj]; 
			 |