public void Deserialize(ParsedByteArray cmd)
 {
     Name = cmd.GetString(32);
     cmd.Skip(8);
     Model = (ModelId)cmd.GetUInt8();
     cmd.Skip(3);
 }
        public override void Deserialize(ParsedByteArray cmd)
        {
            base.Deserialize(cmd);

            Name        = cmd.GetString(8, Name.Length);
            Description = cmd.GetString(8 + Name.Length, Description.Length);
        }
Exemplo n.º 3
0
        public void Deserialize(ParsedByteArray cmd)
        {
            Id        = (VideoSource)cmd.GetUInt16();
            LongName  = cmd.GetString(20);
            ShortName = cmd.GetString(4);
            cmd.Skip(2);
            IsExternal = cmd.GetUInt8() == 0;

            AvailableExternalPorts = (ExternalPortTypeFlags)cmd.GetUInt8();

            cmd.Skip(); // Xd
            ExternalPortType = (ExternalPortTypeFlags)cmd.GetUInt8();
            InternalPortType = (InternalPortType)cmd.GetUInt8();
            cmd.Skip();
            SourceAvailability = (SourceAvailability)cmd.GetUInt8();
            MeAvailability     = (MeAvailability)cmd.GetUInt8();

            if (!IsExternal)
            {
                AvailableExternalPorts = ExternalPortTypeFlags.Internal;
            }
            if (!IsExternal)
            {
                ExternalPortType = ExternalPortTypeFlags.Internal;
            }
        }
        public void Deserialize(ParsedByteArray cmd)
        {
            uint inputCount = cmd.GetUInt16();

            cmd.Skip(2);

            MasterLeftLevel  = GetValue(cmd);
            MasterRightLevel = GetValue(cmd);
            MasterLeftPeak   = GetValue(cmd);
            MasterRightPeak  = GetValue(cmd);

            MonitorLeftLevel  = GetValue(cmd);
            MonitorRightLevel = GetValue(cmd);
            MonitorLeftPeak   = GetValue(cmd);
            MonitorRightPeak  = GetValue(cmd);

            Inputs = new List <AudioMixerLevelInput>((int)inputCount);
            for (int i = 0; i < inputCount; i++)
            {
                Inputs.Add(new AudioMixerLevelInput((AudioSource)cmd.GetUInt16()));
            }
            cmd.SkipToNearestMultipleOf4();

            foreach (AudioMixerLevelInput input in Inputs)
            {
                input.LeftLevel  = GetValue(cmd);
                input.RightLevel = GetValue(cmd);
                input.LeftPeak   = GetValue(cmd);
                input.RightPeak  = GetValue(cmd);
            }
        }
        public void Deserialize(ParsedByteArray cmd)
        {
            TransferId = cmd.GetUInt16();
            var size = cmd.GetUInt16();

            Body = new byte[size];
            Array.Copy(cmd.Body, 4, Body, 0, size);
            cmd.Skip(size);
        }
        public override void Deserialize(ParsedByteArray cmd)
        {
            base.Deserialize(cmd);

            if (RunningToKeyFrame != FlyKeyKeyFrameType.RunToInfinite)
            {
                RunningToInfinite = 0;
            }
        }
Exemplo n.º 7
0
        public override void Deserialize(ParsedByteArray cmd)
        {
            base.Deserialize(cmd);

            if (SourceType == MediaPlayerSource.Clip)
            {
                SourceIndex = cmd.Body[3];
            }
        }
        public void Deserialize(ParsedByteArray cmd)
        {
            MaxFrames = new List <uint>();

            for (int i = 0; i < cmd.BodyLength; i += 2)
            {
                MaxFrames.Add(cmd.GetUInt16());
            }
        }
Exemplo n.º 9
0
        public void Deserialize(ParsedByteArray cmd)
        {
            Unknown  = cmd.GetBoolArray()[0];
            Unknown2 = cmd.GetBoolArray()[0];

            Length = cmd.GetUInt16();
            cmd.GetString(Length); // Get and discard values. Not sure what they mean (if anything)
            cmd.SkipToNearestMultipleOf4();
        }
