当前位置: 首页>>代码示例>>C#>>正文


C# SceneObjectGroup.SaveScriptedState方法代码示例

本文整理汇总了C#中OpenSim.Region.Framework.Scenes.SceneObjectGroup.SaveScriptedState方法的典型用法代码示例。如果您正苦于以下问题:C# SceneObjectGroup.SaveScriptedState方法的具体用法?C# SceneObjectGroup.SaveScriptedState怎么用?C# SceneObjectGroup.SaveScriptedState使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在OpenSim.Region.Framework.Scenes.SceneObjectGroup的用法示例。


在下文中一共展示了SceneObjectGroup.SaveScriptedState方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: PrepareScriptInstanceForSave

        /// <summary>
        /// Prepares the script instance for save.
        /// </summary>
        /// <remarks>
        /// This involves triggering the detach event and getting the script state (which also stops the script)
        /// This MUST be done outside sp.AttachmentsSyncLock, since otherwise there is a chance of deadlock if a 
        /// running script is performing attachment operations.
        /// </remarks>
        /// <returns>
        /// The script state ready for persistence.
        /// </returns>
        /// <param name='grp'>
        /// </param>
        /// <param name='fireDetachEvent'>
        /// If true, then fire the script event before we save its state.
        /// </param>
        private string PrepareScriptInstanceForSave(SceneObjectGroup grp, bool fireDetachEvent)
        {
            if (fireDetachEvent)
                m_scene.EventManager.TriggerOnAttach(grp.LocalId, grp.FromItemID, UUID.Zero);

            using (StringWriter sw = new StringWriter())
            {
                using (XmlTextWriter writer = new XmlTextWriter(sw))
                {
                    grp.SaveScriptedState(writer);
                }

                return sw.ToString();
            }
        }
开发者ID:BogusCurry,项目名称:arribasim-dev,代码行数:31,代码来源:AttachmentsModule.cs

示例2: ToOriginalXmlFormat

        /// <summary>
        /// Serialize a scene object to the original xml format
        /// </summary>
        /// <param name="sceneObject"></param>
        /// <param name="writer"></param>
        /// <param name="noRootElement">If false, don't write the enclosing SceneObjectGroup element</param>
        /// <returns></returns>
        public static void ToOriginalXmlFormat(
            SceneObjectGroup sceneObject, XmlTextWriter writer, bool doScriptStates, bool noRootElement)
        {
//            m_log.DebugFormat("[SERIALIZER]: Starting serialization of {0}", sceneObject.Name);
//            int time = System.Environment.TickCount;

            if (!noRootElement)
                writer.WriteStartElement(String.Empty, "SceneObjectGroup", String.Empty);
            
            writer.WriteStartElement(String.Empty, "RootPart", String.Empty);
            ToXmlFormat(sceneObject.RootPart, writer);
            writer.WriteEndElement();
            writer.WriteStartElement(String.Empty, "OtherParts", String.Empty);

            SceneObjectPart[] parts = sceneObject.Parts;
            for (int i = 0; i < parts.Length; i++)
            {
                SceneObjectPart part = parts[i];
                if (part.UUID != sceneObject.RootPart.UUID)
                {
                    writer.WriteStartElement(String.Empty, "Part", String.Empty);
                    ToXmlFormat(part, writer);
                    writer.WriteEndElement();
                }
            }

            writer.WriteEndElement(); // OtherParts

            if (doScriptStates)
                sceneObject.SaveScriptedState(writer);
            
            if (!noRootElement)
                writer.WriteEndElement(); // SceneObjectGroup

//            m_log.DebugFormat("[SERIALIZER]: Finished serialization of SOG {0}, {1}ms", sceneObject.Name, System.Environment.TickCount - time);
        }        
开发者ID:JAllard,项目名称:opensim,代码行数:43,代码来源:SceneObjectSerializer.cs

示例3: GetObjectScriptStates

        private string GetObjectScriptStates(SceneObjectGroup grp)
        {
            using (StringWriter sw = new StringWriter())
            {
                using (XmlTextWriter writer = new XmlTextWriter(sw))
                {
                    grp.SaveScriptedState(writer);
                }

                return sw.ToString();
            }
        }
开发者ID:p07r0457,项目名称:opensim,代码行数:12,代码来源:AttachmentsModule.cs

