e79aa3c0ed
Former-commit-id: a2155e9bd80020e49e72e86c44da02a8ac0e57a4
74 lines
1.9 KiB
C#
74 lines
1.9 KiB
C#
//-----------------------------------------------------------------------------
|
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
//-----------------------------------------------------------------------------
|
|
|
|
namespace System.Activities.DynamicUpdate
|
|
{
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Collections.ObjectModel;
|
|
using System.Runtime;
|
|
using System.Runtime.Serialization;
|
|
using System.ComponentModel;
|
|
|
|
[DataContract]
|
|
internal class EnvironmentUpdateMapEntry
|
|
{
|
|
internal const int NonExistent = -1;
|
|
|
|
public EnvironmentUpdateMapEntry()
|
|
{
|
|
}
|
|
|
|
[DataMember(EmitDefaultValue = false)]
|
|
public int OldOffset
|
|
{
|
|
get;
|
|
set;
|
|
}
|
|
|
|
[DataMember(EmitDefaultValue = false)]
|
|
public int NewOffset
|
|
{
|
|
get;
|
|
set;
|
|
}
|
|
|
|
[DataMember(EmitDefaultValue = false)]
|
|
public bool IsNewHandle
|
|
{
|
|
get;
|
|
set;
|
|
}
|
|
|
|
internal bool IsAddition
|
|
{
|
|
get
|
|
{
|
|
return this.OldOffset == EnvironmentUpdateMapEntry.NonExistent;
|
|
}
|
|
}
|
|
|
|
internal static EnvironmentUpdateMapEntry Merge(EnvironmentUpdateMapEntry first, EnvironmentUpdateMapEntry second)
|
|
{
|
|
if (first == null || second == null)
|
|
{
|
|
return first ?? second;
|
|
}
|
|
|
|
Fx.Assert(first.NewOffset == second.OldOffset && !second.IsAddition, "Merging mismatched entries");
|
|
if (first.OldOffset == second.NewOffset)
|
|
{
|
|
return null;
|
|
}
|
|
|
|
return new EnvironmentUpdateMapEntry
|
|
{
|
|
OldOffset = first.OldOffset,
|
|
NewOffset = second.NewOffset,
|
|
IsNewHandle = first.IsNewHandle
|
|
};
|
|
}
|
|
}
|
|
}
|