public LLSD ToLLSD(int faceNumber) { LLSDMap tex = new LLSDMap(10); if (faceNumber >= 0) { tex["face_number"] = LLSD.FromInteger(faceNumber); } tex["colors"] = RGBA.ToLLSD(); tex["scales"] = LLSD.FromReal(RepeatU); tex["scalet"] = LLSD.FromReal(RepeatV); tex["offsets"] = LLSD.FromReal(OffsetU); tex["offsett"] = LLSD.FromReal(OffsetV); tex["imagerot"] = LLSD.FromReal(Rotation); tex["bump"] = LLSD.FromInteger((int)Bump); tex["shiny"] = LLSD.FromInteger((int)Shiny); tex["fullbright"] = LLSD.FromBoolean(Fullbright); tex["media_flags"] = LLSD.FromInteger(Convert.ToInt32(MediaFlags)); tex["mapping"] = LLSD.FromInteger((int)TexMapType); tex["glow"] = LLSD.FromReal(Glow); if (TextureID != LLObject.TextureEntry.WHITE_TEXTURE) { tex["imageid"] = LLSD.FromUUID(TextureID); } else { tex["imageid"] = LLSD.FromUUID(LLUUID.Zero); } return(tex); }
public LLSD ToLLSD() { LLSDMap path = new LLSDMap(14); path["begin"] = LLSD.FromReal(Data.PathBegin); path["curve"] = LLSD.FromInteger((int)Data.PathCurve); path["end"] = LLSD.FromReal(Data.PathEnd); path["radius_offset"] = LLSD.FromReal(Data.PathRadiusOffset); path["revolutions"] = LLSD.FromReal(Data.PathRevolutions); path["scale_x"] = LLSD.FromReal(Data.PathScaleX); path["scale_y"] = LLSD.FromReal(Data.PathScaleY); path["shear_x"] = LLSD.FromReal(Data.PathShearX); path["shear_y"] = LLSD.FromReal(Data.PathShearY); path["skew"] = LLSD.FromReal(Data.PathSkew); path["taper_x"] = LLSD.FromReal(Data.PathTaperX); path["taper_y"] = LLSD.FromReal(Data.PathTaperY); path["twist"] = LLSD.FromReal(Data.PathTwist); path["twist_begin"] = LLSD.FromReal(Data.PathTwistBegin); LLSDMap profile = new LLSDMap(4); profile["begin"] = LLSD.FromReal(Data.ProfileBegin); profile["curve"] = LLSD.FromInteger((int)Data.ProfileCurve); profile["hole"] = LLSD.FromInteger((int)Data.ProfileHole); profile["end"] = LLSD.FromReal(Data.ProfileEnd); profile["hollow"] = LLSD.FromReal(Data.ProfileHollow); LLSDMap volume = new LLSDMap(2); volume["path"] = path; volume["profile"] = profile; LLSDMap prim = new LLSDMap(9); prim["name"] = LLSD.FromString(Properties.Name); prim["description"] = LLSD.FromString(Properties.Description); prim["phantom"] = LLSD.FromBoolean(((Flags & ObjectFlags.Phantom) != 0)); prim["physical"] = LLSD.FromBoolean(((Flags & ObjectFlags.Physics) != 0)); prim["position"] = Position.ToLLSD(); prim["rotation"] = Rotation.ToLLSD(); prim["scale"] = Scale.ToLLSD(); prim["material"] = LLSD.FromInteger((int)Data.Material); prim["shadows"] = LLSD.FromBoolean(((Flags & ObjectFlags.CastShadows) != 0)); prim["textures"] = Textures.ToLLSD(); prim["volume"] = volume; if (ParentID != 0) { prim["parentid"] = LLSD.FromInteger(ParentID); } prim["light"] = Light.ToLLSD(); prim["flex"] = Flexible.ToLLSD(); prim["sculpt"] = Sculpt.ToLLSD(); return(prim); }
private void BeginLogin() { LoginParams loginParams = CurrentContext.Value; // Sanity check if (loginParams.Options == null) { loginParams.Options = new List <string>(); } // Convert the password to MD5 if it isn't already if (loginParams.Password.Length != 35 && !loginParams.Password.StartsWith("$1$")) { loginParams.Password = Helpers.MD5(loginParams.Password); } // Override SSL authentication mechanisms. DO NOT convert this to the // .NET 2.0 preferred method, the equivalent function in Mono has a // different name and it will break compatibility! ServicePointManager.CertificatePolicy = new AcceptAllCertificatePolicy(); // TODO: At some point, maybe we should check the cert? // Create the CAPS login structure LLSDMap loginLLSD = new LLSDMap(); loginLLSD["first"] = LLSD.FromString(loginParams.FirstName); loginLLSD["last"] = LLSD.FromString(loginParams.LastName); loginLLSD["passwd"] = LLSD.FromString(loginParams.Password); loginLLSD["start"] = LLSD.FromString(loginParams.Start); loginLLSD["channel"] = LLSD.FromString(loginParams.Channel); loginLLSD["version"] = LLSD.FromString(loginParams.Version); loginLLSD["platform"] = LLSD.FromString(loginParams.Platform); loginLLSD["mac"] = LLSD.FromString(loginParams.MAC); loginLLSD["agree_to_tos"] = LLSD.FromBoolean(true); loginLLSD["read_critical"] = LLSD.FromBoolean(true); loginLLSD["viewer_digest"] = LLSD.FromString(loginParams.ViewerDigest); loginLLSD["id0"] = LLSD.FromString(loginParams.id0); // Create the options LLSD array LLSDArray optionsLLSD = new LLSDArray(); for (int i = 0; i < loginParams.Options.Count; i++) { optionsLLSD.Add(LLSD.FromString(loginParams.Options[i])); } foreach (string[] callbackOpts in CallbackOptions.Values) { if (callbackOpts != null) { for (int i = 0; i < callbackOpts.Length; i++) { if (!optionsLLSD.Contains(callbackOpts[i])) { optionsLLSD.Add(callbackOpts[i]); } } } } loginLLSD["options"] = optionsLLSD; // Make the CAPS POST for login Uri loginUri; try { loginUri = new Uri(loginParams.URI); } catch (Exception ex) { Logger.Log(String.Format("Failed to parse login URI {0}, {1}", loginParams.URI, ex.Message), Helpers.LogLevel.Error, Client); return; } CapsClient loginRequest = new CapsClient(new Uri(loginParams.URI)); loginRequest.OnComplete += new CapsClient.CompleteCallback(LoginReplyHandler); loginRequest.UserData = CurrentContext; loginRequest.StartRequest(LLSDParser.SerializeXmlBytes(loginLLSD), "application/xml+llsd"); }