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