public void loadFromXML(XmlTextReader aXMLTextReader)
 {
     var lReader = new XMLAttributeReader(aXMLTextReader);
     mType       = StringUtils.parseType(lReader.getAttribute<String>("DataType"));
     mArray      = lReader.getAttribute<Boolean>("Array", mArray);
     mReverse    = lReader.getAttribute<Boolean>("Reverse", mReverse);
 }
Esempio n. 2
0
        public void             loadFromXML(XmlTextReader aXMLTextReader)
        {
            var lReader = new XMLAttributeReader(aXMLTextReader);

            LabelText  = lReader.getAttribute <String>("ToolTip", "");
            LayoutType = lReader.getAttribute <String>("Type", "");
        }
Esempio n. 3
0
        public void                     loadFromXML(XmlTextReader aXMLTextReader)
        {
            var lReader = new XMLAttributeReader(aXMLTextReader);

            LabelText = lReader.getAttribute <String>("Text", "");
            RightLeft = lReader.getAttribute <Boolean>("RightLeft", mRightLeft);
        }
Esempio n. 4
0
        public void                                     loadFromXML(XmlTextReader aXMLTextReader)
        {
            clear();

            var lReader = new XMLAttributeReader(aXMLTextReader);

            BackgroundColor = lReader.getAttribute <Color>("BackgroundColor", BackgroundColor);
            IsContainer     = lReader.getAttribute <Boolean>("Conteiner", IsContainer);

            if (aXMLTextReader.IsEmptyElement == false)
            {
                aXMLTextReader.Read();
                if (aXMLTextReader.Name.Equals("Elements", StringComparison.Ordinal))
                {
                    if (aXMLTextReader.IsEmptyElement == false)
                    {
                        aXMLTextReader.Read();
                        IVectorElement lElement;
                        while (mElementTypeByName.ContainsKey(aXMLTextReader.Name))
                        {
                            lElement = (IVectorElement)Activator.CreateInstance(mElementTypeByName[aXMLTextReader.Name]);
                            lElement.loadFromXML(aXMLTextReader);
                            mElements.Add(lElement);

                            aXMLTextReader.Read();
                        }
                    }

                    aXMLTextReader.Read();
                }
            }
        }
Esempio n. 5
0
        public IConnection  createFromXML(XmlTextReader aXMLTextReader)
        {
            var lConnection = new Connection();
            var lReader     = new XMLAttributeReader(aXMLTextReader);

            lConnection.mTransport = (ETransportType)Enum.Parse(typeof(ETransportType), lReader.getAttribute <String>("Transport"));

            if (lConnection.mTransport == ETransportType.TCP)
            {
                lConnection.IP     = lReader.getAttribute <String>("IP");
                lConnection.IPPort = lReader.getAttribute <Int32>("IPPort");
            }
            else if (lConnection.mTransport == ETransportType.SERIAL)
            {
                lConnection.COMPort   = lReader.getAttribute <String>("Port");
                lConnection.Baud      = lReader.getAttribute <Int32>("Baud");
                lConnection.DataBits  = lReader.getAttribute <Int32>("DataBits");
                lConnection.mParity   = (System.IO.Ports.Parity)Enum.Parse(typeof(System.IO.Ports.Parity), lReader.getAttribute <String>("Parity"));
                lConnection.mStopBits = (System.IO.Ports.StopBits)Enum.Parse(typeof(System.IO.Ports.StopBits), lReader.getAttribute <String>("StopBits"));
                lConnection.mProtocol = (EProtocol)Enum.Parse(typeof(EProtocol), lReader.getAttribute <String>("Protocol"));
            }

            lConnection.TimeoutMS = lReader.getAttribute <UInt32>("Timeout", lConnection.TimeoutMS);
            lConnection.mErrorsBeforeDisconnect = lReader.getAttribute <UInt32>("ErrorsBeforeDisconnect", lConnection.mErrorsBeforeDisconnect);
            lConnection.PauseMS = lReader.getAttribute <UInt32>("Pause", lConnection.PauseMS);
            lConnection.Frame   = lReader.getAttribute <UInt32>("Frame", lConnection.Frame);

            return(lConnection);
        }
        public void                 loadFromXML(XmlTextReader aXMLTextReader)
        {
            var lReader = new XMLAttributeReader(aXMLTextReader);

            mReverse     = lReader.getAttribute <Boolean>("Reverse", mReverse);
            mTrueIfWrong = lReader.getAttribute <Boolean>("TrueIfWrong", mTrueIfWrong);

            object lTrueValue  = mTrueValue;
            object lFalseValue = mFalseValue;

            aXMLTextReader.Read();
            if (aXMLTextReader.Name.Equals("TrueValue", StringComparison.Ordinal))
            {
                lTrueValue = XMLUtils.loadValueFromXML(aXMLTextReader);
            }

            aXMLTextReader.Read();
            if (aXMLTextReader.Name.Equals("FalseValue", StringComparison.Ordinal))
            {
                lFalseValue = XMLUtils.loadValueFromXML(aXMLTextReader);
            }

            checkValues(lTrueValue, lFalseValue);
            mTrueValue  = lTrueValue;
            mFalseValue = lFalseValue;
        }
Esempio n. 7
0
        public IDataItem    createFromXML(IConnection aConnection, XmlTextReader aXMLTextReader)
        {
            var lConnection = (Connection)aConnection;
            var lReader     = new XMLAttributeReader(aXMLTextReader);

            return(lConnection.addItem(lReader.getAttribute <String>("NodeId"), lReader.getAttribute <Int32>("Sampling", 100)));
        }
