Наследование: FSO.SimAntics.Model.TSOPlatform.VMAsyncState
Пример #1
0
        public void Deserialize(BinaryReader reader)
        {
            var stackN = reader.ReadInt32();
            Stack = new VMStackFrameMarshal[stackN];
            for (int i = 0; i < stackN; i++) {
                var type = reader.ReadByte();
                Stack[i] = (type==1)?new VMRoutingFrameMarshal(Version):new VMStackFrameMarshal(Version);
                Stack[i].Deserialize(reader);
            }

            var queueN = reader.ReadInt32();
            Queue = new VMQueuedActionMarshal[queueN];
            for (int i = 0; i < queueN; i++)
            {
                Queue[i] = new VMQueuedActionMarshal();
                Queue[i].Deserialize(reader);
            }
            if (Version > 4) ActiveQueueBlock = reader.ReadByte();

            TempRegisters = new short[20];
            for (int i = 0; i < 20; i++) TempRegisters[i] = reader.ReadInt16();
            TempXL = new int[2];
            for (int i = 0; i < 2; i++) TempXL[i] = reader.ReadInt32();
            LastStackExitCode = (VMPrimitiveExitCode)reader.ReadByte();

            if (reader.ReadBoolean()) BlockingState = VMAsyncState.DeserializeGeneric(reader, Version);
            if (Version > 2 && reader.ReadBoolean())
            {
                EODConnection = new VMEODPluginThreadState();
                EODConnection.Version = Version;
                EODConnection.Deserialize(reader);
            }
            else BlockingState = null;
            Interrupt = reader.ReadBoolean();

            ActionUID = reader.ReadUInt16();
            DialogCooldown = reader.ReadInt32();
        }
Пример #2
0
        public virtual void Load(VMThreadMarshal input, VMContext context)
        {
            Stack = new List<VMStackFrame>();
            foreach (var item in input.Stack)
            {
                Stack.Add((item is VMRoutingFrameMarshal)? new VMRoutingFrame(item, context, this) : new VMStackFrame(item, context, this));
            }
            Queue = new List<VMQueuedAction>();
            QueueDirty = true;
            foreach (var item in input.Queue) Queue.Add(new VMQueuedAction(item, context));
            ActiveQueueBlock = input.ActiveQueueBlock;
            TempRegisters = input.TempRegisters;
            TempXL = input.TempXL;
            LastStackExitCode = input.LastStackExitCode;

            BlockingState = input.BlockingState;
            EODConnection = input.EODConnection;
            Interrupt = input.Interrupt;
            ActionUID = input.ActionUID;
            DialogCooldown = input.DialogCooldown;
        }