Beispiel #1
0
        /// <summary>
        /// Restores the state of the main window from a zipped Altaxo project file.
        /// </summary>
        /// <param name="zipFile">The zip file where the state file can be found into.</param>
        /// <param name="info">The deserialization info used to retrieve the data.</param>
        /// <param name="restoredDoc">The previously (also from the zip file!) restored Altaxo document.</param>
        public void RestoreWindowStateFromZippedFile(ZipFile zipFile, Altaxo.Serialization.Xml.XmlStreamDeserializationInfo info, AltaxoDocument restoredDoc)
        {
            System.Collections.ArrayList restoredControllers = new System.Collections.ArrayList();
            foreach (ZipEntry zipEntry in zipFile)
            {
                if (!zipEntry.IsDirectory && zipEntry.Name.StartsWith("Workbench/Views/"))
                {
                    System.IO.Stream zipinpstream = zipFile.GetInputStream(zipEntry);
                    info.BeginReading(zipinpstream);
                    object readedobject = info.GetValue("Table", this);
                    if (readedobject is ICSharpCode.SharpDevelop.Gui.IViewContent)
                    {
                        restoredControllers.Add(readedobject);
                    }
                    info.EndReading();
                }
            }

            info.AnnounceDeserializationEnd(restoredDoc);
            info.AnnounceDeserializationEnd(this);

            // now give all restored controllers a view and show them in the Main view

            foreach (IViewContent viewcontent in restoredControllers)
            {
                IMVCControllerWrapper wrapper = viewcontent as IMVCControllerWrapper;
                if (wrapper != null && wrapper.MVCController.ViewObject == null)
                {
                    Current.Gui.FindAndAttachControlTo(wrapper.MVCController);
                }

                if (viewcontent.Control != null)
                {
                    Current.Workbench.ShowView(viewcontent);
                }
            }
        }
        /// <summary>
        /// Deserializes an object from a string containing Altaxo's XML format.
        /// </summary>
        /// <typeparam name="T">Type of the object that is expected to be deserialized.</typeparam>
        /// <param name="s">The string containing Altaxo's XML format. Is is expected that the root node is named 'Object'.</param>
        /// <returns>The deserialized object, or default(T) if either the object was null or had a type that was not the expected type.</returns>
        public static T DeserializeObjectFromString <T>(string s)
        {
            object readObject = null;

            using (var info = new Altaxo.Serialization.Xml.XmlStreamDeserializationInfo())
            {
                info.BeginReading(s);
                readObject = info.GetValue("Object", null);

                info.AnnounceDeserializationEnd(Current.Project, true);
                info.AnnounceDeserializationHasCompletelyFinished();
                info.EndReading();
            }

            if ((null != readObject) && (readObject is T))
            {
                return((T)readObject);
            }
            else
            {
                return(default(T));
            }
        }
