Thread: Duping
View Single Post
Old 12-01-2002, 09:58 PM   #2 (permalink)
Lost User
Guest
 
Posts: n/a
Default

Use this tweak i wrote:

[code:1]
private static void DupeProperties ( Item src, Item dest, params string[] ignore )
{
Console.WriteLine("Property dupe, src = \'{0}\' dest = \'{1}\'",src.Serial.Value,dest.Serial.Value );

PropertyInfo[] pi_src = src.GetType().GetProperties();
PropertyInfo[] pi_dest = src.GetType().GetProperties();

for ( int i = 0; i < pi_src.Length; i++ )
{
bool bValid = true;

for ( int j = 0; j < ignore.Length; j++ )
{
if ( pi_src[i].Name == ignore[j] )
bValid = false;
}

if ( ( pi_dest[i].GetSetMethod() != null ) && (bValid) )
{
pi_dest[i].SetValue(dest,pi_src[i].GetValue(src,nu ll),null);
Console.WriteLine (" - {0} {1} = {2}", pi_dest[i].PropertyType.Name,pi_dest[i].Name,pi_de st[i].GetValue(dest,null));
}

}
}
[/code:1]

Now, put [code:1]DupeProperties ( copy as Item, item as Item,"Location","Parent");[/code:1] after [code:1]copy.MoveToWorld( from.Location, from.Map );[/code:1] on DupeTarget.OnTarget()
  Reply With Quote