Пример #1
0
        private void MigrateDataToLatestVersion()
        {
            ConsistencyCheck();

            if (CatalogInfoTable.Rows.Count < 1)
            {
                // If catalog info does not exist, we create it.
                CatalogInfoTable.AddCatalogInfoRow(CatalogInfoTable.NewCatalogInfoRow());
                CatalogInfoTable.AcceptChanges();

                _info = new CatalogInfo(this);
            }
            else
            {
                if (_info == null)
                {
                    _info = new CatalogInfo(this);
                }

                string latestVersion = new Catalog().CatalogSchemaVersion;
                if (CatalogSchemaVersion != latestVersion)
                {
                    (CatalogInfoTable.Rows[0] as CatalogDataset.CatalogInfoRow).Version = latestVersion;
                    (CatalogInfoTable.Rows[0] as CatalogDataset.CatalogInfoRow).AcceptChanges();

                    version = latestVersion;
                }
            }
        }
Пример #2
0
        public void Save(string path)
        {
            FileStream outputStream = null;
            GZipStream zipStream    = null;

            try
            {
                MigrateDataToLatestVersion();

                outputStream = new FileStream(path, FileMode.OpenOrCreate, FileAccess.Write, FileShare.None);
                zipStream    = new GZipStream(outputStream, CompressionMode.Compress);

                _dataset.WriteXml(zipStream);
            }
            finally
            {
                if (zipStream != null)
                {
                    zipStream.Close();
                }
                if (outputStream != null)
                {
                    outputStream.Close();
                }
            }

            LoadFromPath(path, false);
            _info = new CatalogInfo(this);

            _isDefaultLocation = false;
        }
Пример #3
0
        public Catalog()
            : base(DefaultLocation, false)
        {
            LoadTemplateCatalog(DefaultLocation);
            _isDefaultLocation = true;

            _info = new CatalogInfo(this);
        }
Пример #4
0
        private void MigrateDataToLatestVersion()
        {
            ConsistencyCheck();

            if (CatalogInfoTable.Rows.Count < 1)
            {
                // If catalog info does not exist, we create it.
                CatalogInfoTable.AddCatalogInfoRow(CatalogInfoTable.NewCatalogInfoRow());
                CatalogInfoTable.AcceptChanges();

                _info = new CatalogInfo(this);
            }
            else
            {
                if (_info == null)
                {
                    _info = new CatalogInfo(this);
                }

                string latestVersion = new Catalog().CatalogSchemaVersion;
                if (CatalogSchemaVersion != latestVersion)
                {
                    (CatalogInfoTable.Rows[0] as CatalogDataset.CatalogInfoRow).Version = latestVersion;
                    (CatalogInfoTable.Rows[0] as CatalogDataset.CatalogInfoRow).AcceptChanges();

                    version = latestVersion;
                }
            }
        }
Пример #5
0
        public Catalog()
            : base(DefaultLocation, false)
        {
            LoadTemplateCatalog(DefaultLocation);
            _isDefaultLocation = true;

            _info = new CatalogInfo(this);
        }
Пример #6
0
        public void Save(string path)
        {
            FileStream outputStream = null;
            GZipStream zipStream = null;

            try
            {
                MigrateDataToLatestVersion();

                outputStream = new FileStream(path, FileMode.OpenOrCreate, FileAccess.Write, FileShare.None);
                zipStream = new GZipStream(outputStream, CompressionMode.Compress);

                _dataset.WriteXml(zipStream);
            }
            finally
            {
                if (zipStream != null) zipStream.Close();
                if (outputStream != null) outputStream.Close();
            }

            LoadFromPath(path, false);
            _info = new CatalogInfo(this);

            _isDefaultLocation = false;
        }