Exemplo n.º 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;
                }
            }
        }
Exemplo n.º 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;
        }
Exemplo n.º 3
0
        public Catalog()
            : base(DefaultLocation, false)
        {
            LoadTemplateCatalog(DefaultLocation);
            _isDefaultLocation = true;

            _info = new CatalogInfo(this);
        }
Exemplo n.º 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;
                }
            }
        }
Exemplo n.º 5
0
        public Catalog()
            : base(DefaultLocation, false)
        {
            LoadTemplateCatalog(DefaultLocation);
            _isDefaultLocation = true;

            _info = new CatalogInfo(this);
        }
Exemplo n.º 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;
        }