Esempio n. 8
0
        public void                         loadFromXML(XmlTextReader aXMLTextReader)
        {
            var lReader = new XMLAttributeReader(aXMLTextReader);

            Language         = lReader.getAttribute <String>("Language");
            mValueItemHandle = mItemBrowser.getItemHandleByName(lReader.getAttribute <String>("Item"));

            mHolder.clear();
            if (aXMLTextReader.IsEmptyElement == false)
            {
                aXMLTextReader.Read();
                if (aXMLTextReader.Name.Equals("Commands", StringComparison.Ordinal))
                {
                    if (aXMLTextReader.IsEmptyElement == false)
                    {
                        mHolder.loadFromXML(aXMLTextReader, "Comand");
                    }

                    aXMLTextReader.Read();
                }
            }

            if (mHolder.Count == 0)
            {
                mHolder.add("Ok, Dave.", 0, false);
            }
        }
        public void                 loadFromXML(XmlTextReader aXMLTextReader)
        {
            XMLAttributeReader lReader = new XMLAttributeReader(aXMLTextReader);

            mValuesCompare.OperationName = lReader.getAttribute <String>("Operation");
            mValue = lReader.getAttribute <Double>("Value");
        }
        public void                 loadFromXML(XmlTextReader aXMLTextReader)
        {
            var lReader = new XMLAttributeReader(aXMLTextReader);

            LabelText = lReader.getAttribute <String>("ToolTip", "");

            string lSymbolName;

            aXMLTextReader.Read();
            if (aXMLTextReader.Name.Equals("True", StringComparison.Ordinal))
            {
                lSymbolName = lReader.getAttribute <String>("Name");
                mTrueSymbol = (ISymbol)Activator.CreateInstance(BooleanSymbolPanel.mSymbolTypeByName[lSymbolName]);
                aXMLTextReader.Read();
                mTrueSymbol.loadFromXML(aXMLTextReader);
                aXMLTextReader.Read();
            }

            aXMLTextReader.Read();
            while (aXMLTextReader.IsStartElement() == false && aXMLTextReader.EOF == false)
            {
                aXMLTextReader.Read();
            }

            if (aXMLTextReader.Name.Equals("False", StringComparison.Ordinal))
            {
                lSymbolName  = lReader.getAttribute <String>("Name");
                mFalseSymbol = (ISymbol)Activator.CreateInstance(BooleanSymbolPanel.mSymbolTypeByName[lSymbolName]);
                aXMLTextReader.Read();
                mFalseSymbol.loadFromXML(aXMLTextReader);
                aXMLTextReader.Read();
            }

            aXMLTextReader.Read();
        }
Esempio n. 11
0
        public void                 loadFromXML(XmlTextReader aXMLTextReader)
        {
            var lReader = new XMLAttributeReader(aXMLTextReader);

            mType    = StringUtils.parseType(lReader.getAttribute <String>("DataType"));
            mArray   = lReader.getAttribute <Boolean>("Array", mArray);
            mReverse = lReader.getAttribute <Boolean>("Reverse", mReverse);
        }
        public void                 loadFromXML(XmlTextReader aXMLTextReader)
        {
            var lReader = new XMLAttributeReader(aXMLTextReader);

            LabelText  = lReader.getAttribute <String>("ToolTip", "");
            TimeFrame  = lReader.getAttribute <Int32>("TimeFrame", mTimeFrame);
            TrendColor = lReader.getAttribute <Color>("Color", chart.Series[0].Color);
        }
Esempio n. 13
0
        public void                     loadFromXML(XmlTextReader aXMLTextReader)
        {
            var lReader = new XMLAttributeReader(aXMLTextReader);

            LabelText = lReader.getAttribute <String>("ToolTip", "");
            ShowUnits = lReader.getAttribute <Boolean>("ShowUnits", ShowUnits);
            Units     = lReader.getAttribute <String>("Units", "");
            Round     = lReader.getAttribute <Int32>("Round", Round);
        }
Esempio n. 14
0
        public void                     loadFromXML(XmlTextReader aXMLTextReader)
        {
            var lReader = new XMLAttributeReader(aXMLTextReader);

            LabelText  = lReader.getAttribute <String>("ToolTip", "");
            TrueText   = lReader.getAttribute <String>("TrueText", "");
            TrueColor  = lReader.getAttribute <Color>("TrueColor", TrueColor);
            FalseText  = lReader.getAttribute <String>("FalseText", "");
            FalseColor = lReader.getAttribute <Color>("FalseColor", FalseColor);
        }
Esempio n. 15
0
        public void         loadFromXML(XmlTextReader aXMLTextReader)
        {
            var    lReader = new XMLAttributeReader(aXMLTextReader);
            double lInMax  = lReader.getAttribute <Double>("InMax");
            double lInMin  = lReader.getAttribute <Double>("InMin");
            double lOutMax = lReader.getAttribute <Double>("OutMax");
            double lOutMin = lReader.getAttribute <Double>("OutMin");

            mValueScale.setProperties(lInMax, lInMin, lOutMax, lOutMin);
        }
        public void                 loadFromXML(XmlTextReader aXMLTextReader)
        {
            var lReader = new XMLAttributeReader(aXMLTextReader);

            mLineColor = lReader.getAttribute<Color>("Color", mLineColor);
            mLineWidth = lReader.getAttribute<UInt32>("Width", mLineWidth);
            initLinePen();

            Angle = lReader.getAttribute<Int32>("Angle", mAngle);
        }
