diff --git a/projects/GKCore/GDModel/Providers/GEDZIP/GEDZIPProvider.cs b/projects/GKCore/GDModel/Providers/GEDZIP/GEDZIPProvider.cs new file mode 100644 index 000000000..6e8265cca --- /dev/null +++ b/projects/GKCore/GDModel/Providers/GEDZIP/GEDZIPProvider.cs @@ -0,0 +1,68 @@ +/* + * "GEDKeeper", the personal genealogical database editor. + * Copyright (C) 2009-2023 by Sergey V. Zhdanovskih. + * + * This file is part of "GEDKeeper". + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +using System.IO; +using System.Text; +using GDModel.Providers.GEDCOM; +using GKCore; + +namespace GDModel.Providers.GEDZIP +{ + /// + /// Processing the GEDZIP format is one part of the Genealogical Data Model (GDM). + /// + public class GEDZIPProvider : FileProvider + { + static GEDZIPProvider() + { + // Static initialization of the GEDCOMProvider is needed, + // otherwise the standard tag identifiers are out of sync + SysUtils.DoNotInline(GEDCOMProvider.GEDCOMFormats); + } + + public GEDZIPProvider(GDMTree tree) : base(tree) + { + } + + public override string GetFilesFilter() + { + return "GEDZIP files (*.gdz,*.zip)|*.gdz,*.zip"; + } + + protected override Encoding GetDefaultEncoding() + { + return Encoding.UTF8; + } + + protected override string DetectCharset(Stream inputStream, bool charsetDetection) + { + string streamCharset = null; + return streamCharset; + } + + public override void LoadFromStreamExt(Stream fileStream, Stream inputStream, bool charsetDetection = false) + { + } + + protected override void LoadFromReader(Stream fileStream, StreamReader reader, string streamCharset = null) + { + } + } +} diff --git a/projects/GKCore/GKCore.csproj b/projects/GKCore/GKCore.csproj index 1e198a90b..2412f10a0 100644 --- a/projects/GKCore/GKCore.csproj +++ b/projects/GKCore/GKCore.csproj @@ -64,6 +64,7 @@ GlobalSuppressions.cs + diff --git a/projects/GKCore/GKCore/BaseContext.cs b/projects/GKCore/GKCore/BaseContext.cs index 4b7d002ea..071653a04 100644 --- a/projects/GKCore/GKCore/BaseContext.cs +++ b/projects/GKCore/GKCore/BaseContext.cs @@ -31,6 +31,7 @@ using GDModel.Providers.FamilyShow; using GDModel.Providers.GEDCOM; using GDModel.Providers.GedML; +using GDModel.Providers.GEDZIP; using GKCore.Controllers; using GKCore.Cultures; using GKCore.Design; @@ -1387,6 +1388,8 @@ public async Task FileLoad(string fileName, bool loadSecure, bool showProg fileProvider = new GedMLProvider(fTree); } else if (ext == ".familyx") { fileProvider = new FamilyXProvider(fTree); + } else if (ext == ".gdz" || ext == ".zip") { + fileProvider = new GEDZIPProvider(fTree); } else { // TODO: message? return false; diff --git a/projects/GKCore/GKCore/Controllers/BaseWinController.cs b/projects/GKCore/GKCore/Controllers/BaseWinController.cs index 0616acc72..370690c50 100644 --- a/projects/GKCore/GKCore/Controllers/BaseWinController.cs +++ b/projects/GKCore/GKCore/Controllers/BaseWinController.cs @@ -20,6 +20,7 @@ #define GEDML_SUPPORT #define FAMX_SUPPORT +//#define GDZ_SUPPORT using System; using System.Collections.Generic; @@ -157,6 +158,10 @@ private void PrepareLoadFile(out string homePath, out string filters) #if FAMX_SUPPORT filters += "|" + "Family.Show files (*.familyx)|*.familyx"; #endif + +#if GDZ_SUPPORT + filters += "|" + "GEDZIP files (*.gdz,*.zip)|*.gdz,*.zip"; +#endif } public async Task LoadFileEx()