Beispiel #3
0
        public void RestoreFromZippedFile(ICompressedFileContainer zipFile, Altaxo.Serialization.Xml.XmlStreamDeserializationInfo info)
        {
            System.Text.StringBuilder errorText = new System.Text.StringBuilder();

            foreach (IFileContainerItem zipEntry in zipFile)
            {
                try
                {
                    if (!zipEntry.IsDirectory && zipEntry.Name.StartsWith("Tables/"))
                    {
                        System.IO.Stream zipinpstream = zipFile.GetInputStream(zipEntry);
                        info.BeginReading(zipinpstream);
                        object readedobject = info.GetValue("Table", this);
                        if (readedobject is Altaxo.Data.DataTable)
                        {
                            this.m_DataSet.Add((Altaxo.Data.DataTable)readedobject);
                        }
                        info.EndReading();
                    }
                    else if (!zipEntry.IsDirectory && zipEntry.Name.StartsWith("Graphs/"))
                    {
                        System.IO.Stream zipinpstream = zipFile.GetInputStream(zipEntry);
                        info.BeginReading(zipinpstream);
                        object readedobject = info.GetValue("Graph", this);
                        if (readedobject is GraphDocument)
                        {
                            this.m_GraphSet.Add((GraphDocument)readedobject);
                        }
                        info.EndReading();
                    }
                    else if (!zipEntry.IsDirectory && zipEntry.Name.StartsWith("TableLayouts/"))
                    {
                        System.IO.Stream zipinpstream = zipFile.GetInputStream(zipEntry);
                        info.BeginReading(zipinpstream);
                        object readedobject = info.GetValue("WorksheetLayout", this);
                        if (readedobject is Altaxo.Worksheet.WorksheetLayout)
                        {
                            this.m_TableLayoutList.Add((Altaxo.Worksheet.WorksheetLayout)readedobject);
                        }
                        info.EndReading();
                    }
                    else if (!zipEntry.IsDirectory && zipEntry.Name.StartsWith("FitFunctionScripts/"))
                    {
                        System.IO.Stream zipinpstream = zipFile.GetInputStream(zipEntry);
                        info.BeginReading(zipinpstream);
                        object readedobject = info.GetValue("FitFunctionScript", this);
                        if (readedobject is Altaxo.Scripting.FitFunctionScript)
                        {
                            this._FitFunctionScripts.Add((Altaxo.Scripting.FitFunctionScript)readedobject);
                        }
                        info.EndReading();
                    }
                }
                catch (Exception exc)
                {
                    errorText.Append("Error deserializing ");
                    errorText.Append(zipEntry.Name);
                    errorText.Append(", ");
                    errorText.Append(exc.ToString());
                }
            }

            try
            {
                info.AnnounceDeserializationEnd(this);
            }
            catch (Exception exc)
            {
                errorText.Append(exc.ToString());
            }


            if (errorText.Length != 0)
            {
                throw new ApplicationException(errorText.ToString());
            }
        }
Beispiel #4
0
		public static void OpenWorksheetOrGraph(string filename)
		{
			object deserObject;

			using (System.IO.Stream myStream = new System.IO.FileStream(filename, System.IO.FileMode.Open, System.IO.FileAccess.Read, System.IO.FileShare.Read))
			{
				using (var info = new Altaxo.Serialization.Xml.XmlStreamDeserializationInfo())
				{
					info.BeginReading(myStream);
					deserObject = info.GetValue("Table", null);
					info.EndReading();
					myStream.Close();

					if (deserObject is IProjectItem)
					{
						Current.Project.AddItemWithThisOrModifiedName((IProjectItem)deserObject);
						info.AnnounceDeserializationEnd(Current.Project, false); // fire the event to resolve path references
						Current.ProjectService.OpenOrCreateViewContentForDocument((IProjectItem)deserObject);
					}
					else if (deserObject is Altaxo.Worksheet.TablePlusLayout)
					{
						Altaxo.Worksheet.TablePlusLayout tableAndLayout = deserObject as Altaxo.Worksheet.TablePlusLayout;
						var table = tableAndLayout.Table;

						Current.Project.AddItemWithThisOrModifiedName(table);

						if (tableAndLayout.Layout != null)
							Current.Project.TableLayouts.Add(tableAndLayout.Layout);

						tableAndLayout.Layout.DataTable = table; // this is the table for the layout now

						info.AnnounceDeserializationEnd(Current.Project, false); // fire the event to resolve path references

						Current.ProjectService.CreateNewWorksheet(table, tableAndLayout.Layout);
					}

					info.AnnounceDeserializationEnd(Current.Project, true); // final deserialization end
				}
			}
		}