Esempio n. 17
0
        public void                 loadFromXML(XmlTextReader aXMLTextReader)
        {
            var lReader = new XMLAttributeReader(aXMLTextReader);

            mBorderColor = lReader.getAttribute <Color>("BorderColor", mBorderColor);
            mBorderWidth = lReader.getAttribute <UInt32>("BorderWidth", mBorderWidth);
            initBorderPen();

            FillColor = lReader.getAttribute <Color>("FillColor", mFillColor);
        }
        public void                 loadFromXML(XmlTextReader aXMLTextReader)
        {
            var lReader = new XMLAttributeReader(aXMLTextReader);

            TextColor       = lReader.getAttribute <Color>("TextColor", TextColor);
            BackgroundColor = lReader.getAttribute <Color>("BackgroundColor", BackgroundColor);
            LabelFont       = lReader.getAttribute <Font>("Font", LabelFont);
            AutoResize      = lReader.getAttribute <Boolean>("AutoResize", false);
            Format          = lReader.getAttribute <String>("Format", Format);
        }
        public IConnection createFromXML(XmlTextReader aXMLTextReader)
        {
            Connection lConnection          = new Connection();
                XMLAttributeReader lReader      = new XMLAttributeReader(aXMLTextReader);

                lConnection.mInstanceNumber     = lReader.getAttribute<UInt32>("InstanceNumber", lConnection.mInstanceNumber);
                lConnection.mContinuousScan     = lReader.getAttribute<Boolean>("ContinuousScan", lConnection.mContinuousScan);
                lConnection.Slowdown            = lReader.getAttribute<UInt32>("Slowdown", lConnection.Slowdown);

                return lConnection;
        }
        public IConnection  createFromXML(XmlTextReader aXMLTextReader)
        {
            Connection         lConnection = new Connection();
            XMLAttributeReader lReader     = new XMLAttributeReader(aXMLTextReader);

            lConnection.mInstanceNumber = lReader.getAttribute <UInt32>("InstanceNumber", lConnection.mInstanceNumber);
            lConnection.mContinuousScan = lReader.getAttribute <Boolean>("ContinuousScan", lConnection.mContinuousScan);
            lConnection.Slowdown        = lReader.getAttribute <UInt32>("Slowdown", lConnection.Slowdown);

            return(lConnection);
        }
        public IDataItem            createFromXML(IConnection aConnection, XmlTextReader aXMLTextReader)
        {
            var lConnection = (Connection)aConnection;
            var lReader     = new XMLAttributeReader(aXMLTextReader);

            string lTopic     = lReader.getAttribute <String>("Topic");
            bool   lSubscribe = lReader.getAttribute <Boolean>("Subscribe", true);
            bool   lPublish   = lReader.getAttribute <Boolean>("Publish", true);
            string lValue     = lReader.getAttribute <String>("Value", "");

            return(lConnection.addItem(lTopic, lSubscribe, lPublish, lValue));
        }
        public void             loadFromXML(XmlTextReader aXMLTextReader)
        {
            var lReader = new XMLAttributeReader(aXMLTextReader);

            mLabelText       = lReader.getAttribute <String>("Text", "");
            mTextColor       = lReader.getAttribute <Color>("TextColor", mTextColor);
            mBackgroundColor = lReader.getAttribute <Color>("BackgroundColor", mBackgroundColor);
            mLabelFont       = lReader.getAttribute <Font>("Font", mLabelFont);
            mRotation        = (ERotation)Enum.Parse(typeof(ERotation), lReader.getAttribute <String>("Rotation", ERotation.Rotate0.ToString()));

            redraw();
        }
        public void                                         loadFromXML(XmlTextReader aXMLTextReader)
        {
            var lReader = new XMLAttributeReader(aXMLTextReader);

            mWatchdogMS    = lReader.getAttribute <UInt32>("Watchdog", mWatchdogMS);
            mTriggerTimeMS = lReader.getAttribute <UInt32>("TriggerTime", mTriggerTimeMS);

            string lCode = "";

            if (aXMLTextReader.IsEmptyElement == false)
            {
                aXMLTextReader.Read();
                if (aXMLTextReader.Name.Equals("Script", StringComparison.Ordinal))
                {
                    if (aXMLTextReader.IsEmptyElement == false)
                    {
                        aXMLTextReader.Read();
                        lCode = aXMLTextReader.ReadString();
                    }
                }
            }

            var lErrors = check(lCode);

            if (lErrors.Length != 0)
            {
                throw new ArgumentException(getErrorMessage(lErrors[0].Item1, lErrors[0].Item2));
            }

            string lAliasCode;

            string[] lVarItems;

            var lCompilerResult = compile(lCode, out lAliasCode, out lVarItems);

            if (lCompilerResult.Errors.Count != 0)
            {
                foreach (CompilerError lError in lCompilerResult.Errors)
                {
                    if (lError.IsWarning == true)
                    {
                        Log.Info(getErrorMessage(lError.ErrorText, lError.Line));
                    }
                    else
                    {
                        throw new ArgumentException(getErrorMessage(lError.ErrorText, lError.Line));
                    }
                }
            }

            init(lCompilerResult, lAliasCode, lVarItems);
        }
Esempio n. 24
0
        public void                     loadFromXML(XmlTextReader aXMLTextReader)
        {
            var lReader = new XMLAttributeReader(aXMLTextReader);

            LabelText   = lReader.getAttribute <String>("ToolTip", "");
            NeedleColor = lReader.getAttribute <Color>("NeedleColor", NeedleColor);
            ReadOnly    = lReader.getAttribute <System.Boolean>("ReadOnly", ReadOnly);
            if (mMaxMinCfg)
            {
                double lMaximum = lReader.getAttribute <Double>("MaxValue", MaxValue);
                double lMinimum = lReader.getAttribute <Double>("MinValue", MinValue);
                setMaxMinValues(lMaximum, lMinimum);
            }
        }
        public void                 loadFromXML(XmlTextReader aXMLTextReader)
        {
            var lReader = new XMLAttributeReader(aXMLTextReader);

            LabelText = lReader.getAttribute <String>("ToolTip", "");
            Vertical  = lReader.getAttribute <Boolean>("Vertical", Vertical);
            Color     = lReader.getAttribute <Color>("Color", Color);
            if (mMaxMinCfg)
            {
                double lMaximum = lReader.getAttribute <Double>("MaxValue", MaxValue);
                double lMinimum = lReader.getAttribute <Double>("MinValue", MinValue);
                setMaxMinValues(lMaximum, lMinimum);
            }
        }
Esempio n. 26
0
        public void                                         loadFromXML(XmlTextReader aXMLTextReader)
        {
            var lReader  = new XMLAttributeReader(aXMLTextReader);
            var lChecker = new RepeatItemNameChecker();

            string lItem = lReader.getAttribute <String>("On", "");

            lChecker.addItemName(lItem);
            mOnItemHandle = mItemBrowser.getItemHandleByName(lItem);

            lItem = lReader.getAttribute <String>("Value");
            lChecker.addItemName(lItem);
            mValueItemHandle = mItemBrowser.getItemHandleByName(lItem);

            SignalString = lReader.getAttribute <String>("Signal");
            Bias         = lReader.getAttribute <Double>("Bias", mBias);
            Amplitude    = lReader.getAttribute <Double>("Amplitude", mAmplitude);
            PeriodMS     = lReader.getAttribute <UInt32>("PeriodMS", mPeriodMS);
            TurnMS       = lReader.getAttribute <UInt32>("TurnMS", mTurnMS);
            StartMS      = lReader.getAttribute <UInt32>("StartMS", mStartMS);

            try
            {
                mValue = (double)mItemBrowser.readItemValue(mValueItemHandle);
            }
            catch
            {
                if (mSignal > 0)
                {
                    mPeriodStartMS = MiscUtils.TimerMS - mStartMS;
                    mCurrentMS     = mStartMS;
                    mFSM.executeStateAction();
                }
            }
        }
        public void                 loadFromXML(XmlTextReader aXMLTextReader)
        {
            var lReader = new XMLAttributeReader(aXMLTextReader);

            LabelText       = lReader.getAttribute <String>("ToolTip", "");
            NeedleColor     = lReader.getAttribute <Color>("NeedleColor", NeedleColor);
            ScaleColor      = lReader.getAttribute <Color>("ScaleColor", ScaleColor);
            BodyColor       = lReader.getAttribute <Color>("BodyColor", BodyColor);
            Shadow          = lReader.getAttribute <Boolean>("Shadow", Shadow);
            ShadowColor     = lReader.getAttribute <Color>("ShadowColor", ShadowColor);
            LargeTickLength = lReader.getAttribute <Int32>("LargeTickLength", LargeTickLength);
            SmallTickLength = lReader.getAttribute <Int32>("SmallTickLength", SmallTickLength);
            LargeTickCount  = lReader.getAttribute <Int32>("LargeTickCount", LargeTickCount);
            SmallTickCount  = lReader.getAttribute <Int32>("SmallTickCount", SmallTickCount);
        }