Exemplo n.º 10
0
        public void Deserialize(ParsedByteArray cmd)
        {
            Inputs = new Dictionary<AudioSource, bool>();

            uint count = cmd.GetUInt16();
            for (int i = 0; i < count; i++)
                Inputs.Add((AudioSource) cmd.GetUInt16(), cmd.GetBoolArray()[0]);

            cmd.SkipToNearestMultipleOf4();
        }
        private static T RunThroughSerialize <T>(T cmd) where T : SerializableCommandBase
        {
            var builder = new ByteArrayBuilder(false);

            cmd.Serialize(builder);

            var parsedData = new ParsedByteArray(builder.ToByteArray(), false);
            T   resCmd     = (T)Activator.CreateInstance(typeof(T));

            resCmd.Deserialize(parsedData);
            return(resCmd);
        }
Exemplo n.º 12
0
        public void Deserialize(ParsedByteArray cmd)
        {
            Tally = new Dictionary <VideoSource, uint>();

            uint count = cmd.GetUInt16();

            for (int i = 0; i < count; i++)
            {
                VideoSource k = (VideoSource)cmd.GetUInt16();
                uint        v = cmd.GetUInt8();
                Tally[k] = v;
            }
            cmd.SkipToNearestMultipleOf4();
        }
Exemplo n.º 13
0
        public void Deserialize(ParsedByteArray cmd)
        {
            uint count = cmd.GetUInt16();

            Tally = new List <Tuple <bool, bool> >();

            for (int i = 0; i < count; i++)
            {
                bool[] arr = cmd.GetBoolArray();
                Tally.Add(Tuple.Create(arr[0], arr[1]));
            }

            cmd.SkipToNearestMultipleOf4();
        }
 public void Deserialize(ParsedByteArray cmd)
 {
     Index      = (MediaPlayerId)cmd.GetUInt8();
     SourceType = (MediaPlayerSource)cmd.GetUInt8();
     if (SourceType == MediaPlayerSource.Still) // TODO - verify this is correct
     {
         SourceIndex = cmd.GetUInt8();
         cmd.Skip();
     }
     else
     {
         cmd.Skip();
         SourceIndex = cmd.GetUInt8();
     }
 }
        public void Deserialize(ParsedByteArray cmd)
        {
            uint count = cmd.GetUInt16();

            Tally = new Dictionary <VideoSource, Tuple <bool, bool> >();

            for (int i = 0; i < count; i++)
            {
                VideoSource src = (VideoSource)cmd.GetUInt16();
                bool[]      arr = cmd.GetBoolArray();
                Tally.Add(src, Tuple.Create(arr[0], arr[1]));
            }

            cmd.SkipToNearestMultipleOf4();
        }
        public void Deserialize(ParsedByteArray cmd)
        {
            var count = cmd.GetUInt16();

            Modes = new List <Entry>((int)count);
            cmd.Skip(2);

            for (int i = 0; i < count; i++)
            {
                VideoMode mode = (VideoMode)cmd.GetUInt8();
                cmd.Skip(5);
                VideoMode mvMode = (VideoMode)Math.Floor(Math.Log(cmd.GetUInt16(), 2));  // TODO - check this is correct
                cmd.Skip(4);
                Modes.Add(new Entry(mode, mvMode));
            }
        }
Exemplo n.º 17
0
        public void Deserialize(ParsedByteArray cmd)
        {
            var count = cmd.GetUInt16();

            Modes = new List <Entry>((int)count);
            cmd.Skip(2);

            for (int i = 0; i < count; i++)
            {
                VideoMode mode = (VideoMode)cmd.GetUInt8();
                cmd.Skip(3);
                VideoMode mvMode   = (VideoMode)Math.Floor(Math.Log(cmd.GetUInt32(), 2)); // TODO - should be mask
                VideoMode someMode = (VideoMode)Math.Floor(Math.Log(cmd.GetUInt32(), 2)); // TODO - should be mask
                Modes.Add(new Entry(mode, mvMode, someMode));
            }
        }
Exemplo n.º 18
0
        public void Deserialize(ParsedByteArray cmd)
        {
            CanRotate  = cmd.GetBoolArray()[0];
            CanScaleUp = cmd.GetBoolArray()[0];

            uint length  = cmd.GetUInt16();
            var  entries = new List <DVEEffect>();

            for (int i = 0; i < length; i++)
            {
                entries.Add((DVEEffect)cmd.GetUInt8());
            }
            SupportedTransitions = entries;

            cmd.SkipToNearestMultipleOf4();
        }
