Exemplo n.º 1
0
        internal VM.RuntimeState LoadStateFromPrim(UUID currId, UUID oldId, SceneObjectPart sop)
        {
            string oldIdState = null;
            string newIdState = null;

            byte[] binaryState = null;

            //Old way, the script states are stored in the group
            if (sop.ParentGroup.m_savedScriptState != null &&
                (sop.ParentGroup.m_savedScriptState.TryGetValue(oldId, out oldIdState) ||
                 sop.ParentGroup.m_savedScriptState.TryGetValue(currId, out newIdState)))
            {
                string state = oldIdState != null ? oldIdState : newIdState;

                sop.ParentGroup.m_savedScriptState.Remove(oldIdState != null ? oldId : currId);
                byte[] rawState = Convert.FromBase64String(state);

                return(DeserializeScriptState(currId, rawState));
            }
            else if (sop.HasSavedScriptStates &&
                     (sop.TryExtractSavedScriptState(oldId, out binaryState) ||
                      sop.TryExtractSavedScriptState(currId, out binaryState)))
            {
                return(DeserializeScriptState(sop.UUID, binaryState));
            }

            return(null);
        }