/// <summary>
        /// Creates a new SerializedScript from a CompiledScript
        /// </summary>
        /// <param name="script"></param>
        /// <returns></returns>
        public static SerializedScript FromCompiledScript(VM.CompiledScript script)
        {
            SerializedScript serScript = new SerializedScript();
            serScript.Version = script.Version;
            serScript.ByteCode = script.ByteCode;

            serScript.ConstPool = SerializedLSLPrimitive.FromPrimitiveList(script.ConstPool);

            serScript.StateEvents = new Dictionary<int, VM.EventInfo[]>();
            for (int i = 0; i < script.StateEvents.Length; i++)
            {
                serScript.StateEvents.Add(i, script.StateEvents[i]);
            }

            serScript.NumGlobals = script.NumGlobals;
            serScript.AssetId = script.AssetId;

            return serScript;
        }
Esempio n. 2
0
        /// <summary>
        /// Creates a new SerializedScript from a CompiledScript
        /// </summary>
        /// <param name="script"></param>
        /// <returns></returns>
        public static SerializedScript FromCompiledScript(VM.CompiledScript script)
        {
            SerializedScript serScript = new SerializedScript();

            serScript.Version  = script.Version;
            serScript.ByteCode = script.ByteCode;

            serScript.ConstPool = SerializedLSLPrimitive.FromPrimitiveList(script.ConstPool);

            serScript.StateEvents = new Dictionary <int, VM.EventInfo[]>();
            for (int i = 0; i < script.StateEvents.Length; i++)
            {
                serScript.StateEvents.Add(i, script.StateEvents[i]);
            }

            serScript.NumGlobals = script.NumGlobals;
            serScript.AssetId    = script.AssetId;

            return(serScript);
        }