// System.out.println("RequestCompletedObserver called ...");
CapsHttpRequestCompletedArg rcha = (CapsHttpRequestCompletedArg) arg1;
if (rcha.getResult() == null)
{
JLogger.error("Failed retrieving ObjectMedia data");
try { callback.execute( new ObjectMediaCallbackArgs(false, "", null)); }
catch (Exception ex) { JLogger.error(Utils.getExceptionStackTraceAsString(ex)); }
return;
}
LindenMessages.ObjectMediaMessage msg = new LindenMessages.ObjectMediaMessage();
msg.Deserialize((OSDMap)rcha.getResult());
if (msg.Request instanceof LindenMessages.ObjectMediaResponse)
{
LindenMessages.ObjectMediaResponse response = (LindenMessages.ObjectMediaResponse)msg.Request;
if (Client.settings.OBJECT_TRACKING)
{
// final Primitive[] primarray = new Primitive[]{null};
// Primitive prim = null;
// sim.ObjectsPrimitives.foreach(new Action<Entry<Long, Primitive>>()
// {
// public void execute(
// Entry<Long, Primitive> t) {
// if(t.getValue().ID.equals(primID))
// {
// primarray[0] = t.getValue();
// }
// }
// });
// prim = primarray[0];
Primitive prim = sim.ObjectsPrimitives.get(primID);
// Find((Primitive p) => { return p.ID == primID; });
if (prim != null)
{
prim.MediaVersion = response.Version;
prim.FaceMedia = response.FaceMedia;
}
}
try { callback.execute( new ObjectMediaCallbackArgs(true, response.Version, response.FaceMedia)); }
catch (Exception ex) { JLogger.error(Utils.getExceptionStackTraceAsString(ex)); }
}
else
{
try { callback.execute( new ObjectMediaCallbackArgs(false, "", null)); }
catch (Exception ex) { JLogger.error(Utils.getExceptionStackTraceAsString(ex)); }
}
}
});
request.BeginGetResponse(req.Serialize(), OSDFormat.Xml, Client.settings.CAPS_TIMEOUT);
}
else
{
JLogger.error("ObjectMedia capability not available");
try { callback.execute( new ObjectMediaCallbackArgs(false, "", null)); }
catch (Exception ex) { JLogger.error(Utils.getExceptionStackTraceAsString(ex)); }
}
}