public override IRow Process(IRow input, IUpdatableRow output)
{
List<string> list = new List<string>();
foreach (var current in input.Schema)
{
if (current.Type.IsGenericType && current.Type.GetGenericTypeDefinition() == typeof(SqlMap) && current.Type.GetGenericArguments()[0] == typeof(string))
{
list.Add(current.Name);
}
}
Dictionary<string, ArrayList> maps_to_be_changed = new Dictionary<string, ArrayList>();
foreach (var current2 in output.Schema)
{
bool flag = list.Contains(current2.Name);
if (-1 < input.Schema.IndexOf(current2.Name) && !flag)
{
output.Set<object>(current2.Name, input.Get<object>(current2.Name));
}
else if (!flag)
{
foreach (string current3 in list)
{
SqlMap<string, string> sqlMap = input.Get<SqlMap<string, string>>(current3);
SqlArray<string> sqlArray = null;
List<string> list2 = null;
if (sqlMap != null)
{
sqlArray = sqlMap.Keys;
if (sqlMap.Values != null)
{
list2 = sqlMap.Values.ToList<string>();
}
}
int num = (sqlArray == null) ? -1 : sqlArray.ToList<string>().IndexOf(current2.Name);
if (num != -1)
{
output.Set<string>(current2.Name, list2[num]);
if (maps_to_be_changed.Keys.Contains(current3))
{
maps_to_be_changed[current3].Add(current2.Name);
}
else
{
maps_to_be_changed.Add(current3, new ArrayList
{
current2.Name
});
}
break;
}
output.Set<object>(current2.Name, current2.Type.IsValueType ? Activator.CreateInstance(current2.Type) : null);
}
}
}
using (IEnumerator<IColumn> enumerator = output.Schema.GetEnumerator())
{
while (enumerator.MoveNext())
{
IColumn out_col = enumerator.Current;
bool flag = list.Contains(out_col.Name);
if (flag)
{
SqlMap<string, string> sqlMap = input.Get<SqlMap<string, string>>(out_col.Name);
if (maps_to_be_changed != null && maps_to_be_changed.Keys.Contains(out_col.Name))
{
sqlMap = new SqlMap<string, string>(
from kvp in sqlMap
where !maps_to_be_changed[out_col.Name].Contains(kvp.Key)
select kvp);
}
output.Set<SqlMap<string, string>>(out_col.Name, sqlMap);
}
}
}
return output.AsReadOnly();
}