public virtual void Serialize(object obj, Altaxo.Serialization.Xml.IXmlSerializationInfo info) { Altaxo.Data.DataTable s = (Altaxo.Data.DataTable)obj; info.AddValue("Name", s._tableName); // name of the Table info.AddValue("DataCols", s._dataColumns); info.AddValue("PropCols", s._propertyColumns); // the property columns of that table // new in version 1 info.AddValue("TableScript", s._tableScript); // new in version 2 - Add table properties int numberproperties = s._tableProperties == null ? 0 : s._tableProperties.Keys.Count; info.CreateArray("TableProperties", numberproperties); if (s._tableProperties != null) { foreach (string propkey in s._tableProperties.Keys) { if (propkey.StartsWith("tmp/")) { continue; } info.CreateElement("e"); info.AddValue("Key", propkey); object val = s._tableProperties[propkey]; info.AddValue("Value", info.IsSerializable(val) ? val : null); info.CommitElement(); } } info.CommitArray(); }
public virtual void Serialize(object obj, Altaxo.Serialization.Xml.IXmlSerializationInfo info) { var s = (DataTableMultipleColumnProxy)obj; info.AddValue("Table", s._dataTable); info.AddValue("Group", s._groupNumber); info.AddValue("UseAllAvailableDataRows", s._useAllAvailableDataRows); info.CreateArray("DataColumnsBundles", s._dataColumnBundles.Count); foreach (var entry in s._dataColumnBundles) { info.CreateElement("e"); info.AddValue("Identifier", entry.Key); info.AddValue("MaximumNumberOfColumns", entry.Value.MaximumNumberOfColumns); info.CreateArray("DataColumns", entry.Value.DataColumns.Count); foreach (var proxy in entry.Value.DataColumns) { info.AddValue("e", proxy); } info.CommitArray(); info.CommitElement(); } info.CommitArray(); if (!s._useAllAvailableDataRows) { info.AddValue("DataRows", s._participatingDataRows); } }
public virtual void Serialize(object obj, Altaxo.Serialization.Xml.IXmlSerializationInfo info) { GraphDocument s = (GraphDocument)obj; // info.AddBaseValueEmbedded(s,typeof(GraphDocument).BaseType); // now the data of our class info.AddValue("Name", s._name); info.AddValue("PageBounds", s._pageBounds); info.AddValue("PrintableBounds", s._printableBounds); info.AddValue("Layers", s._layers); // new in version 1 - Add graph properties int numberproperties = s._graphProperties == null ? 0 : s._graphProperties.Keys.Count; info.CreateArray("TableProperties", numberproperties); if (s._graphProperties != null) { foreach (string propkey in s._graphProperties.Keys) { if (propkey.StartsWith("tmp/")) { continue; } info.CreateElement("e"); info.AddValue("Key", propkey); object val = s._graphProperties[propkey]; info.AddValue("Value", info.IsSerializable(val) ? val : null); info.CommitElement(); } } info.CommitArray(); }
public virtual void Serialize(object obj, Altaxo.Serialization.Xml.IXmlSerializationInfo info) { var s = (WorksheetLayout)obj; info.AddValue("Guid", System.Xml.XmlConvert.ToString(s._guid)); info.AddValue("Table", Main.AbsoluteDocumentPath.GetAbsolutePath(s._dataTable)); info.AddValue("RowHeaderStyle", s._rowHeaderStyle); info.AddValue("ColumnHeaderStyle", s._columnHeaderStyle); info.AddValue("PropertyColumnHeaderStyle", s._propertyColumnHeaderStyle); info.CreateArray("DefaultColumnStyles", s._dataColumnStyles.DefaultColumnStyles.Values.Count); foreach (object style in s._dataColumnStyles.DefaultColumnStyles.Values) { info.AddValue("DefaultColumnStyle", style); } info.CommitArray(); info.CreateArray("ColumnStyles", s._dataColumnStyles.Count); foreach (KeyValuePair <DataColumn, ColumnStyle> dictentry in s._dataColumnStyles) { info.CreateElement("e"); info.AddValue("Column", Main.AbsoluteDocumentPath.GetAbsolutePath(dictentry.Key)); info.AddValue("Style", dictentry.Value); info.CommitElement(); // "e" } info.CommitArray(); }
public virtual void Serialize(object obj, Altaxo.Serialization.Xml.IXmlSerializationInfo info) { WorksheetLayout s = (WorksheetLayout)obj; info.AddValue("Guid", System.Xml.XmlConvert.ToString(s.m_Guid)); info.AddValue("Table", Main.DocumentPath.GetAbsolutePath(s.m_DataTable)); info.AddValue("RowHeaderStyle", s.m_RowHeaderStyle); info.AddValue("ColumnHeaderStyle", s.m_ColumnHeaderStyle); info.AddValue("PropertyColumnHeaderStyle", s.m_PropertyColumnHeaderStyle); info.CreateArray("DefaultColumnStyles", s.m_DefaultColumnStyles.Values.Count); foreach (object style in s.m_DefaultColumnStyles.Values) { info.AddValue("DefaultColumnStyle", style); } info.CommitArray(); info.CreateArray("ColumnStyles", s.m_ColumnStyles.Count); foreach (System.Collections.DictionaryEntry dictentry in s.m_ColumnStyles) { info.CreateElement("e"); Main.IDocumentNode col = (Main.IDocumentNode)dictentry.Key; info.AddValue("Column", Main.DocumentPath.GetAbsolutePath(col)); info.AddValue("Style", dictentry.Value); info.CommitElement(); // "e" } info.CommitArray(); }
public void Serialize(object obj, Altaxo.Serialization.Xml.IXmlSerializationInfo info) { var s = (PropertyBagLazyLoaded)obj; var assemblyVersion = s.GetType().Assembly.GetName().Version; var keyList = new HashSet <string>(); foreach (var entry in s._properties) { if (entry.Key.StartsWith(TemporaryPropertyPrefixString)) { continue; } if (!info.IsSerializable(entry.Value)) { continue; } keyList.Add(entry.Key); } foreach (var entry in s._propertiesLazyLoaded) { if (entry.Key.StartsWith(TemporaryPropertyPrefixString)) { continue; } keyList.Add(entry.Key); } info.CreateArray("Properties", keyList.Count); info.AddAttributeValue("AssemblyVersion", assemblyVersion.ToString()); foreach (var key in keyList) { // Since this is a lazy bag, each property is deserialized individually. Thus we must serialize it individually, too. // ClearProperties clears all properties left by former serializations so that each item is serialized as if serialized individually. info.ClearProperties(); info.CreateElement("e"); info.AddValue("Key", key); if (s._properties.TryGetValue(key, out var value)) { info.AddValue("Value", value); } else if (s._propertiesLazyLoaded.TryGetValue(key, out var rawXml)) { info.WriteRaw(rawXml); } else { throw new InvalidOperationException("Key neither found in regular properties nor in lazy loaded properties"); } info.CommitElement(); } info.CommitArray(); }
public virtual void Serialize(object obj, Altaxo.Serialization.Xml.IXmlSerializationInfo info) { var s = (ColumnStyleDictionary)obj; info.CreateArray("DefaultColumnStyles", s._defaultColumnStyles.Count); foreach (var style in s._defaultColumnStyles) { info.CreateElement("e"); info.AddValue("Type", style.Key.FullName); info.AddValue("Style", style.Value); info.CommitElement(); // "e" } info.CommitArray(); info.CreateArray("ColumnStyles", s._columnStyles.Count); foreach (var dictentry in s._columnStyles) { info.CreateElement("e"); info.AddValue("Column", Main.AbsoluteDocumentPath.GetAbsolutePath(dictentry.Key)); info.AddValue("Style", dictentry.Value); info.CommitElement(); // "e" } info.CommitArray(); }
public void Serialize(object obj, Altaxo.Serialization.Xml.IXmlSerializationInfo info) { var s = (ColorSetBag)obj; info.CreateArray("ColorSets", s._colorSets.Length); foreach (var c in s._colorSets) { info.CreateElement("e"); info.AddValue("ColorSet", c.Item1); info.AddValue("IsPlotColorSet", c.Item2); info.CommitElement(); } info.CommitArray(); }
public void Serialize(object obj, Altaxo.Serialization.Xml.IXmlSerializationInfo info) { AscendingIntegerCollection s = (AscendingIntegerCollection)obj; int count = s.GetRangeCount(); info.CreateArray("Ranges", count); int currentpos = 0, rangestart = 0, rangecount = 0; while (s.GetNextRangeAscending(ref currentpos, ref rangestart, ref rangecount)) { info.CreateElement("e"); info.AddValue("Start", rangestart); info.AddValue("Count", rangecount); info.CommitElement(); } info.CommitArray(); }
public void Serialize(object obj, Altaxo.Serialization.Xml.IXmlSerializationInfo info) { var s = (ColorSet)obj; info.SetProperty(GetSerializationRegistrationKey(s), "True"); // Register a property to note that this color set is already serialized. info.AddValue("Name", s._name); info.CreateArray("Colors", s._innerList.Length); foreach (NamedColor c in s) { info.CreateElement("e"); info.AddAttributeValue("Name", c.Name); info.SetNodeContent(c.Color.ToInvariantString()); info.CommitElement(); } info.CommitArray(); }
public void Serialize(object obj, Altaxo.Serialization.Xml.IXmlSerializationInfo info) { var s = (PropertyBag)obj; var keyList = new List <string>(s._properties.Count); foreach (var entry in s._properties) { if (entry.Key.StartsWith(TemporaryPropertyPrefixString)) { continue; } if (!info.IsSerializable(entry.Value)) { continue; } keyList.Add(entry.Key); } info.CreateArray("Properties", keyList.Count); info.AddAttributeValue("AssemblyVersion", s.GetType().Assembly.GetName().Version.ToString()); foreach (var key in keyList) { var value = s._properties[key]; info.CreateElement("e"); info.AddValue("Key", key); if (s._propertiesLazyLoaded.Contains(key) && value is string rawXml) { info.WriteRaw(rawXml); } else { info.AddValue("Value", value); } info.CommitElement(); } info.CommitArray(); }