Beispiel #5
0
        public static void OpenWorksheetOrGraph(string filename)
        {
            object deserObject;

            Altaxo.Serialization.Xml.XmlStreamDeserializationInfo info;
            using (System.IO.Stream myStream = new System.IO.FileStream(filename, System.IO.FileMode.Open, System.IO.FileAccess.Read, System.IO.FileShare.Read))
            {
                info = new Altaxo.Serialization.Xml.XmlStreamDeserializationInfo();
                info.BeginReading(myStream);
                deserObject = info.GetValue("Table", null);
                info.EndReading();
                myStream.Close();
            }

            // if it is a table, add it to the DataTableCollection
            if (deserObject is Altaxo.Data.DataTable)
            {
                Altaxo.Data.DataTable table = deserObject as Altaxo.Data.DataTable;
                if (table.Name == null || table.Name == string.Empty)
                {
                    table.Name = Current.Project.DataTableCollection.FindNewTableName();
                }
                else if (Current.Project.DataTableCollection.ContainsTable(table.Name))
                {
                    table.Name = Current.Project.DataTableCollection.FindNewTableName(table.Name);
                }

                Current.Project.DataTableCollection.Add(table);
                info.AnnounceDeserializationEnd(Current.Project); // fire the event to resolve path references

                Current.ProjectService.CreateNewWorksheet(table);
            }
            // if it is a table, add it to the DataTableCollection
            else if (deserObject is Altaxo.Worksheet.TablePlusLayout)
            {
                Altaxo.Worksheet.TablePlusLayout tableAndLayout = deserObject as Altaxo.Worksheet.TablePlusLayout;
                Altaxo.Data.DataTable            table          = tableAndLayout.Table;
                if (table.Name == null || table.Name == string.Empty)
                {
                    table.Name = Current.Project.DataTableCollection.FindNewTableName();
                }
                else if (Current.Project.DataTableCollection.ContainsTable(table.Name))
                {
                    table.Name = Current.Project.DataTableCollection.FindNewTableName(table.Name);
                }
                Current.Project.DataTableCollection.Add(table);

                if (tableAndLayout.Layout != null)
                {
                    Current.Project.TableLayouts.Add(tableAndLayout.Layout);
                }

                info.AnnounceDeserializationEnd(Current.Project); // fire the event to resolve path references

                tableAndLayout.Layout.DataTable = table;          // this is the table for the layout now

                Current.ProjectService.CreateNewWorksheet(table, tableAndLayout.Layout);
            }
            else if (deserObject is Altaxo.Graph.Gdi.GraphDocument)
            {
                Altaxo.Graph.Gdi.GraphDocument graph = deserObject as Altaxo.Graph.Gdi.GraphDocument;
                if (graph.Name == null || graph.Name == string.Empty)
                {
                    graph.Name = Current.Project.GraphDocumentCollection.FindNewName();
                }
                else if (Current.Project.GraphDocumentCollection.Contains(graph.Name))
                {
                    graph.Name = Current.Project.GraphDocumentCollection.FindNewName(graph.Name);
                }

                Current.Project.GraphDocumentCollection.Add(graph);
                info.AnnounceDeserializationEnd(Current.Project); // fire the event to resolve path references in the graph

                Current.ProjectService.CreateNewGraph(graph);
            }
        }
    public static void OpenWorksheetOrGraph(string filename)
    {
      object deserObject;
      Altaxo.Serialization.Xml.XmlStreamDeserializationInfo info;
      using (System.IO.Stream myStream = new System.IO.FileStream(filename, System.IO.FileMode.Open, System.IO.FileAccess.Read, System.IO.FileShare.Read))
      {
        info = new Altaxo.Serialization.Xml.XmlStreamDeserializationInfo();
        info.BeginReading(myStream);
        deserObject = info.GetValue("Table", null);
        info.EndReading();
        myStream.Close();
      }

      // if it is a table, add it to the DataTableCollection
      if (deserObject is Altaxo.Data.DataTable)
      {
        Altaxo.Data.DataTable table = deserObject as Altaxo.Data.DataTable;
        if (table.Name == null || table.Name == string.Empty)
          table.Name = Current.Project.DataTableCollection.FindNewTableName();
        else if (Current.Project.DataTableCollection.ContainsTable(table.Name))
          table.Name = Current.Project.DataTableCollection.FindNewTableName(table.Name);

        Current.Project.DataTableCollection.Add(table);
        info.AnnounceDeserializationEnd(Current.Project); // fire the event to resolve path references

        Current.ProjectService.CreateNewWorksheet(table);
      }
      // if it is a table, add it to the DataTableCollection
      else if (deserObject is Altaxo.Worksheet.TablePlusLayout)
      {
        Altaxo.Worksheet.TablePlusLayout tableAndLayout = deserObject as Altaxo.Worksheet.TablePlusLayout;
        Altaxo.Data.DataTable table = tableAndLayout.Table;
        if (table.Name == null || table.Name == string.Empty)
          table.Name = Current.Project.DataTableCollection.FindNewTableName();
        else if (Current.Project.DataTableCollection.ContainsTable(table.Name))
          table.Name = Current.Project.DataTableCollection.FindNewTableName(table.Name);
        Current.Project.DataTableCollection.Add(table);

        if (tableAndLayout.Layout != null)
          Current.Project.TableLayouts.Add(tableAndLayout.Layout);

        info.AnnounceDeserializationEnd(Current.Project); // fire the event to resolve path references

        tableAndLayout.Layout.DataTable = table; // this is the table for the layout now

        Current.ProjectService.CreateNewWorksheet(table, tableAndLayout.Layout);
      }
      else if (deserObject is Altaxo.Graph.Gdi.GraphDocument)
      {
        Altaxo.Graph.Gdi.GraphDocument graph = deserObject as Altaxo.Graph.Gdi.GraphDocument;
        if (graph.Name == null || graph.Name == string.Empty)
          graph.Name = Current.Project.GraphDocumentCollection.FindNewName();
        else if (Current.Project.GraphDocumentCollection.Contains(graph.Name))
          graph.Name = Current.Project.GraphDocumentCollection.FindNewName(graph.Name);

        Current.Project.GraphDocumentCollection.Add(graph);
        info.AnnounceDeserializationEnd(Current.Project); // fire the event to resolve path references in the graph

        Current.ProjectService.CreateNewGraph(graph);
      }
    }
