private void mergeToolStripMenuItem_Click(object sender, EventArgs e)
{
DialogResult res = this.openFileDialogMerge.ShowDialog();
if (res != DialogResult.OK)
return;
// load file into different context, compare
this.m_loading = true;
Dictionary<long, SEntity> instances = new Dictionary<long, SEntity>();
using (FormatSPF format = new FormatSPF(this.openFileDialogMerge.FileName, SchemaDOC.Types, instances))
{
format.Load();
}
this.m_loading = false;
// now import changes
DocProject docProjectBase = null;
foreach (SEntity o in instances.Values)
{
if (o is DocProject)
{
docProjectBase = (DocProject)o;
}
}
// create guid map for rapid lookup
Dictionary<Guid, DocObject> mapGuid = new Dictionary<Guid, DocObject>();
foreach (SEntity o in this.m_instances.Values)
{
if (o is DocObject)
{
DocObject docObj = (DocObject)o;
try
{
mapGuid.Add(docObj.Uuid, docObj);
}
catch
{
System.Diagnostics.Debug.WriteLine("Duplicate Guid: " + docObj.Uuid.ToString() + " - " + docObj.GetType().ToString() + " - " + docObj.Name);
}
}
}
using (FormMerge formMerge = new FormMerge(mapGuid, docProjectBase))
{
res = formMerge.ShowDialog(this);
if(res == System.Windows.Forms.DialogResult.OK)
{
this.LoadTree();
}
}
}