示例4: PrepareScriptInstanceForSave

        /// <summary>
        /// Prepares the script instance for save.
        /// </summary>
        /// <remarks>
        /// This involves triggering the detach event and getting the script state (which also stops the script)
        /// This MUST be done outside sp.AttachmentsSyncLock, since otherwise there is a chance of deadlock if a 
        /// running script is performing attachment operations.
        /// </remarks>
        /// <returns>
        /// The script state ready for persistence.
        /// </returns>
        /// <param name='grp'>
        /// </param>
        /// <param name='fireDetachEvent'>
        /// If true, then fire the script event before we save its state.
        /// </param>
        private string PrepareScriptInstanceForSave(SceneObjectGroup grp, bool fireDetachEvent)
        {
            if (fireDetachEvent)
            {
                m_scene.EventManager.TriggerOnAttach(grp.LocalId, grp.FromItemID, UUID.Zero);

                // Allow detach event time to do some work before stopping the script
                Thread.Sleep(2);
            }

            using (StringWriter sw = new StringWriter())
            {
                using (XmlTextWriter writer = new XmlTextWriter(sw))
                {
                    grp.SaveScriptedState(writer);
                }

                return sw.ToString();
            }
        }
开发者ID:emperorstarfinder,项目名称:Opensim2,代码行数:36,代码来源:AttachmentsModule.cs

示例5: ToXml2Format

        /// <summary>
        /// Serialize a scene object to the 'xml2' format.
        /// </summary>
        /// <param name="sceneObject"></param>
        /// <returns></returns>
        public static void ToXml2Format(SceneObjectGroup sceneObject, XmlTextWriter writer)
        {
            //m_log.DebugFormat("[SERIALIZER]: Starting serialization of SOG {0} to XML2", Name);
            //int time = System.Environment.TickCount;

            writer.WriteStartElement(String.Empty, "SceneObjectGroup", String.Empty);
            sceneObject.RootPart.ToXml(writer);
            writer.WriteStartElement(String.Empty, "OtherParts", String.Empty);

            lock (sceneObject.Children)
            {
                foreach (SceneObjectPart part in sceneObject.Children.Values)
                {
                    if (part.UUID != sceneObject.RootPart.UUID)
                    {
                        part.ToXml(writer);
                    }
                }
            }

            writer.WriteEndElement(); // End of OtherParts
            sceneObject.SaveScriptedState(writer);
            writer.WriteEndElement(); // End of SceneObjectGroup

            //m_log.DebugFormat("[SERIALIZER]: Finished serialization of SOG {0} to XML2, {1}ms", Name, System.Environment.TickCount - time);
        }
开发者ID:AlphaStaxLLC,项目名称:taiga,代码行数:31,代码来源:SceneObjectSerializer.cs

示例6: ToOriginalXmlFormat

        /// <summary>
        /// Serialize a scene object to the original xml format
        /// </summary>
        /// <param name="sceneObject"></param>
        /// <returns></returns>            
        public static void ToOriginalXmlFormat(SceneObjectGroup sceneObject, XmlTextWriter writer, StopScriptReason stopScriptReason)
        {
            //m_log.DebugFormat("[SERIALIZER]: Starting serialization of {0}", Name);
            //int time = System.Environment.TickCount;

            writer.WriteStartElement(String.Empty, "SceneObjectGroup", String.Empty);
            writer.WriteStartElement(String.Empty, "RootPart", String.Empty);
            sceneObject.RootPart.ToXml(writer);
            writer.WriteEndElement();
            writer.WriteStartElement(String.Empty, "OtherParts", String.Empty);

            foreach (SceneObjectPart part in sceneObject.GetParts())
            {
                if (part.UUID != sceneObject.RootPart.UUID)
                {
                    writer.WriteStartElement(String.Empty, "Part", String.Empty);
                    part.ToXml(writer);
                    writer.WriteEndElement();
                }
            }

            writer.WriteEndElement(); // OtherParts
            sceneObject.SaveScriptedState(writer, stopScriptReason);
            writer.WriteEndElement(); // SceneObjectGroup

            //m_log.DebugFormat("[SERIALIZER]: Finished serialization of SOG {0}, {1}ms", Name, System.Environment.TickCount - time);
        }
开发者ID:kf6kjg,项目名称:halcyon,代码行数:32,代码来源:SceneObjectSerializer.cs


注:本文中的OpenSim.Region.Framework.Scenes.SceneObjectGroup.SaveScriptedState方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。