Beispiel #7
0
        /// <inheritdoc/>
        public override bool TryOpenProjectDocumentFile(string fileName, bool forceTrialRegardlessOfExtension)
        {
            if (null == fileName)
            {
                throw new ArgumentNullException(nameof(fileName));
            }

            if (!forceTrialRegardlessOfExtension)
            {
                var extension = System.IO.Path.GetExtension(fileName).ToLowerInvariant();

                if (!ProjectDocumentExtensions.Contains(extension))
                {
                    return(false);
                }
            }

            object deserializedObject;

            using (System.IO.Stream myStream = new System.IO.FileStream(fileName, System.IO.FileMode.Open, System.IO.FileAccess.Read, System.IO.FileShare.Read))
            {
                using (var info = new Altaxo.Serialization.Xml.XmlStreamDeserializationInfo())
                {
                    try
                    {
                        info.BeginReading(myStream);
                        deserializedObject = info.GetValue("Table", null);
                        info.EndReading();
                        myStream.Close();
                    }
                    catch (Exception ex)
                    {
                        return(false);
                    }

                    if (deserializedObject is IProjectItem projectItem)
                    {
                        Current.Project.AddItemWithThisOrModifiedName(projectItem);
                        info.AnnounceDeserializationEnd(Current.Project, false); // fire the event to resolve path references
                        Current.ProjectService.OpenOrCreateViewContentForDocument(projectItem);
                    }
                    else if (deserializedObject is Altaxo.Worksheet.TablePlusLayout tableAndLayout)
                    {
                        var table = tableAndLayout.Table;
                        Current.Project.AddItemWithThisOrModifiedName(table);

                        if (tableAndLayout.Layout != null)
                        {
                            Current.Project.TableLayouts.Add(tableAndLayout.Layout);
                        }

                        tableAndLayout.Layout.DataTable = table;                 // this is the table for the layout now

                        info.AnnounceDeserializationEnd(Current.Project, false); // fire the event to resolve path references

                        Current.ProjectService.CreateNewWorksheet(table, tableAndLayout.Layout);
                    }
                    else
                    {
                        return(false);
                    }

                    info.AnnounceDeserializationEnd(Current.Project, true); // final deserialization end
                    return(true);
                }
            }
        }
