}
public static Avatar FromOSD(OSD O)
{
OSDMap tex = (OSDMap)O;
Avatar A = new Avatar();
Primitive P = Primitive.FromOSD(O);
//FIXME need to uncomment following
// Type Prim = typeof(Primitive);
//
// FieldInfo[] Fields = Prim.GetFields();
//
// for (int x = 0; x < Fields.Length; x++)
// {
// Logger.Log("Field Matched in FromOSD: "+Fields[x].Name, Helpers.LogLevel.Debug);
// Fields[x].SetValue(A, Fields[x].GetValue(P));
// }
A.Groups = new ArrayList<UUID>();
for (OSD U : (OSDArray)tex.get("groups"))
{
A.Groups.add(U.asUUID());
}
A.ProfileStatistics = Statistics.FromOSD(tex.get("profile_statistics"));
A.ProfileProperties = AvatarProperties.FromOSD(tex.get("profile_properties"));
A.ProfileInterests = Interests.FromOSD(tex.get("profile_interest"));
A.ControlFlags = AgentManager.ControlFlags.get(tex.get("control_flags").asLong());
OSDArray vp = (OSDArray)tex.get("visual_parameters");
A.VisualParameters = new byte[vp.count()];
for (int i = 0; i < vp.count(); i++)
{
A.VisualParameters[i] = (byte)vp.get(i).asInteger();
}
// *********************From Code Above *******************************
/*if (NameValues[i].Name == "FirstName" && NameValues[i].Type == NameValue.ValueType.String)
firstName = (string)NameValues[i].Value;
else if (NameValues[i].Name == "LastName" && NameValues[i].Type == NameValue.ValueType.String)
lastName = (string)NameValues[i].Value;*/
// ********************************************************************
A.NameValues = new NameValue[3];
NameValue First = new NameValue();
First.Name = "FirstName";
First.Type = NameValue.ValueType.String;
First.Value = tex.get("first_name").asString();
NameValue Last = new NameValue();
Last.Name = "LastName";
Last.Type = NameValue.ValueType.String;
Last.Value = tex.get("last_name").asString();
// ***************From Code Above***************
// if (NameValues[i].Name == "Title" && NameValues[i].Type == NameValue.ValueType.String)
// *********************************************
NameValue Group = new NameValue();
Group.Name = "Title";
Group.Type = NameValue.ValueType.String;
Group.Value = tex.get("group_name").asString();
A.NameValues[0] = First;
A.NameValues[1] = Last;