public void Read(BinaryReader reader)
        {
            if (reader == null)
                throw new ArgumentNullException("reader");

            this.Min = new StepperPosition(reader);
            this.Max = new StepperPosition(reader);

            if (Max.X < Min.X)
                throw new InvalidDataException("Max.X is smaller then min.X.");
            if (Max.Y < Min.Y)
                throw new InvalidDataException("Max.Y is smaller then min.Y.");

            int area = (Max.X - Min.X + 1) * (Max.Y - Min.Y + 1); // +1, da max die letzte Kugel nicht beinhaltet
            if (area <= 0)
                throw new InvalidDataException("Area of rectangle is smaller or equal to 0.");

            this.Heights = new ushort[area];
            this.WaitTimes = new byte[area];

            for (int i = 0; i < area; i++)
            {
                this.Heights[i] = reader.ReadUInt16();
                this.WaitTimes[i] = reader.ReadByte();
            }
        }
        public PacketSteppersRectangleArray(StepperPosition min, StepperPosition max, ushort[] heights, byte[] waitTimes)
        {
            if (max.X < min.X)
                throw new ArgumentException("Max.X is smaller then min.X.", "max.X");
            if (max.Y < min.Y)
                throw new ArgumentException("Max.Y is smaller then min.Y.", "max.Y");

            if (heights == null)
                throw new ArgumentNullException("heights");

            int area = (max.X - min.X + 1) * (max.Y - min.Y + 1); // +1, da max die letzte Kugel nicht beinhaltet
            if (area <= 0)
                throw new ArgumentOutOfRangeException("area");

            if (heights.Length != area)
                throw new ArgumentException("Heights length does not match area of rectangle.", "heights");

            if (waitTimes == null)
                throw new ArgumentNullException("waitTimes");
            if (waitTimes.Length != area)
                throw new ArgumentException("WaitTimes length does not match area of rectangle.", "waitTimes");

            this.Min = min;
            this.Max = max;
            this.Heights = heights;
            this.WaitTimes = waitTimes;
        }
Пример #3
0
        public void Read(BinaryReader reader)
        {
            if (reader == null)
                throw new ArgumentNullException("reader");

            this.Position = new StepperPosition(reader);
            this.Height = reader.ReadUInt16();
            this.WaitTime = reader.ReadByte();
        }
Пример #4
0
        public void Read(BinaryReader reader)
        {
            if (reader == null)
                throw new ArgumentNullException("reader");

            int magicValue = reader.ReadInt32();
            if (magicValue != MagicValue)
                throw new InvalidDataException("Unknown magic value: " + magicValue);

            this.Position = new StepperPosition(reader.ReadByte());
        }
        public PacketSteppersRectangle(StepperPosition min, StepperPosition max, ushort height, byte waitTime)
        {
            if (max.X < min.X)
                throw new ArgumentException("Max.X is smaller then min.X.", "max.X");
            if (max.Y < min.Y)
                throw new ArgumentException("Max.Y is smaller then min.Y.", "max.Y");

            this.Min = min;
            this.Max = max;
            this.Height = height;
            this.WaitTime = waitTime;
        }
Пример #6
0
        public void Read(BinaryReader reader)
        {
            int itemCount = reader.ReadByte();
            if (itemCount == 0)
                throw new InvalidDataException("Item count is 0.");

            this.Height = reader.ReadUInt16();
            this.WaitTime = reader.ReadByte();

            Items = new StepperPosition[itemCount];
            for (int i = 0; i < itemCount; i++)
                Items[i] = new StepperPosition(reader);
        }
Пример #7
0
        public PacketSteppers(StepperPosition[] items, ushort height, byte waitTime)
        {
            if (items == null)
                throw new ArgumentNullException("items");
            if (items.Length == 0)
                throw new ArgumentException("Items is empty.", "items");
            if (items.Length > byte.MaxValue)
                throw new ArgumentException("More then " + byte.MaxValue + " items in array.", "items");

            this.Items = items;
            this.Height = height;
            this.WaitTime = waitTime;
        }
Пример #8
0
 public Item(StepperPosition position, ushort height, byte WaitTime)
 {
     this.Position = position;
     this.Height = height;
     this.WaitTime = WaitTime;
 }
Пример #9
0
 public PacketHomeStepper(StepperPosition position)
 {
     this.Position = position;
 }
Пример #10
0
 public PacketStepper(StepperPosition position, ushort height, byte waitTime)
 {
     this.Position = position;
     this.Height = height;
     this.WaitTime = waitTime;
 }
Пример #11
0
 public PacketFix(StepperPosition position)
 {
     this.Position = position;
 }