Exemplo n.º 19
0
        public void Deserialize(ParsedByteArray cmd)
        {
            var count = cmd.GetUInt16();

            Modes = new List <Entry>((int)count);
            cmd.Skip(2);

            for (int i = 0; i < count; i++)
            {
                VideoMode mode = (VideoMode)cmd.GetUInt8();
                cmd.Skip(3);
                List <VideoMode> multiviewModes   = ReadVideoModeBitmask(cmd.GetUInt32());
                List <VideoMode> downConvertModes = ReadVideoModeBitmask(cmd.GetUInt32());
                bool             requiresReconfig = cmd.GetBoolArray()[0]; // TODO this will be 8.0+ specific
                Modes.Add(new Entry(mode, multiviewModes, downConvertModes, requiresReconfig));
            }
        }
        public void Deserialize(ParsedByteArray cmd)
        {
            Tally = new Dictionary <Tuple <AudioSource, long>, bool>();

            uint count = cmd.GetUInt16();

            cmd.Skip(6);
            for (uint i = 0; i < count; i++)
            {
                long        sourceId  = cmd.GetInt64();
                AudioSource inputId   = (AudioSource)cmd.GetUInt16();
                bool        isMixedIn = cmd.GetBoolArray()[0];
                Tally[Tuple.Create(inputId, sourceId)] = isMixedIn;
            }

            cmd.SkipToNearestMultipleOf4();
        }
        public void Deserialize(ParsedByteArray cmd)
        {
            Id        = (VideoSource)cmd.GetUInt16();
            LongName  = cmd.GetString(20);
            ShortName = cmd.GetString(4);
            cmd.Skip(2);
            IsExternal = cmd.GetUInt8() == 0;

            // TODO - one of the unknowns will be the currently selected ExternalPortType

            bool[] portBools = cmd.GetBoolArray();
            var    ports     = new List <ExternalPortType>();

            if (portBools[0])
            {
                ports.Add(ExternalPortType.SDI);
            }
            if (portBools[1])
            {
                ports.Add(ExternalPortType.HDMI);
            }
            if (portBools[2])
            {
                ports.Add(ExternalPortType.Component);
            }
            if (portBools[3])
            {
                ports.Add(ExternalPortType.Composite);
            }
            if (portBools[4])
            {
                ports.Add(ExternalPortType.SVideo);
            }
            ExternalPorts = ports.Any() ? ports : null;

            cmd.Skip(); // Xd
            ExternalPortType = (ExternalPortType)cmd.GetUInt8();
            InternalPortType = (InternalPortType)cmd.GetUInt8();
            cmd.Skip();
            SourceAvailability = (SourceAvailability)cmd.GetUInt8();
            MeAvailability     = (MeAvailability)cmd.GetUInt8();
        }
Exemplo n.º 22
0
        public virtual void Deserialize(ParsedByteArray cmd)
        {
            CommandPropertySpec info = GetPropertySpecForType(GetType());

            int attrLength = info.Length;

            if (attrLength != -1 && attrLength != cmd.BodyLength)
            {
                throw new SerializationException(GetType().Name, "Auto deserialize length mismatch");
            }

            foreach (PropertySpec prop in info.Properties)
            {
                prop.Setter?.DynamicInvoke(this, prop.SerAttr.Deserialize(cmd.ReverseBytes, cmd.Body, prop.Attr.StartByte, prop.PropInfo));
            }

            if (GetLength() != cmd.BodyLength)
            {
                throw new Exception("Auto deserialize final length mismatch");
            }
        }
 private static double GetValue(ParsedByteArray cmd)
 {
     return(Math.Log10(cmd.GetUInt32() / (128 * 65536d)) * 20);
 }
