Skip to content

Commit

Permalink
Initial commit of the tree sync plugin (#583)
Browse files Browse the repository at this point in the history
  • Loading branch information
Serg-Norseman committed Jun 30, 2024
1 parent 540b958 commit 905af92
Show file tree
Hide file tree
Showing 7 changed files with 1,041 additions and 0 deletions.
1 change: 1 addition & 0 deletions projects/GKCore/GKCore.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,7 @@
<Compile Include="GKCore\SingleInstance\MapiMailMessage.cs" />
<Compile Include="GKCore\FreqCollection.cs" />
<Compile Include="GKCore\SysUtils.cs" />
<Compile Include="GKCore\Tools\SyncTool.cs" />
<Compile Include="GKUI\ImageBox.cs" />
<Compile Include="GKUI\Themes\BaseThemeManager.cs" />
<Compile Include="GKUI\Themes\IThemedView.cs" />
Expand Down
58 changes: 58 additions & 0 deletions projects/GKCore/GKCore/Tools/SyncTool.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
/*
* "GEDKeeper", the personal genealogical database editor.
* Copyright (C) 2009-2024 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 <http://www.gnu.org/licenses/>.
*/

using System;
using GDModel;
using GDModel.Providers.GEDCOM;

namespace GKCore.Tools
{
public enum RecordStatus
{
Unknown, // gray
Identical, // white
Changed, // yellow
Deleted, // orange or red
Added, // lightblue or cyan
}


/// <summary>
///
/// </summary>
public class SyncTool
{
public void LoadOtherFile(GDMTree mainTree, string fileName)
{
if (mainTree == null)
throw new ArgumentNullException("mainTree");

if (string.IsNullOrEmpty(fileName))
throw new ArgumentNullException("fileName");

using (var extTree = new GDMTree()) {
var gedcomProvider = new GEDCOMProvider(extTree);
gedcomProvider.LoadFromFile(fileName);

//
}
}
}
}
503 changes: 503 additions & 0 deletions projects/GKv2/GEDKeeper2Sync.sln

Large diffs are not rendered by default.

103 changes: 103 additions & 0 deletions projects/plugins/GKTreeSyncPlugin/GKTreeSyncPlugin.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
/*
* "GEDKeeper", the personal genealogical database editor.
* Copyright (C) 2009-2024 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 <http://www.gnu.org/licenses/>.
*/

using System;
using System.Reflection;
using GKCore;
using GKCore.Design.Graphics;
using GKCore.Interfaces;
using GKCore.Plugins;

[assembly: AssemblyTitle("GKTreeSyncPlugin")]
[assembly: AssemblyDescription("GEDKeeper Tree Synchronization plugin")]
[assembly: AssemblyProduct("GEDKeeper")]
[assembly: AssemblyCopyright("Copyright © 2024 by Sergey V. Zhdanovskih")]
[assembly: AssemblyVersion("0.1.0.0")]
[assembly: AssemblyCulture("")]

#if DEBUG
[assembly: AssemblyConfiguration("Debug")]
#elif RELEASE
[assembly: AssemblyConfiguration("Release")]
#endif

namespace GKTreeSyncPlugin
{
public enum PLS
{
Title = 1,
}

public sealed class Plugin : WidgetPlugin
{
private string fDisplayName = "GKTreeSyncPlugin";
private ILangMan fLangMan;

public override string DisplayName { get { return fDisplayName; } }
public override ILangMan LangMan { get { return fLangMan; } }
public override IImage Icon { get { return null; } }
public override PluginCategory Category { get { return PluginCategory.Tool; } }

private TSForm fForm;

protected override void Dispose(bool disposing)
{
if (disposing) {
if (fForm != null) fForm.Dispose();
}
base.Dispose(disposing);
}

public override void Execute()
{
IBaseWindow curBase = Host.GetCurrentFile();
if (curBase == null) return;

fForm = new TSForm(this, curBase);
fForm.Show();
}

public override void OnLanguageChange()
{
try {
fLangMan = Host.CreateLangMan(this);
//fDisplayName = fLangMan.LS(PLS.Title);

if (fForm != null) fForm.SetLocale();
} catch (Exception ex) {
Logger.WriteError("GKTreeSyncPlugin.OnLanguageChange()", ex);
}
}

public override void BaseChanged(IBaseWindow baseWin)
{
/*if (fForm != null) {
fForm.BaseChanged(baseWin);
}*/
}

public override void BaseClosed(IBaseWindow baseWin)
{
/*if (fForm != null) {
fForm.BaseChanged(null);
}*/
}
}
}
66 changes: 66 additions & 0 deletions projects/plugins/GKTreeSyncPlugin/GKTreeSyncPlugin.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{A564097E-CFE8-4098-BAE5-D7693F9AD297}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>GKTreeSyncPlugin</RootNamespace>
<AssemblyName>GKTreeSyncPlugin</AssemblyName>
<TargetFrameworkVersion>v4.7.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\..\..\plugins\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>..\..\..\plugins\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="BSLib">
<HintPath>..\..\libs\BSLib.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="GKTreeSyncPlugin.cs" />
<Compile Include="TSForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="TSForm.Designer.cs">
<DependentUpon>TSForm.cs</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\GKCore\GKCore.csproj">
<Project>{10d619af-e1cd-4f4a-9c19-5e434300b48f}</Project>
<Name>GKCore</Name>
</ProjectReference>
<ProjectReference Include="..\..\GKv2\GKComponents\GKComponents.csproj">
<Project>{ef9864c5-4dec-46e8-bc11-a2e5bb9bb9d4}</Project>
<Name>GKComponents</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Folder Include="Properties\" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
Loading

0 comments on commit 905af92

Please sign in to comment.