protected virtual void WriteXMLInner(Stream stream) { DebugLogging.WriteLine("OlapAxisLayoutSerializer.WriteXMLInner"); //if (fGrid != null) LoadFrom(fGrid); fGrid.BeforSave(fGrid, new OnSerializeArgs(this)); var bf = XmlSerializator.GetXmlSerializer(GetType()); bf.Serialize(stream, this); }
internal virtual void ReadXMLInner(Stream stream) { DebugLogging.WriteLine("OlapAxisLayoutSerializer.ReadXMLInner"); if (fGrid != null) { fGrid.BeforLoad(fGrid, EventArgs.Empty); } #region code of old vertions file (web saving) // define signal string // content of web-versions file: // #1: <?xml version="1.0"?> // #2: <OlapGridSerializer xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> // # etc ... // stream.Position = 0; var sr = new StreamReader(stream, Encoding.UTF8); stream.Position = 0; var alldata = sr.ReadToEnd(); // its Web-like saved !!! //if ((!string.IsNullOrEmpty(lines[1])) && (string.Compare(lines[1], signalstr) == 0)) if (alldata.Contains(_signalstr)) { stream.Position = 0; sr = new StreamReader(stream, Encoding.UTF8); alldata = alldata.Replace(_signalstr, @"<OlapAxisLayoutSerializer>"); alldata = alldata.Replace(@"</OlapGridSerializer>", @"</OlapAxisLayoutSerializer>"); var ms = new MemoryStream(); var sw = new StreamWriter(ms); sw.Write(alldata); sw.Flush(); var bf = XmlSerializator.GetXmlSerializer(typeof(OlapAxisLayoutSerializer)); #if OLAPWINFORMS if (fGrid != null) { fGrid.Cursor = System.Windows.Forms.Cursors.WaitCursor; } #endif ms.Position = 0; var g = (OlapAxisLayoutSerializer)bf.Deserialize(ms); if (fGrid != null) { g.fGrid = fGrid; g.LoadTo(fGrid); #if OLAPWINFORMS fGrid.Cursor = System.Windows.Forms.Cursors.Default; #endif fGrid.AfterLoad(fGrid, new OnSerializeArgs(g)); } return; } #endregion end of web-xml reading _SOLAPGrid = fGrid; var bf1 = XmlSerializator.GetXmlSerializer(GetType()); stream.Flush(); stream.Position = 0; if (fGrid != null) { var g1 = (OlapGridSerializer)bf1.Deserialize(stream); g1.fGrid = fGrid; g1.SuppressSaveOLAPSlices = SuppressSaveOLAPSlices; fGrid._IsReadXMLProcessing = true; if (!fGrid.IsUpdating) { fGrid.BeginUpdate(); g1.LoadTo(fGrid); fGrid.EndUpdate(); } else { g1.LoadTo(fGrid); } fGrid.AfterLoad(fGrid, new OnSerializeArgs(g1)); fGrid._IsReadXMLProcessing = false; } _SOLAPGrid = null; }