SEToolbox.Models.WorldResource.LoadSectorXml C# (CSharp) Method

LoadSectorXml() public method

public LoadSectorXml ( ) : XmlDocument
return System.Xml.XmlDocument
        public XmlDocument LoadSectorXml()
        {
            var filename = Path.Combine(Savepath, SpaceEngineersConsts.SandBoxCheckpointFilename);
            var xDoc = new XmlDocument();

            try
            {
                if (ZipTools.IsGzipedFile(filename))
                {
                    // New file format is compressed.
                    // These steps could probably be combined, but would have to use a MemoryStream, which has memory limits before it causes performance issues when chunking memory.
                    // Using a temporary file in this situation has less performance issues as it's moved straight to disk.
                    var tempFilename = TempfileUtil.NewFilename();
                    ZipTools.GZipUncompress(filename, tempFilename);
                    xDoc.Load(tempFilename);
                    _compressedCheckpointFormat = true;
                }
                else
                {
                    // Old file format is raw XML.
                    xDoc.Load(filename);
                    _compressedCheckpointFormat = false;
                }
            }
            catch
            {
                return null;
            }

            return xDoc;
        }