Exemplo n.º 1
0
        public ProcessingNet(SystemPanel _owner)
        {
            owner        = _owner;
            connectedIOs = new List <RTIO>();
            connections  = new List <ProcessingConnection>();

            _isNamed = false;
            _name    = owner.createUniqueNetName();
            netType  = ProcessingNetType.Unknown;

            init();
        }
Exemplo n.º 2
0
        public ProcessingNet(SystemPanel _owner, BinaryReader src)
        {
            owner        = _owner;
            connectedIOs = new List <RTIO>();
            connections  = new List <ProcessingConnection>();

            _isNamed = src.ReadBoolean();
            if (_isNamed)
            {
                _name = src.ReadString();
            }
            else
            {
                _name = owner.createUniqueNetName();
            }

            netType = ProcessingNetType.Unknown;

            init();

            int cios = src.ReadInt32();

            if (cios < 0)
            {
                throw new Exception("Bad Input File: File corrupt in Net Read");
            }
            for (int i = 0; i < cios; i++)
            {
                String elementID = src.ReadString();
                int    elementIO = src.ReadInt32();
                RTForm pe        = owner.findElement(elementID);
                if (pe == null)
                {
                    throw new Exception("Bad Input File: Linked Element not found");
                }
                List <RTIO> rio = pe.GetIOs();
                if ((elementIO < 0) || (elementIO >= rio.Count))
                {
                    throw new Exception("Bad Input File: Linked Element has not enough IOs");
                }
                rio[elementIO].connectedTo = this;
                connectedIOs.Add(rio[elementIO]);
            }
            int cns = src.ReadInt32();

            if (cns < 0)
            {
                throw new Exception("Bad Input File: File corrupt in Net Read");
            }
            for (int i = 0; i < cns; i++)
            {
                int a = src.ReadInt32();
                int b = src.ReadInt32();
                if ((a < 0) || (b < 0) || (a >= connectedIOs.Count) || (a >= connectedIOs.Count))
                {
                    throw new Exception("Bad Input File: File corrupt in Net Read");
                }
                connections.Add(new ProcessingConnection(a, b));
            }

            CheckValidity();
        }