Example #1
0
 public void addElement(RTForm rt)
 {
     this.Controls.Add(rt);
     elements.Add(rt);
     rt.storePosData();
     rt.center = center;
     rt.updateFromRoot();
     selection.unselect();
     rt.BringToFront();
     selection.select(rt);
 }
Example #2
0
        public void readFile(BinaryReader src)
        {
            string magic = "AudioProcBinary";
            string magicRead;

            magicRead = src.ReadString();
            if (!magicRead.Equals(magic))
            {
                throw new Exception("Bad File Format: Header does not match");
            }
            int version = src.ReadInt32();

            if (version != 2)
            {
                throw new Exception("Bad File Format: File Version higher than this one --> Cannot Read");
            }

            sampleRate          = src.ReadInt32();
            sourceBufferSize    = src.ReadInt32();
            sinkBufferSize      = src.ReadInt32();
            startSourceMinFill  = src.ReadInt32();
            startSinkMinFill    = src.ReadInt32();
            overrunCounterStart = src.ReadInt32();
            startInSleepFill    = src.ReadInt32();
            startOutSleepFill   = src.ReadInt32();

            // Clear up
            while (nets.Count > 0)
            {
                nets[0].Disconnect();
                nets.RemoveAt(0);
            }
            netCounter = 0;
            while (elements.Count > 0)
            {
                elements[0].Disconnect();
                elements.RemoveAt(0);
            }

            int emts = src.ReadInt32();

            if (emts < 0)
            {
                throw new Exception("Bad File Format: File Corrupt in head read");
            }
            string previousclass = "undefined";
            UInt32 frametest     = 0;

            for (int i = 0; i < emts; i++)
            {
                frametest = src.ReadUInt32();
                if (frametest != 0xDEADBEEF)
                {
                    throw new Exception(String.Format("Bad File Format: Liley problem in code of Class {0}", previousclass));
                }
                string          classname = src.ReadString();
                Type            t         = Type.GetType(classname);
                ConstructorInfo ci        = t.GetConstructor(new Type[] { this.GetType(), src.GetType() });
                RTForm          ne        = (RTForm)ci.Invoke(new object[] { this, src });
                this.Controls.Add(ne);
                ne.calcIORanks();
                elements.Add(ne);
                Vector cr = ne.center;
                ne.storePosData();
                Vector loc = cr - ne.dim / 2;
                ne.Location = toScreen(loc).Point;
                ne.center   = cr;
                ne.updateFromRoot();
                ne.BringToFront();
                ne.updateShrinkState();
                previousclass = classname;
            }
            frametest = src.ReadUInt32();
            if (frametest != 0xDEADBEEF)
            {
                throw new Exception(String.Format("Bad File Format: Liley problem in code of Class {0}", previousclass));
            }
            int nts = src.ReadInt32();

            if (nts < 0)
            {
                throw new Exception("Bad File Format: File Corrupt in head read");
            }
            for (int i = 0; i < nts; i++)
            {
                nets.Add(new ProcessingNet(this, src));
            }
        }