diff --git a/Stack/Core/Stack/Bindings/BufferManager.cs b/Stack/Core/Stack/Bindings/BufferManager.cs old mode 100644 new mode 100755 index 3b6e5f49..f1368552 --- a/Stack/Core/Stack/Bindings/BufferManager.cs +++ b/Stack/Core/Stack/Bindings/BufferManager.cs @@ -135,7 +135,13 @@ public BufferManager(string name, int maxPoolSize, int maxBufferSize) /// The owner. /// The buffer content public byte[] TakeBuffer(int size, string owner) - { + { + #if ELBFISCH //#define ELBFISCH if you want to compile this code for Mono/.NET 3.5 (for use in Unity3D 5.5) + //a size of 65535 which is given by several owners for any reason fails at runtime + if (size > 65534) { + size = 65534; + } + #endif if (size > Int32.MaxValue - 5) { throw new ArgumentOutOfRangeException("size"); diff --git a/Stack/Core/Types/Encoders/BinaryDecoder.cs b/Stack/Core/Types/Encoders/BinaryDecoder.cs old mode 100644 new mode 100755 index f02a001e..2523eefd --- a/Stack/Core/Types/Encoders/BinaryDecoder.cs +++ b/Stack/Core/Types/Encoders/BinaryDecoder.cs @@ -466,8 +466,11 @@ public XmlElement ReadXmlElement(string fieldName) XmlDocument document = new XmlDocument(); string xmlString = new UTF8Encoding().GetString(bytes, 0, bytes.Length); - using (XmlReader reader = XmlReader.Create(new StringReader(xmlString), new XmlReaderSettings() - {DtdProcessing = System.Xml.DtdProcessing.Prohibit, ValidationType = ValidationType.None})) + using (XmlReader reader = XmlReader.Create(new StringReader(xmlString), new XmlReaderSettings() + #if !ELBFISCH //#define ELBFISCH if you want to compile this code for Mono/.NET 3.5 (for use in Unity3D 5.5) + {DtdProcessing = System.Xml.DtdProcessing.Prohibit, ValidationType = ValidationType.None} + #endif + )) { document.Load(reader); } diff --git a/Stack/Core/Types/Encoders/XmlDecoder.cs b/Stack/Core/Types/Encoders/XmlDecoder.cs old mode 100644 new mode 100755 index b2800946..8133d404 --- a/Stack/Core/Types/Encoders/XmlDecoder.cs +++ b/Stack/Core/Types/Encoders/XmlDecoder.cs @@ -558,7 +558,10 @@ public object ReadExtensionObjectBody(ExpandedNodeId typeId) xmlString = m_reader.ReadOuterXml(); using (XmlReader reader = XmlReader.Create(new StringReader(xmlString), new XmlReaderSettings() - { DtdProcessing = System.Xml.DtdProcessing.Prohibit, ValidationType = ValidationType.None })) + #if !ELBFISCH //#define ELBFISCH if you want to compile this code for Mono/.NET 3.5 (for use in Unity3D 5.5) + { DtdProcessing = System.Xml.DtdProcessing.Prohibit, ValidationType = ValidationType.None } + #endif + )) { document.Load(reader); } @@ -585,7 +588,10 @@ public object ReadExtensionObjectBody(ExpandedNodeId typeId) xmlString = m_reader.ReadOuterXml(); using (XmlReader reader = XmlReader.Create(new StringReader(xmlString), new XmlReaderSettings() - { DtdProcessing = System.Xml.DtdProcessing.Prohibit, ValidationType = ValidationType.None })) + #if !ELBFISCH //#define ELBFISCH if you want to compile this code for Mono/.NET 3.5 (for use in Unity3D 5.5) + { DtdProcessing = System.Xml.DtdProcessing.Prohibit, ValidationType = ValidationType.None } + #endif + )) { document.Load(reader); } diff --git a/Stack/Core/Types/Utils/HiResClock.cs b/Stack/Core/Types/Utils/HiResClock.cs old mode 100644 new mode 100755 index 289204ce..eb0f00fb --- a/Stack/Core/Types/Utils/HiResClock.cs +++ b/Stack/Core/Types/Utils/HiResClock.cs @@ -33,7 +33,7 @@ public static DateTime UtcNow { get { - #if !SILVERLIGHT + #if (!SILVERLIGHT && !ELBFISCH) //#define ELBFISCH if you want to compile this code for Mono/.NET 3.5 (for use in Unity3D 5.5) if (s_Default.m_disabled) { return DateTime.UtcNow; @@ -41,7 +41,7 @@ public static DateTime UtcNow long counter = 0; - if (NativeMethods.QueryPerformanceCounter(out counter) == 0) + if (NativeMethods.QueryPerformanceCounter(out counter) == 0) { return DateTime.UtcNow; } @@ -71,12 +71,12 @@ public static bool Disabled } } - /// + /// /// Constructs a class. /// private HiResClock() { - #if !SILVERLIGHT + #if (!SILVERLIGHT && !ELBFISCH) //#define ELBFISCH if you want to compile this code for Mono/.NET 3.5 (for use in Unity3D 5.5) if (NativeMethods.QueryPerformanceFrequency(out m_frequency) == 0) { m_frequency = TimeSpan.TicksPerSecond; @@ -101,7 +101,8 @@ private HiResClock() /// /// Defines the native methods used by the class. /// - private static class NativeMethods + #if !ELBFISCH + private static class NativeMethods { [DllImport("Kernel32.dll")] public static extern int QueryPerformanceFrequency(out long lpFrequency); @@ -109,8 +110,9 @@ private static class NativeMethods [DllImport("Kernel32.dll")] public static extern int QueryPerformanceCounter(out long lpFrequency); } + #endif - #if !SILVERLIGHT + #if !SILVERLIGHT && !ELBFISCH //#define ELBFISCH if you want to compile this code for Mono/.NET 3.5 (for use in Unity3D 5.5) private long m_frequency; private long m_baseline; private long m_offset; diff --git a/Stack/Core/UA Core Library.csproj b/Stack/Core/UA Core Library.csproj index 42a1da40..8323a5e4 100644 --- a/Stack/Core/UA Core Library.csproj +++ b/Stack/Core/UA Core Library.csproj @@ -1,16 +1,14 @@  - + Debug AnyCPU - 9.0.30729 - 2.0 {7543AFCB-F5AF-44AF-83C9-23164474C1E9} Library Properties Opc.Ua Opc.Ua.Core - v4.5.1 + v3.5 512 true ..\..\Key\OPC Key Pair.snk @@ -41,12 +39,10 @@ full false bin\Debug\ - TRACE;DEBUG + TRACE;DEBUG;ELBFISCH prompt 4 false - - false @@ -61,7 +57,6 @@ - 3.5 @@ -83,6 +78,7 @@ + diff --git a/UA Core Library.userprefs b/UA Core Library.userprefs new file mode 100644 index 00000000..123ebacd --- /dev/null +++ b/UA Core Library.userprefs @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file