Beispiel #8
0
        /// <summary>
        /// Restores the state of the main window from a zipped Altaxo project file.
        /// </summary>
        /// <param name="zipFile">The zip file where the state file can be found into.</param>
        /// <param name="info">The deserialization info used to retrieve the data.</param>
        /// <param name="restoredDoc">The previously (also from the zip file!) restored Altaxo document.</param>
        public void RestoreWindowStateFromZippedFile(ZipArchive zipFile, Altaxo.Serialization.Xml.XmlStreamDeserializationInfo info, AltaxoDocument restoredDoc)
        {
            var restoredDocModels = new List <(object Document, string ZipEntryName)>();
            var restoredPadModels = new List <object>();

            Altaxo.Gui.Workbench.ViewStatesMemento selectedViewsMemento = null;

            foreach (var zipEntry in zipFile.Entries)
            {
                try
                {
                    if (zipEntry.FullName.StartsWith("Workbench/Views/"))
                    {
                        using (var zipinpstream = zipEntry.Open())
                        {
                            info.BeginReading(zipinpstream);
                            object readedobject = info.GetValue("ViewContentModel", null);
                            restoredDocModels.Add((readedobject, zipEntry.FullName));
                            info.EndReading();
                        }
                    }
                    else if (zipEntry.FullName.StartsWith("Workbench/Pads/"))
                    {
                        using (var zipinpstream = zipEntry.Open())
                        {
                            info.BeginReading(zipinpstream);
                            object readedobject = info.GetValue("Model", null);
                            if (readedobject != null)
                            {
                                restoredPadModels.Add(readedobject);
                            }
                            else
                            {
                            }
                            info.EndReading();
                        }
                    }
                    else if (zipEntry.FullName == "Workbench/ViewStates.xml")
                    {
                        using (var zipinpstream = zipEntry.Open())
                        {
                            info.BeginReading(zipinpstream);
                            selectedViewsMemento = info.GetValue("ViewStates", null) as Altaxo.Gui.Workbench.ViewStatesMemento;
                            info.EndReading();
                        }
                    }
                }
                catch (Exception ex)
                {
                    Current.Console.WriteLine("Exception during serialization of {0}, message: {1}", zipEntry.FullName, ex.Message);
                }
            }

            info.AnnounceDeserializationEnd(restoredDoc, false);
            info.AnnounceDeserializationEnd(restoredDoc, false);

            // now give all restored controllers a view and show them in the Main view

            foreach ((object doc, string entryName) in restoredDocModels)
            {
                var isSelected = entryName == selectedViewsMemento?.SelectedView_EntryName;
                Current.Workbench.ShowView(doc, isSelected);
            }

            foreach (var o in restoredPadModels)
            {
                var content = (IPadContent)Current.Gui.GetControllerAndControl(new object[] { o }, typeof(IPadContent));
                if (null != content)
                {
                    Current.Workbench.ShowPad(content, false);
                }
            }
        }
Beispiel #9
0
        /// <summary>
        /// Opens a Altaxo project from a stream. Any existing old project will be closed without confirmation.
        /// </summary>
        /// <param name="myStream">The stream from which to load the project.</param>
        /// <param name="filename">Either the filename of the file which stored the document, or null (e.g. myStream is a MemoryStream).</param>
        protected override string InternalLoadProjectFromStream(System.IO.Stream myStream, string filename)
        {
            var errorText = new System.Text.StringBuilder();

            var oldProject = CurrentOpenProject;

            if (null != oldProject)
            {
                OnProjectChanged(new ProjectEventArgs(oldProject, oldProject.Name, ProjectEventKind.ProjectClosing));
            }

            try
            {
                Current.Workbench.CloseAllViews();
            }
            catch (Exception exc)
            {
                errorText.Append(exc.ToString());
            }

            try
            {
                SetCurrentProject(null, string.Empty);
            }
            catch (Exception exc)
            {
                errorText.Append(exc.ToString());
            }

            // Old project is now closed
            if (null != oldProject)
            {
                OnProjectChanged(new ProjectEventArgs(oldProject, oldProject.Name, ProjectEventKind.ProjectClosed));
            }

            // Now open new project

            OnProjectChanged(new ProjectEventArgs(null, filename, ProjectEventKind.ProjectOpening));

            ZipArchive zipFile = null;

            ;
            AltaxoDocument newdocument = null;

            ;
            Altaxo.Serialization.Xml.XmlStreamDeserializationInfo info;

            try
            {
                newdocument = new AltaxoDocument();

                zipFile = new ZipArchive(myStream, ZipArchiveMode.Read);
                info    = new Altaxo.Serialization.Xml.XmlStreamDeserializationInfo();
            }
            catch (Exception exc)
            {
                errorText.Append(exc.ToString());
                return(errorText.ToString()); // this is unrecoverable - we must return
            }

            try
            {
                using (var suspendToken = newdocument.SuspendGetToken())
                {
                    newdocument.RestoreFromZippedFile(zipFile, info);
                }
            }
            catch (Exception exc)
            {
                errorText.Append(exc.ToString());
            }

            try
            {
                SetCurrentProject(newdocument, filename);

                RestoreWindowStateFromZippedFile(zipFile, info, newdocument);
                info.AnnounceDeserializationEnd(newdocument, true); // Final call to deserialization end

                CurrentOpenProject.IsDirty = false;

                info.AnnounceDeserializationHasCompletelyFinished(); // Annonce completly finished deserialization, activate data sources of the Altaxo document

                OnProjectChanged(new ProjectEventArgs(CurrentOpenProject, filename, ProjectEventKind.ProjectOpened));
            }
            catch (Exception exc)
            {
                errorText.Append(exc.ToString());
            }
            return(errorText.ToString());
        }
