internal void CopyFrom(SheetSelectionModel model) { this.items = (model == null) ? new List <CellRange>() : model.items; this.anchorRow = (model == null) ? 0 : model.anchorRow; this.anchorColumn = (model == null) ? 0 : model.anchorColumn; this.selectionPolicy = (model == null) ? Dt.Cells.Data.SelectionPolicy.MultiRange : model.selectionPolicy; this.selectionUnit = (model == null) ? Dt.Cells.Data.SelectionUnit.Cell : model.selectionUnit; }
/// <summary> /// Generates an object from its XML representation. /// </summary> /// <param name="reader">The <see cref="T:System.Xml.XmlReader" /> stream from which the object is deserialized.</param> void IXmlSerializable.ReadXml(XmlReader reader) { Serializer.InitReader(reader); this.items = new List <CellRange>(); this.anchorRow = 0; this.anchorColumn = 0; this.selectionPolicy = Dt.Cells.Data.SelectionPolicy.MultiRange; this.selectionUnit = Dt.Cells.Data.SelectionUnit.Cell; bool flag = false; while (reader.Read()) { if (reader.NodeType != ((XmlNodeType)((int)XmlNodeType.Element))) { goto Label_01B1; } string name = reader.Name; if (name != null) { if (name != "SelectionPolicy") { if (name == "SelectionUnit") { goto Label_00BE; } if (name == "AnchorCellRow") { goto Label_00D5; } if (name == "AnchorColumnRow") { goto Label_00EC; } if (name == "Items") { goto Label_0103; } if (name == "Item") { goto Label_010A; } } else { this.selectionPolicy = Serializer.ReadAttributeEnum <Dt.Cells.Data.SelectionPolicy>("value", Dt.Cells.Data.SelectionPolicy.MultiRange, reader); } } continue; Label_00BE: this.selectionUnit = Serializer.ReadAttributeEnum <Dt.Cells.Data.SelectionUnit>("value", Dt.Cells.Data.SelectionUnit.Cell, reader); continue; Label_00D5: this.anchorRow = Serializer.ReadAttributeInt("value", 0, reader); continue; Label_00EC: this.anchorColumn = Serializer.ReadAttributeInt("value", 0, reader); continue; Label_0103: flag = true; continue; Label_010A: if (!flag) { continue; } if (this.items == null) { this.items = new List <CellRange>(); } int?nullable = Serializer.ReadAttributeInt("r", reader); int?nullable2 = Serializer.ReadAttributeInt("c", reader); int?nullable3 = Serializer.ReadAttributeInt("rc", reader); int?nullable4 = Serializer.ReadAttributeInt("cc", reader); if ((nullable.HasValue && nullable2.HasValue) && (nullable3.HasValue && nullable4.HasValue)) { this.items.Add(new CellRange(nullable.Value, nullable2.Value, nullable3.Value, nullable4.Value)); continue; } throw new FormatException(ResourceStrings.SerializationError); Label_01B1: if ((reader.Name == "Items") && (reader.NodeType == ((XmlNodeType)((int)XmlNodeType.EndElement)))) { flag = false; } } }