Serialize() 공개 메소드

Serialize the object
public Serialize ( ) : OSDMap
리턴 OSDMap
예제 #1
0
        /// <summary>
        /// Tells the sim what UI language is used, and if it's ok to share that with scripts
        /// </summary>
        /// <param name="language">Two letter language code</param>
        /// <param name="isPublic">Share language info with scripts</param>
        public void UpdateAgentLanguage(string language, bool isPublic)
        {
            try
            {
                UpdateAgentLanguageMessage msg = new UpdateAgentLanguageMessage();
                msg.Language = language;
                msg.LanguagePublic = isPublic;

                Uri url = Client.Network.CurrentSim.Caps.CapabilityURI("UpdateAgentLanguage");
                if (url != null)
                {
                    CapsClient request = new CapsClient(url);
                    request.BeginGetResponse(msg.Serialize(), OSDFormat.Xml, Client.Settings.CAPS_TIMEOUT);
                }
            }
            catch (Exception ex)
            {
                Logger.Log("Failes to update agent language", Helpers.LogLevel.Error, Client, ex);
            }
        }
        public void UpdateAgentLanguageMessage()
        {
            UpdateAgentLanguageMessage s = new UpdateAgentLanguageMessage();
            s.Language = "en";
            s.LanguagePublic = false;

            OSDMap map = s.Serialize();

            UpdateAgentLanguageMessage t = new UpdateAgentLanguageMessage();
            t.Deserialize(map);

            Assert.AreEqual(s.Language, t.Language);
            Assert.AreEqual(s.LanguagePublic, t.LanguagePublic);
        }