Esempio n. 28
0
        public IConnection      createFromXML(XmlTextReader aXMLTextReader)
        {
            var lConnection = new Connection();
            var lReader     = new XMLAttributeReader(aXMLTextReader);

            lConnection.mIP             = CommunicationUtils.checkTCP_IP(lReader.getAttribute <String>("IP"));
            lConnection.Rack            = (int)lReader.getAttribute <UInt32>("Rack", (uint)lConnection.Rack);
            lConnection.Slot            = (int)lReader.getAttribute <UInt32>("Slot", (uint)lConnection.Slot);
            lConnection.mConnectionType = (EConnectionType)Enum.Parse(typeof(EConnectionType), lReader.getAttribute <String>("Type", lConnection.mConnectionType.ToString()));

            lConnection.Slowdown = lReader.getAttribute <UInt32>("Slowdown", lConnection.Slowdown);
            lConnection.mErrorsBeforeDisconnect = lReader.getAttribute <UInt32>("ErrorsBeforeDisconnect", lConnection.mErrorsBeforeDisconnect);

            return(lConnection);
        }
        public void                 loadFromXML(XmlTextReader aXMLTextReader)
        {
            var lReader = new XMLAttributeReader(aXMLTextReader);

            IsContainer = lReader.getAttribute <Boolean>("Conteiner", IsContainer);

            if (aXMLTextReader.IsEmptyElement == false)
            {
                aXMLTextReader.Read();
                if (aXMLTextReader.Name.Equals("Image", StringComparison.Ordinal))
                {
                    if (aXMLTextReader.IsEmptyElement == false)
                    {
                        aXMLTextReader.Read();
                        mImgMemStrm = new MemoryStream(Convert.FromBase64String(aXMLTextReader.ReadString()));
                    }
                }
            }

            if (mImgMemStrm == null)
            {
                throw new ArgumentException("Image does not exist. ");
            }

            try
            {
                mBmp = new Bitmap(mImgMemStrm);
            }
            catch (Exception lExc)
            {
                mImgMemStrm.Close();
                mImgMemStrm = null;
                throw new ArgumentException("Image is wrong. " + lExc.Message, lExc);
            }
        }
