public static TextureEntry FromLLSD(LLSD llsd) { LLSDArray array = (LLSDArray)llsd; LLSDMap faceLLSD; if (array.Count > 0) { int faceNumber; faceLLSD = (LLSDMap)array[0]; TextureEntryFace defaultFace = TextureEntryFace.FromLLSD(faceLLSD, null, out faceNumber); TextureEntry te = new TextureEntry(defaultFace); for (int i = 1; i < array.Count; i++) { TextureEntryFace tex = TextureEntryFace.FromLLSD(array[i], defaultFace, out faceNumber); if (faceNumber >= 0 && faceNumber < te.FaceTextures.Length) { te.FaceTextures[faceNumber] = tex; } } return(te); } else { throw new ArgumentException("LLSD contains no elements"); } }