public void Load(XElement stbElem, StbVersion version) { switch (version) { case StbVersion.Ver1: IEnumerable <XElement> xOpens = stbElem.Elements("StbOpen"); foreach (XElement xOpen in xOpens) { if (xOpen.Attribute("id") != null) { Id.Add((int)xOpen.Attribute("id")); } else { Id.Add(0); } if (xOpen.Attribute("name") != null) { Name.Add((string)xOpen.Attribute("name")); } else { Name.Add(string.Empty); } IdSection.Add((int)xOpen.Attribute("id_section")); PositionX.Add((double)xOpen.Attribute("position_X")); PositionY.Add((double)xOpen.Attribute("position_Y")); LengthX.Add((double)xOpen.Attribute("length_X")); LengthY.Add((double)xOpen.Attribute("length_Y")); Rotate.Add((double)xOpen.Attribute("rotate")); } break; case StbVersion.Ver2: break; default: throw new ArgumentOutOfRangeException(nameof(version), version, "The STB version is not set"); } }