Esempio n. 30
0
        public IDataItem        createFromXML(IConnection aConnection, XmlTextReader aXMLTextReader)
        {
            Connection         lConnection = (Connection)aConnection;
            XMLAttributeReader lReader     = new XMLAttributeReader(aXMLTextReader);

            return(lConnection.addItem(lReader.getAttribute <String>("TagName")));
        }
        public void             loadFromXML(XmlTextReader aXMLTextReader)
        {
            var lReader = new XMLAttributeReader(aXMLTextReader);

            if (aXMLTextReader.IsEmptyElement == false)
            {
                aXMLTextReader.Read();

                string  lStateName;
                CSScipt lScript;
                while (aXMLTextReader.Name.Equals("State", StringComparison.Ordinal) && aXMLTextReader.IsStartElement())
                {
                    lStateName = lReader.getAttribute <string>("Name");
                    lScript    = new CSScipt(mItemBrowser);
                    try
                    {
                        lScript.loadFromXML(aXMLTextReader);
                    }
                    catch (Exception lExc)
                    {
                        throw new ArgumentException("State '" + lStateName + "'. " + lExc.Message, lExc);
                    }

                    addState(lStateName, lScript);

                    aXMLTextReader.Read();
                    aXMLTextReader.Read();
                }
            }

            check();
        }
        public void                                         loadFromXML(XmlTextReader aXMLTextReader)
        {
            var lReader  = new XMLAttributeReader(aXMLTextReader);
            var lChecker = new RepeatItemNameChecker();

            string lItem = lReader.getAttribute <String>("X");

            lChecker.addItemName(lItem);
            mXValueItemHandle = mItemBrowser.getItemHandleByName(lItem);

            lItem = lReader.getAttribute <String>("Y");
            lChecker.addItemName(lItem);
            mYValueItemHandle = mItemBrowser.getItemHandleByName(lItem);

            lItem = lReader.getAttribute <String>("Visible", "");
            lChecker.addItemName(lItem);
            mVisibleItemHandle = mItemBrowser.getItemHandleByName(lItem);

            if (aXMLTextReader.IsEmptyElement == false)
            {
                aXMLTextReader.Read();
                if (aXMLTextReader.Name.Equals("Image", StringComparison.Ordinal))
                {
                    if (aXMLTextReader.IsEmptyElement == false)
                    {
                        aXMLTextReader.Read();
                        mImgMemStrm = new MemoryStream(Convert.FromBase64String(aXMLTextReader.ReadString()));
                    }
                }
            }

            if (mImgMemStrm == null)
            {
                throw new ArgumentException("Image does not exist. ");
            }

            try
            {
                mBmp = new Bitmap(mImgMemStrm);
            }
            catch (Exception lExc)
            {
                mImgMemStrm.Close();
                mImgMemStrm = null;
                throw new ArgumentException("Image is wrong. " + lExc.Message, lExc);
            }
        }
        public IConnection createFromXML(XmlTextReader aXMLTextReader)
        {
            var lConnection     = new Connection();
                var lReader         = new XMLAttributeReader(aXMLTextReader);

                lConnection.mTypeChangeProhibited = lReader.getAttribute<Boolean>("TypeChangeProhibited", lConnection.mTypeChangeProhibited);

                return lConnection;
        }
        public IDataItem createFromXML(IConnection aConnection, XmlTextReader aXMLTextReader)
        {
            Connection lConnection  = (Connection)aConnection;
                var lReader             = new XMLAttributeReader(aXMLTextReader);

                string lAccessString    = lReader.getAttribute<String>("Access", "READ_WRITE");
                EAccess lAccess         = (EAccess)Enum.Parse(typeof(EAccess), lAccessString);
                object lValue           = XMLUtils.loadValueFromXML(aXMLTextReader);

                return lConnection.addItem(lAccess, lValue);
        }
        public IConnection createFromXML(XmlTextReader aXMLTextReader)
        {
            var lConnection         = new Connection();
                var lReader             = new XMLAttributeReader(aXMLTextReader);

                lConnection.mHost       = lReader.getAttribute<String>("BrokerHost", lConnection.mHost);
                lConnection.mPort       = (int)lReader.getAttribute<UInt32>("BrokerPort", (uint)lConnection.mPort);
                lConnection.mKeepAlive  = lReader.getAttribute<UInt16>("KeepAlive", lConnection.mKeepAlive);
                lConnection.Root        = lReader.getAttribute<String>("Root", lConnection.Root);
                lConnection.mLogin      = lReader.getAttribute<String>("Login", lConnection.mLogin);
                lConnection.mPassword   = lReader.getAttribute<String>("Password", lConnection.mPassword);
                lConnection.QOS         = lReader.getAttribute<Byte>("QoS", lConnection.QOS);
                lConnection.Protocol    = lReader.getAttribute<String>("Protocol", "Version_3_1_1");

                return lConnection;
        }
        public IDataItem createFromXML(IConnection aConnection, XmlTextReader aXMLTextReader)
        {
            Connection lConnection      = (Connection)aConnection;
                DataItem lItem              = new DataItem();
                XMLAttributeReader lReader  = new XMLAttributeReader(aXMLTextReader);

                lItem.mMemoryType = (EPLCMemoryType)Enum.Parse(typeof(EPLCMemoryType), lReader.getAttribute<String>("MemoryType"));
                if (lItem.mMemoryType == EPLCMemoryType.DB)
                {
                    lItem.DB = (int)lReader.getAttribute<UInt32>("DB");
                }

                lItem.DataType  = (PointDataTypeConstants)Enum.Parse(typeof(PointDataTypeConstants), lReader.getAttribute<String>("DataType"));
                lItem.Byte      = (int)lReader.getAttribute<UInt32>("Byte");

                if (lItem.DataType == PointDataTypeConstants.S7_Bit)
                {
                    lItem.Bit = (int)lReader.getAttribute<UInt32>("Bit");
                }
                else if (lItem.DataType == PointDataTypeConstants.S7_Byte || lItem.DataType == PointDataTypeConstants.S7_Word)
                {
                    lItem.Signed = lReader.getAttribute<Boolean>("Signed", lItem.Signed);
                }
                else if (lItem.DataType == PointDataTypeConstants.S7_DoubleWord)
                {
                    lItem.FloatingP = lReader.getAttribute<Boolean>("FloatingPoint", lItem.FloatingP);
                    if (lItem.FloatingP == false)
                    {
                        lItem.Signed = lReader.getAttribute<Boolean>("Signed", lItem.Signed);
                    }
                }

                if ((lItem.mMemoryType == EPLCMemoryType.I || lItem.mMemoryType == EPLCMemoryType.Q) && lItem.DataType != PointDataTypeConstants.S7_Bit)
                {
                    lItem.Length = (int)lReader.getAttribute<UInt32>("Length", 1);
                }

                lConnection.addItem(lItem);

                return lItem;
        }
        public void loadFromXML(XmlTextReader aXMLTextReader)
        {
            var lReader     = new XMLAttributeReader(aXMLTextReader);
                var lChecker    = new RepeatItemNameChecker();

                string lItem = lReader.getAttribute<String>("Remote", "");
                lChecker.addItemName(lItem);
                mRemoteItemHandle = mItemBrowser.getItemHandleByName(lItem);

                uint lUInt = lReader.getAttribute<UInt32>("TravelMS", mTravelMS);
                if (lUInt < MinTravelMS)
                {
                    throw new ArgumentException("Travel time of valve has to be equal or more than " + StringUtils.ObjectToString(MinTravelMS) + ". ");
                }
                TravelMS = lUInt;

                lUInt = lReader.getAttribute<UInt32>("LimitSwitchMS", mLimitSwitchMS);
                if (lUInt == 0)
                {
                    throw new ArgumentException("Limit switch time of valve has to be more than 0. ");
                }
                LimitSwitchMS = lUInt;

                mAnalogCtrl     = lReader.getAttribute<Boolean>("AnalogControl", mAnalogCtrl);

                double lMax, lMin;
                lItem = lReader.getAttribute<String>("PositionCMD", "");
                lChecker.addItemName(lItem);
                mPositionCMDItemHandle = mItemBrowser.getItemHandleByName(lItem);

                lMax = lReader.getAttribute<Double>("PositionCMDMax", mPositionCMDScale.InMax);
                lMin = lReader.getAttribute<Double>("PositionCMDMin", mPositionCMDScale.InMin);
                mPositionCMDScale.setProperties(lMax, lMin, 100.0D, 0.0D);

                lItem = lReader.getAttribute<String>("OpenCMD", "");
                lChecker.addItemName(lItem);
                mOpenCMDItemHandle = mItemBrowser.getItemHandleByName(lItem);

                lItem = lReader.getAttribute<String>("CloseCMD", "");
                lChecker.addItemName(lItem);
                mCloseCMDItemHandle = mItemBrowser.getItemHandleByName(lItem);

                lItem = lReader.getAttribute<String>("StopCMD", "");
                lChecker.addItemName(lItem);
                mStopCMDItemHandle = mItemBrowser.getItemHandleByName(lItem);

                mImpulseCtrl = lReader.getAttribute<Boolean>("ImpulseControl", mImpulseCtrl);

                lItem = lReader.getAttribute<String>("EsdCMD", "");
                lChecker.addItemName(lItem);
                mEsdCMDItemHandle = mItemBrowser.getItemHandleByName(lItem);

                mEsdOpen = lReader.getAttribute<Boolean>("EsdOpen", mEsdOpen);

                lItem = lReader.getAttribute<String>("OpenLimit", "");
                lChecker.addItemName(lItem);
                mOpenLimitItemHandle = mItemBrowser.getItemHandleByName(lItem);

                lItem = lReader.getAttribute<String>("Opens", "");
                lChecker.addItemName(lItem);
                mOpensItemHandle = mItemBrowser.getItemHandleByName(lItem);

                lItem = lReader.getAttribute<String>("ClosedLimit", "");
                lChecker.addItemName(lItem);
                mClosedLimitItemHandle = mItemBrowser.getItemHandleByName(lItem);

                lItem = lReader.getAttribute<String>("Closes", "");
                lChecker.addItemName(lItem);
                mClosesItemHandle = mItemBrowser.getItemHandleByName(lItem);

                lItem = lReader.getAttribute<String>("Rotation", "");
                lChecker.addItemName(lItem);
                mRotationItemHandle = mItemBrowser.getItemHandleByName(lItem);

                lItem = lReader.getAttribute<String>("Position", "");
                lChecker.addItemName(lItem);
                mPositionItemHandle = mItemBrowser.getItemHandleByName(lItem);

                lMax = lReader.getAttribute<Double>("PositionMax", mPositionScale.InMax);
                lMin = lReader.getAttribute<Double>("PositionMin", mPositionScale.InMin);
                mPositionScale.setProperties(lMax, lMin, 100.0D, 0.0D);
                mFaultValue = lReader.getAttribute<Double>("FaultValue", mFaultValue);

                lItem = lReader.getAttribute<String>("Alarm1", "");
                lChecker.addItemName(lItem);
                mAlarm1ItemHandle = mItemBrowser.getItemHandleByName(lItem);

                lItem = lReader.getAttribute<String>("Alarm2", "");
                lChecker.addItemName(lItem);
                mAlarm2ItemHandle = mItemBrowser.getItemHandleByName(lItem);

                lItem = lReader.getAttribute<String>("Power", "");
                lChecker.addItemName(lItem);
                mPowerItemHandle = mItemBrowser.getItemHandleByName(lItem);
        }
 public void loadFromXML(XmlTextReader aXMLTextReader)
 {
     var lReader = new XMLAttributeReader(aXMLTextReader);
     LabelText   = lReader.getAttribute<String>("ToolTip", "");
 }
        public void loadFromXML(XmlTextReader aXMLTextReader)
        {
            var lReader     = new XMLAttributeReader(aXMLTextReader);
                var lChecker    = new RepeatItemNameChecker();

                string lItem = lReader.getAttribute<String>("Set");
                lChecker.addItemName(lItem);
                mSetItemHandle = mItemBrowser.getItemHandleByName(lItem);

                lItem = lReader.getAttribute<String>("Reset");
                lChecker.addItemName(lItem);
                mResetItemHandle = mItemBrowser.getItemHandleByName(lItem);

                lItem = lReader.getAttribute<String>("Value");
                lChecker.addItemName(lItem);
                mValueItemHandle = mItemBrowser.getItemHandleByName(lItem);

                SR_RS = lReader.getAttribute<Boolean>("SR_RS");
        }
        public void loadFromXML(XmlTextReader aXMLTextReader)
        {
            var lReader     = new XMLAttributeReader(aXMLTextReader);
                var lChecker    = new RepeatItemNameChecker();

                SendData        = lReader.getAttribute<Boolean>("SendData", SendData);
                UpdateRoKiSimMS = (int)lReader.getAttribute<UInt32>("UpdateRoKiSimMS", (uint)UpdateRoKiSimMS);

                if (aXMLTextReader.IsEmptyElement == false)
                {
                    aXMLTextReader.Read();
                    if (aXMLTextReader.Name.Equals("Joints", StringComparison.Ordinal))
                    {
                        if (aXMLTextReader.IsEmptyElement == false)
                        {
                            var lIndexSet = new HashSet<int>();
                            int lIndex;
                            int lArrayIndex;
                            string lItem;

                            aXMLTextReader.Read();
                            while (aXMLTextReader.Name.Equals("Joint", StringComparison.Ordinal))
                            {
                                lIndex = (int)lReader.getAttribute<UInt32>("Index");

                                if(lIndex == 0 || lIndex > 6)
                                {
                                    throw new ArgumentException("Wrong joint number. ");
                                }

                                if (lIndexSet.Add(lIndex) == false)
                                {
                                    throw new ArgumentException("Joint №" + lIndex.ToString() + " already exists. ");
                                }

                                lArrayIndex = lIndex - 1;

                                lItem = lReader.getAttribute<String>("SetPointItem", "");
                                lChecker.addItemName(lItem);
                                mAxisSPItemHandle[lArrayIndex] = mItemBrowser.getItemHandleByName(lItem);

                                mMaxSpeed[lArrayIndex] = lReader.getAttribute<Double>("MaxSpeed", mMaxSpeed[lArrayIndex]);
                                if (mMaxSpeed[lArrayIndex] <= 0.0D)
                                {
                                    throw new ArgumentException("Maximum speed of joint №" + lIndex.ToString() + " must be greater than zero. ");
                                }

                                lItem = lReader.getAttribute<String>("AngleItem", "");
                                lChecker.addItemName(lItem);
                                mAxisAngleItemHandle[lArrayIndex] = mItemBrowser.getItemHandleByName(lItem);

                                mMaxAngle[lArrayIndex] = lReader.getAttribute<Double>("MaxAngle", mMaxAngle[lArrayIndex]);
                                mMinAngle[lArrayIndex] = lReader.getAttribute<Double>("MinAngle", mMinAngle[lArrayIndex]);
                                if (mMaxAngle[lArrayIndex] <= mMinAngle[lArrayIndex])
                                {
                                    throw new ArgumentException("The maximum angle of joint №" + lIndex.ToString() + " has to be greater than minimum. ");
                                }

                                aXMLTextReader.Read();
                            }
                        }

                        aXMLTextReader.Read();
                    }
                }
        }
        public void loadFromXML(XmlTextReader aXMLTextReader)
        {
            var lReader     = new XMLAttributeReader(aXMLTextReader);
                var lChecker    = new RepeatItemNameChecker();

                string lItem = lReader.getAttribute<String>("InputItem");
                lChecker.addItemName(lItem);
                mInValueItemHandle = mItemBrowser.getItemHandleByName(lItem);

                lItem = lReader.getAttribute<String>("OutputItem");
                lChecker.addItemName(lItem);
                mOutValueItemHandle = mItemBrowser.getItemHandleByName(lItem);

                Inverse    = lReader.getAttribute<Boolean>("Inverse", Inverse);
                OnDelayMS  = lReader.getAttribute<UInt32>("OnDelayMS", OnDelayMS);
                OffDelayMS = lReader.getAttribute<UInt32>("OffDelayMS", OffDelayMS);
        }
        public void loadFromXML(XmlTextReader aXMLTextReader)
        {
            var lReader     = new XMLAttributeReader(aXMLTextReader);
                var lChecker    = new RepeatItemNameChecker();

                string lItem = lReader.getAttribute<String>("On", "");
                lChecker.addItemName(lItem);
                mOnItemHandle = mItemBrowser.getItemHandleByName(lItem);

                lItem = lReader.getAttribute<String>("Value");
                lChecker.addItemName(lItem);
                mValueItemHandle = mItemBrowser.getItemHandleByName(lItem);

                SignalString    = lReader.getAttribute<String>("Signal");
                Bias            = lReader.getAttribute<Double>("Bias", Bias);
                Amplitude       = lReader.getAttribute<Double>("Amplitude", Amplitude);
                PeriodMS        = lReader.getAttribute<UInt32>("PeriodMS", PeriodMS);
                TurnMS          = lReader.getAttribute<UInt32>("TurnMS", TurnMS);
        }
        public void loadFromXML(XmlTextReader aXMLTextReader)
        {
            var lReader     = new XMLAttributeReader(aXMLTextReader);

                string lItem = lReader.getAttribute<String>("On", "");
                mOnItemHandle = mItemBrowser.getItemHandleByName(lItem);

                Loop = lReader.getAttribute<Boolean>("Loop", Loop);

                aXMLTextReader.Read();
                if (aXMLTextReader.Name.Equals("Sections", StringComparison.Ordinal))
                {
                    aXMLTextReader.Read();

                    long lInterval;
                    Snapshot lSnapshot;

                    while (aXMLTextReader.Name.Equals("Section", StringComparison.Ordinal) && aXMLTextReader.IsStartElement())
                    {
                        lInterval = lReader.getAttribute<Int64>("DelayMS");
                        lSnapshot = new Snapshot("", mItemBrowser);

                        aXMLTextReader.Read();

                        if (aXMLTextReader.Name.Equals("Record", StringComparison.Ordinal))
                        {
                            lSnapshot.loadFromXML(aXMLTextReader);
                        }

                        mSections.Add(new Tuple<long, Snapshot>(lInterval, lSnapshot));

                        aXMLTextReader.Read();
                    }
                }
        }
        public void loadFromXML(XmlTextReader aXMLTextReader)
        {
            var lReader     = new XMLAttributeReader(aXMLTextReader);
                var lChecker    = new RepeatItemNameChecker();

                string lItem = lReader.getAttribute<String>("Value");
                lChecker.addItemName(lItem);
                mValueItemHandle = mItemBrowser.getItemHandleByName(lItem);

                lItem = lReader.getAttribute<String>("Input");
                lChecker.addItemName(lItem);
                mInputItemHandle = mItemBrowser.getItemHandleByName(lItem);

                LagMS   = lReader.getAttribute<UInt32>("LagMS", LagMS);
                Gain    = lReader.getAttribute<Double>("Gain", Gain);
        }
        public void loadFromXML(XmlTextReader aXMLTextReader)
        {
            var lReader     = new XMLAttributeReader(aXMLTextReader);
                var lChecker    = new RepeatItemNameChecker();

                string lItem = lReader.getAttribute<String>("InputItem");
                lChecker.addItemName(lItem);
                mInValueItemHandle = mItemBrowser.getItemHandleByName(lItem);

                lItem = lReader.getAttribute<String>("OutputItem");
                lChecker.addItemName(lItem);
                mOutValueItemHandle = mItemBrowser.getItemHandleByName(lItem);

                double lInMax   = lReader.getAttribute<Double>("MaxInputValue");
                double lInMin   = lReader.getAttribute<Double>("MinInputValue");
                double lOutMax  = lReader.getAttribute<Double>("MaxOutputValue");
                double lOutMin  = lReader.getAttribute<Double>("MinOutputValue");

                mValueScale.setProperties(lInMax, lInMin, lOutMax, lOutMin);
        }
 public void loadFromXML(XmlTextReader aXMLTextReader)
 {
     XMLAttributeReader lReader      = new XMLAttributeReader(aXMLTextReader);
     mValuesCompare.OperationName    = lReader.getAttribute<String>("Operation");
     mValue                          = lReader.getAttribute<Double>("Value");
 }
        public void loadFromXML(XmlTextReader aXMLTextReader)
        {
            var lReader     = new XMLAttributeReader(aXMLTextReader);
                var lChecker    = new RepeatItemNameChecker();

                string lItem = lReader.getAttribute<String>("Item");
                lChecker.addItemName(lItem);
                mValueItemHandle = mItemBrowser.getItemHandleByName(lItem);

                double lPMax    = lReader.getAttribute<Double>("MaxPhysicalValue");
                double lPMin    = lReader.getAttribute<Double>("MinPhysicalValue");
                double lRawMax  = lReader.getAttribute<Double>("MaxRawValue");
                double lRawMin  = lReader.getAttribute<Double>("MinRawValue");
                mValueScale.setProperties(lRawMax, lRawMin, lPMax, lPMin);

                mFaultValue = lReader.getAttribute<Double>("FaultValue", mFaultValue);
                if (mFaultValue > lRawMin && mFaultValue < lRawMax)
                {
                    throw new ArgumentException("Fault value is inside normal range. ");
                }

                mUnits = lReader.getAttribute<String>("Units", mUnits);

                #region Thresholds

                    if (aXMLTextReader.IsEmptyElement == false)
                    {
                        aXMLTextReader.Read();
                        if (aXMLTextReader.Name.Equals("Thresholds", StringComparison.Ordinal))
                        {
                            if (aXMLTextReader.IsEmptyElement == false)
                            {
                                List<int> lItems                = new List<int>();
                                List<double> lValues            = new List<double>();
                                List<ValuesCompare> lOperations = new List<ValuesCompare>();
                                double lValue;

                                aXMLTextReader.Read();
                                while (aXMLTextReader.Name.Equals("Threshold", StringComparison.Ordinal))
                                {
                                    lOperations.Add(new ValuesCompare(lReader.getAttribute<String>("Operation")));

                                    lValue = lReader.getAttribute<Double>("Value");
                                    if (lValue > mValueScale.OutMax)
                                    {
                                        throw new ArgumentException("Threshold value is more than maximum of physical value. ");
                                    }
                                    if (lValue < mValueScale.OutMin)
                                    {
                                        throw new ArgumentException("Threshold value is less than minimum of physical value. ");
                                    }
                                    lValues.Add(lValue);

                                    lItem = lReader.getAttribute<String>("Item");
                                    lChecker.addItemName(lItem);
                                    lItems.Add(mItemBrowser.getItemHandleByName(lItem));

                                    aXMLTextReader.Read();
                                }

                                if (lOperations.Count != 0)
                                {
                                    mThdItemHandles = lItems.ToArray();
                                    mThdItemValues  = new bool[lOperations.Count];
                                    mThdValues      = lValues.ToArray();
                                    mThdOperations  = lOperations.ToArray();
                                }
                            }

                            aXMLTextReader.Read();
                        }
                    }

                #endregion
        }
 public void loadFromXML(XmlTextReader aXMLTextReader)
 {
     var lReader = new XMLAttributeReader(aXMLTextReader);
     Alfa        = lReader.getAttribute<Double>("Alfa", Alfa);
 }
        public void loadFromXML(XmlTextReader aXMLTextReader)
        {
            var lReader     = new XMLAttributeReader(aXMLTextReader);
                var lChecker    = new RepeatItemNameChecker();

                OperatorString = lReader.getAttribute<String>("Operator");

                string lItem = lReader.getAttribute<String>("Input1");
                lChecker.addItemName(lItem);
                mInput1ItemHandle = mItemBrowser.getItemHandleByName(lItem);

                mInput1Inverse = lReader.getAttribute<Boolean>("Input1Inverse", mInput1Inverse);

                lItem = lReader.getAttribute<String>("Input2", "");
                lChecker.addItemName(lItem);
                mInput2ItemHandle = mItemBrowser.getItemHandleByName(lItem);

                mInput2Inverse = lReader.getAttribute<Boolean>("Input2Inverse", mInput2Inverse);

                lItem = lReader.getAttribute<String>("Value");
                lChecker.addItemName(lItem);
                mValueItemHandle = mItemBrowser.getItemHandleByName(lItem);
        }
        public IDataItem createFromXML(IConnection aConnection, XmlTextReader aXMLTextReader)
        {
            var lConnection = (Connection)aConnection;
                var lReader     = new XMLAttributeReader(aXMLTextReader);

                string lTopic   = lReader.getAttribute<String>("Topic");
                bool lSubscribe = lReader.getAttribute<Boolean>("Subscribe", true);
                bool lPublish   = lReader.getAttribute<Boolean>("Publish", true);
                string lValue   = lReader.getAttribute<String>("Value", "");

                return lConnection.addItem(lTopic, lSubscribe, lPublish, lValue);
        }
 public void loadFromXML(XmlTextReader aXMLTextReader)
 {
     var lReader = new XMLAttributeReader(aXMLTextReader);
     Round       = (int)lReader.getAttribute<UInt32>("Round", (uint)Round);
 }
        public void loadFromXML(XmlTextReader aXMLTextReader)
        {
            var lReader     = new XMLAttributeReader(aXMLTextReader);
                var lChecker    = new RepeatItemNameChecker();

                string lItem    = lReader.getAttribute<String>("ArrayItem");
                lChecker.addItemName(lItem);
                mArrayValueItemHandle = mItemBrowser.getItemHandleByName(lItem);

                mDataFlow = (EDataFlow)Enum.Parse(typeof(EDataFlow), lReader.getAttribute<String>("DataFlow", mDataFlow.ToString()));

                #region Elements

                    if (aXMLTextReader.IsEmptyElement == false)
                    {
                        aXMLTextReader.Read();
                        if (aXMLTextReader.Name.Equals("Elements", StringComparison.Ordinal))
                        {
                            if (aXMLTextReader.IsEmptyElement == false)
                            {
                                List<int> lIndexes  = new List<int>();
                                List<int> lItems    = new List<int>();
                                var lIndexSet       = new HashSet<int>();
                                int lMaxIndex       = -1;
                                int lIndex;

                                aXMLTextReader.Read();
                                while (aXMLTextReader.Name.Equals("Element", StringComparison.Ordinal))
                                {
                                    lIndex = (int)lReader.getAttribute<UInt32>("Index");
                                    if (lIndexSet.Add(lIndex) == false)
                                    {
                                        throw new ArgumentException("Index '" + lIndex.ToString() + "' already exists. ");
                                    }
                                    lIndexes.Add(lIndex);
                                    if (lIndex > lMaxIndex)
                                    {
                                        lMaxIndex = lIndex;
                                    }

                                    lItem = lReader.getAttribute<String>("Item");
                                    lChecker.addItemName(lItem);
                                    lItems.Add(mItemBrowser.getItemHandleByName(lItem));

                                    aXMLTextReader.Read();
                                }

                                if (lIndexes.Count != 0)
                                {
                                    mElementItemHandles = new int[lMaxIndex + 1];
                                    for (int i = 0; i < mElementItemHandles.Length; i++)
                                    {
                                        mElementItemHandles[i] = -1;
                                    }
                                    mElementValueChanged    = new bool[mElementItemHandles.Length];
                                    mArrayValue             = new object[mElementItemHandles.Length];

                                    int lCount = lIndexes.Count;
                                    for (int i = 0; i < lCount; i++)
                                    {
                                        lIndex                      = lIndexes[i];
                                        mElementItemHandles[lIndex] = lItems[i];
                                    }
                                }
                            }

                            aXMLTextReader.Read();
                        }
                    }

                #endregion
        }