Beispiel #10
0
		/// <summary>
		/// Opens a Altaxo project from a stream. Any existing old project will be closed without confirmation.
		/// </summary>
		/// <param name="myStream">The stream from which to load the project.</param>
		/// <param name="filename">Either the filename of the file which stored the document, or null (e.g. myStream is a MemoryStream).</param>
		private string InternalLoadProjectFromStream(System.IO.Stream myStream, string filename)
		{
			var errorText = new System.Text.StringBuilder();

			var oldProject = CurrentOpenProject;

			if (null != oldProject)
				OnProjectChanged(new ProjectEventArgs(oldProject, oldProject.Name, ProjectEventKind.ProjectClosing));

			try
			{
				Current.Workbench.CloseAllViews();
			}
			catch (Exception exc)
			{
				errorText.Append(exc.ToString());
			}

			try
			{
				this.SetCurrentProject(null, string.Empty);
			}
			catch (Exception exc)
			{
				errorText.Append(exc.ToString());
			}

			// Old project is now closed
			if (null != oldProject)
				OnProjectChanged(new ProjectEventArgs(oldProject, oldProject.Name, ProjectEventKind.ProjectClosed));

			// Now open new project

			OnProjectChanged(new ProjectEventArgs(null, filename, ProjectEventKind.ProjectOpening));

			ZipFile zipFile = null; ;
			AltaxoDocument newdocument = null; ;
			Altaxo.Serialization.Xml.XmlStreamDeserializationInfo info;
			ZipFileWrapper zipFileWrapper;

			try
			{
				newdocument = new AltaxoDocument();

				zipFile = new ZipFile(myStream);
				info = new Altaxo.Serialization.Xml.XmlStreamDeserializationInfo();
				zipFileWrapper = new ZipFileWrapper(zipFile);
			}
			catch (Exception exc)
			{
				errorText.Append(exc.ToString());
				return errorText.ToString(); // this is unrecoverable - we must return
			}

			try
			{
				using (var suspendToken = newdocument.SuspendGetToken())
				{
					newdocument.RestoreFromZippedFile(zipFileWrapper, info);
				}
			}
			catch (Exception exc)
			{
				errorText.Append(exc.ToString());
			}

			try
			{
				this.SetCurrentProject(newdocument, filename);

				RestoreWindowStateFromZippedFile(zipFile, info, newdocument);
				info.AnnounceDeserializationEnd(newdocument, true); // Final call to deserialization end

				this.CurrentOpenProject.IsDirty = false;

				info.AnnounceDeserializationHasCompletelyFinished(); // Annonce completly finished deserialization, activate data sources of the Altaxo document

				OnProjectChanged(new ProjectEventArgs(this.CurrentOpenProject, filename, ProjectEventKind.ProjectOpened));
			}
			catch (Exception exc)
			{
				errorText.Append(exc.ToString());
			}
			return errorText.ToString();
		}
