예제 #1
0
        public static SerializedLSLPrimitive[] FromPrimitiveStack(Stack <object> primStack)
        {
            SerializedLSLPrimitive[] serPrimList = new SerializedLSLPrimitive[primStack.Count];

            int i = 0;

            foreach (object obj in primStack)
            {
                serPrimList[i] = SerializedLSLPrimitive.FromPrimitive(obj);

                /*if (validate)
                 * {
                 *  if (!serPrimList[i].IsValid())
                 *  {
                 *      throw new SerializationException(
                 *          String.Format(
                 *              "FromPrimitiveStack: Unable to serialize object to SerializedLSLPrimitive: Type: {0} Value: {1}",
                 *              obj != null ? obj.GetType().FullName : "null", obj));
                 *
                 *  }
                 * }*/

                i++;
            }

            return(serPrimList);
        }
예제 #2
0
        public static SerializedStackFrame FromStackFrame(VM.StackFrame frame)
        {
            if (frame == null)
            {
                return(null);
            }

            SerializedStackFrame serFrame = new SerializedStackFrame();

            serFrame.FunctionInfo = frame.FunctionInfo;

            serFrame.ReturnAddress = frame.ReturnAddress;

            serFrame.Locals = new SerializedLSLPrimitive[frame.Locals.Length];
            for (int i = 0; i < serFrame.Locals.Length; i++)
            {
                serFrame.Locals[i] = SerializedLSLPrimitive.FromPrimitive(frame.Locals[i]);
            }

            return(serFrame);
        }
예제 #3
0
        public static SerializedLSLPrimitive[] FromPrimitiveList(object[] primList)
        {
            SerializedLSLPrimitive[] serPrimList = new SerializedLSLPrimitive[primList.Length];

            for (int i = 0; i < primList.Length; i++)
            {
                object obj = primList[i];
                serPrimList[i] = SerializedLSLPrimitive.FromPrimitive(obj);

                /*if (validate)
                 * {
                 *  if (!serPrimList[i].IsValid())
                 *  {
                 *      throw new SerializationException(
                 *          String.Format(
                 *              "FromPrimitiveList: Unable to serialize object to SerializedLSLPrimitive: Type: {0} Value: {1}",
                 *              obj != null ? obj.GetType().FullName : "null", obj));
                 *
                 *  }
                 * }*/
            }

            return(serPrimList);
        }