Example #1
0
        protected override void DeserializeFromStream(CitpBinaryReader reader)
        {
            base.DeserializeFromStream(reader);

            UniverseIndex    = reader.ReadByte();
            ConnectionString = CitpDmxConnectionString.Parse(reader.ReadString(true));
        }
        public void CanParse()
        {
            Action <CitpDmxConnectionString> test = input =>
            {
                var output = CitpDmxConnectionString.Parse(input.ToString());
                output.Should().Be(input, "because parsing the string representation of this object should produce an equal value");
            };

            test(CitpDmxConnectionString.FromArtNet(0, 0, 1));
            test(CitpDmxConnectionString.FromBsre131(1, 1));
            test(CitpDmxConnectionString.FromEtcNet2(1));
            test(CitpDmxConnectionString.FromMaNet(2, 0, 1));
            test(CitpDmxConnectionString.FromMaNet(2, 0, 1, Guid.Parse("{3C980270-3900-47CC-9F5B-8FB2AFDC04D7}")));
        }
Example #3
0
        protected override void DeserializeFromStream(CitpBinaryReader reader)
        {
            base.DeserializeFromStream(reader);

            switch (Version)
            {
            case MsexVersion.Version1_0:
            case MsexVersion.Version1_1:
            {
                ProductName         = reader.ReadString();
                ProductVersionMajor = reader.ReadByte();
                ProductVersionMinor = reader.ReadByte();

                int dmxSourcesCount = reader.ReadByte();
                LayerDmxSources = new List <CitpDmxConnectionString>(dmxSourcesCount);
                for (int i = 0; i < dmxSourcesCount; ++i)
                {
                    LayerDmxSources.Add(CitpDmxConnectionString.Parse(reader.ReadString(true)));
                }
            }
            break;

            case MsexVersion.Version1_2:
            {
                Uuid = new Guid(reader.ReadString(true));

                ProductName          = reader.ReadString();
                ProductVersionMajor  = reader.ReadByte();
                ProductVersionMinor  = reader.ReadByte();
                ProductVersionBugfix = reader.ReadByte();

                byte supportedVersionsCount = reader.ReadByte();
                SupportedMsexVersions = new List <MsexVersion>(supportedVersionsCount);
                for (int i = 0; i < supportedVersionsCount; ++i)
                {
                    byte versionMajor = reader.ReadByte();
                    byte versionMinor = reader.ReadByte();

                    if (versionMajor == 1 && versionMinor == 0)
                    {
                        SupportedMsexVersions.Add(MsexVersion.Version1_0);
                    }
                    else if (versionMajor == 1 && versionMinor == 1)
                    {
                        SupportedMsexVersions.Add(MsexVersion.Version1_1);
                    }
                    else if (versionMajor == 1 && versionMinor == 2)
                    {
                        SupportedMsexVersions.Add(MsexVersion.Version1_2);
                    }
                    else
                    {
                        SupportedMsexVersions.Add(MsexVersion.UnsupportedVersion);
                    }
                }

                SupportedLibraryTypes = new List <MsexLibraryType>();
                var supportedLibraryTypesBits = new BitArray(reader.ReadBytes(2));
                for (byte i = 0; i < supportedLibraryTypesBits.Length; ++i)
                {
                    if (supportedLibraryTypesBits[i])
                    {
                        SupportedLibraryTypes.Add((MsexLibraryType)i);
                    }
                }

                int thumbnailFormatsCount = reader.ReadByte();
                ThumbnailFormats = new List <MsexImageFormat>(thumbnailFormatsCount);
                for (int i = 0; i < thumbnailFormatsCount; ++i)
                {
                    ThumbnailFormats.Add(CitpEnumHelper.GetEnumFromIdString <MsexImageFormat>(reader.ReadIdString()));
                }

                int streamFormatsCount = reader.ReadByte();
                StreamFormats = new List <MsexImageFormat>(streamFormatsCount);
                for (int i = 0; i < streamFormatsCount; ++i)
                {
                    StreamFormats.Add(CitpEnumHelper.GetEnumFromIdString <MsexImageFormat>(reader.ReadIdString()));
                }

                int dmxSourcesCount = reader.ReadByte();
                LayerDmxSources = new List <CitpDmxConnectionString>(dmxSourcesCount);
                for (int i = 0; i < dmxSourcesCount; ++i)
                {
                    LayerDmxSources.Add(CitpDmxConnectionString.Parse(reader.ReadString(true)));
                }
            }
            break;
            }
        }