Beispiel #11
0
        public void RestoreFromZippedFile(ZipArchive zipFile, Altaxo.Serialization.Xml.XmlStreamDeserializationInfo info)
        {
            var errorText = new System.Text.StringBuilder();

            foreach (var zipEntry in zipFile.Entries)
            {
                try
                {
                    if (zipEntry.FullName.StartsWith("Tables/"))
                    {
                        using (var zipinpstream = zipEntry.Open())
                        {
                            info.BeginReading(zipinpstream);
                            object readedobject = info.GetValue("Table", null);
                            if (readedobject is Altaxo.Data.DataTable)
                            {
                                _dataTables.Add((Altaxo.Data.DataTable)readedobject);
                            }
                            info.EndReading();
                        }
                    }
                    else if (zipEntry.FullName.StartsWith("Graphs/"))
                    {
                        using (var zipinpstream = zipEntry.Open())
                        {
                            info.BeginReading(zipinpstream);
                            object readedobject = info.GetValue("Graph", null);
                            if (readedobject is Graph.Gdi.GraphDocument)
                            {
                                _graphs.Add((Graph.Gdi.GraphDocument)readedobject);
                            }
                            info.EndReading();
                        }
                    }
                    else if (zipEntry.FullName.StartsWith("Graphs3D/"))
                    {
                        using (var zipinpstream = zipEntry.Open())
                        {
                            info.BeginReading(zipinpstream);
                            object readedobject = info.GetValue("Graph", null);
                            if (readedobject is Graph.Graph3D.GraphDocument)
                            {
                                _graphs3D.Add((Graph.Graph3D.GraphDocument)readedobject);
                            }
                            info.EndReading();
                        }
                    }
                    else if (zipEntry.FullName.StartsWith("Texts/"))
                    {
                        using (var zipinpstream = zipEntry.Open())
                        {
                            info.BeginReading(zipinpstream);
                            object readedobject = info.GetValue("Text", null);
                            if (readedobject is Text.TextDocument noteDoc)
                            {
                                _textDocuments.Add(noteDoc);
                            }
                            info.EndReading();
                        }
                    }
                    else if (zipEntry.FullName.StartsWith("TableLayouts/"))
                    {
                        using (var zipinpstream = zipEntry.Open())
                        {
                            info.BeginReading(zipinpstream);
                            object readedobject = info.GetValue("WorksheetLayout", null);
                            if (readedobject is Altaxo.Worksheet.WorksheetLayout)
                            {
                                _tableLayouts.Add((Altaxo.Worksheet.WorksheetLayout)readedobject);
                            }
                            info.EndReading();
                        }
                    }
                    else if (zipEntry.FullName.StartsWith("FitFunctionScripts/"))
                    {
                        using (var zipinpstream = zipEntry.Open())
                        {
                            info.BeginReading(zipinpstream);
                            object readedobject = info.GetValue("FitFunctionScript", null);
                            if (readedobject is Altaxo.Scripting.FitFunctionScript)
                            {
                                _fitFunctionScripts.Add((Altaxo.Scripting.FitFunctionScript)readedobject);
                            }
                            info.EndReading();
                        }
                    }
                    else if (zipEntry.FullName.StartsWith("FolderProperties/"))
                    {
                        using (var zipinpstream = zipEntry.Open())
                        {
                            info.BeginReading(zipinpstream);
                            object readedobject = info.GetValue("FolderProperty", null);
                            if (readedobject is Altaxo.Main.Properties.ProjectFolderPropertyDocument)
                            {
                                _projectFolderProperties.Add((Altaxo.Main.Properties.ProjectFolderPropertyDocument)readedobject);
                            }
                            info.EndReading();
                        }
                    }
                    else if (zipEntry.FullName == "DocumentInformation.xml")
                    {
                        using (var zipinpstream = zipEntry.Open())
                        {
                            info.BeginReading(zipinpstream);
                            object readedobject = info.GetValue("DocumentInformation", null);
                            if (readedobject is DocumentInformation)
                            {
                                _documentInformation = (DocumentInformation)readedobject;
                            }
                            info.EndReading();
                        }
                    }
                }
                catch (Exception exc)
                {
                    errorText.Append("Error deserializing ");
                    errorText.Append(zipEntry.Name);
                    errorText.Append(", ");
                    errorText.Append(exc.ToString());
                }
            }

            try
            {
                info.AnnounceDeserializationEnd(this, false);
            }
            catch (Exception exc)
            {
                errorText.Append(exc.ToString());
            }

            if (errorText.Length != 0)
            {
                throw new ApplicationException(errorText.ToString());
            }
        }