Exemplo n.º 24
0
        public static MacroOpBase CreateFromData(byte[] arr, bool safe)
        {
            int opId = (arr[3] << 8) | arr[2];
            MacroOperationType macroOp = (MacroOperationType)opId;

            try
            {
                if (!macroOp.IsValid())
                {
                    throw new SerializationException("FTDa", "Invalid MacroOperationType: {0}", opId);
                }

                var parsed = new ParsedByteArray(arr, false);

                Type type = FindForType(macroOp);
                if (type == null)
                {
                    throw new SerializationException("FTDa", "Failed to find MacroOperationType: {0}", macroOp);
                }

                MacroOpBase cmd = (MacroOpBase)Activator.CreateInstance(type);

                if (!safe)
                {
                    cmd.Deserialize(parsed);
                }
                else
                {
                    AutoSerializeBase.CommandPropertySpec info = AutoSerializeBase.GetPropertySpecForType(cmd.GetType());

                    int attrLength = info.Length;
                    if (attrLength != -1 && attrLength != parsed.BodyLength)
                    {
                        Log.WarnFormat("{0}: Auto deserialize length mismatch", cmd.GetType().Name);
                    }

                    foreach (AutoSerializeBase.PropertySpec prop in info.Properties)
                    {
                        try
                        {
                            prop.Setter?.DynamicInvoke(cmd, prop.SerAttr.Deserialize(parsed.ReverseBytes, parsed.Body, prop.Attr.StartByte, prop.PropInfo));
                        }
                        catch (Exception e)
                        {
                            Log.WarnFormat("{0}: Failed to deserialize property {1}: {2}", cmd.GetType().Name, prop.PropInfo.Name, e.ToString());
                        }
                    }
                }

                return(cmd);
            }
            catch (Exception)
            {
                if (safe)
                {
                    return(null);
                }

                throw;
            }
        }
 public void Deserialize(ParsedByteArray cmd)
 {
     Id = cmd.GetUInt16();
     cmd.Skip(32);
 }
Exemplo n.º 26
0
 protected abstract void DeserializePostLength(ParsedByteArray cmd);
Exemplo n.º 27
0
 protected abstract void DeserializeType(ParsedByteArray cmd);
Exemplo n.º 28
0
        public void Deserialize(ParsedByteArray cmd)
        {
            Input     = (VideoSource)cmd.GetUInt8(); // 0
            Category  = cmd.GetUInt8();              // 1
            Parameter = cmd.GetUInt8();              // 2
            DeserializeType(cmd);                    // 3/3-5

            uint count8  = cmd.GetUInt16();          // 4/6
            uint count16 = cmd.GetUInt16();          // 6/8
            uint count32 = cmd.GetUInt16();          // 8/10
            uint count64 = cmd.GetUInt16();          // 10/12

            DeserializePostLength(cmd);

            cmd.SkipToNearestMultipleOf8();

            switch (Type)
            {
            case CameraControlDataType.Bool:
            {
                BoolData = new bool[count8];
                for (int i = 0; i < count8; i++)
                {
                    BoolData[i] = cmd.GetBoolArray()[0];
                }

                break;
            }

            case CameraControlDataType.SInt8:
            {
                IntData = new int[count8];
                for (int i = 0; i < count8; i++)
                {
                    IntData[i] = (sbyte)cmd.GetUInt8();
                }

                break;
            }

            case CameraControlDataType.SInt16:
            {
                IntData = new int[count16];
                for (int i = 0; i < count16; i++)
                {
                    IntData[i] = cmd.GetInt16();
                }
                break;
            }

            case CameraControlDataType.SInt32:
            {
                IntData = new int[count32];
                for (int i = 0; i < count32; i++)
                {
                    IntData[i] = cmd.GetInt32();
                }
                break;
            }

            case CameraControlDataType.SInt64:
            {
                LongData = new long[count64];
                for (int i = 0; i < count64; i++)
                {
                    LongData[i] = cmd.GetInt64();
                }
                break;
            }

            case CameraControlDataType.String:
            {
                StringData = cmd.GetString(count8);
                break;
            }

            case CameraControlDataType.Float:
            {
                FloatData = new double[count16];
                for (int i = 0; i < count16; i++)
                {
                    double raw = cmd.GetUInt16();
                    FloatData[i] = raw / 0x7ff;
                }

                break;
            }

            default:
                throw new ArgumentOutOfRangeException();
            }

            cmd.SkipToNearestMultipleOf8();
        }
 public void Deserialize(ParsedByteArray cmd)
 {
     cmd.Skip(4);
 }
        public override void Deserialize(ParsedByteArray cmd)
        {
            base.Deserialize(cmd);

            Filename = cmd.GetString(24, Filename.Length);
        }