Esempio n. 1
0
        private CoreAction DeleteSnapshot(int id)
        {
            bool result = _coreCLR.DeleteSnapshot(id);

            if (!result)
            {
                return(null);
            }

            return(CoreAction.DeleteSnapshot(Ticks, id));
        }
Esempio n. 2
0
        static public CoreAction CoreActionFromBytes(MemoryByteStream stream)
        {
            byte type = stream.ReadByte();

            switch (type)
            {
            case _coreActionKeyPress:
            {
                UInt64 ticks   = stream.ReadUInt64();
                byte   keyCode = stream.ReadByte();
                bool   keyDown = stream.ReadBool();

                return(CoreAction.KeyPress(ticks, keyCode, keyDown));
            }

            case _coreActionReset:
            {
                UInt64 ticks = stream.ReadUInt64();

                return(CoreAction.Reset(ticks));
            }

            case _coreActionLoadDisc:
            {
                UInt64 ticks = stream.ReadUInt64();
                byte   drive = stream.ReadByte();
                byte[] media = stream.ReadArray();

                return(CoreAction.LoadDisc(ticks, drive, new MemoryBlob(media)));
            }

            case _coreActionLoadTape:
            {
                UInt64 ticks = stream.ReadUInt64();
                byte[] media = stream.ReadArray();

                return(CoreAction.LoadTape(ticks, new MemoryBlob(media)));
            }

            case _coreActionRunUntil:
            {
                UInt64 ticks     = stream.ReadUInt64();
                UInt64 stopTicks = stream.ReadUInt64();

                return(CoreAction.RunUntil(ticks, stopTicks, null));
            }

            case _coreActionLoadCore:
            {
                UInt64 ticks = stream.ReadUInt64();
                byte[] state = stream.ReadArray();

                return(CoreAction.LoadCore(ticks, new MemoryBlob(state)));
            }

            case _coreActionCoreVersion:
            {
                UInt64 ticks   = stream.ReadUInt64();
                Int32  version = stream.ReadInt32();

                return(CoreAction.CoreVersion(ticks, version));
            }

            case _coreActionCreateSnapshot:
            {
                UInt64 ticks      = stream.ReadUInt64();
                Int32  snapshotId = stream.ReadInt32();

                return(CoreAction.CreateSnapshot(ticks, snapshotId));
            }

            case _coreActionDeleteSnapshot:
            {
                UInt64 ticks      = stream.ReadUInt64();
                Int32  snapshotId = stream.ReadInt32();

                return(CoreAction.DeleteSnapshot(ticks, snapshotId));
            }

            case _coreActionRevertToSnapshot:
            {
                UInt64 ticks      = stream.ReadUInt64();
                Int32  snapshotId = stream.ReadInt32();

                return(CoreAction.RevertToSnapshot(ticks, snapshotId));
            }
            }

            throw new Exception(String.Format("Unknown CoreAction type {0}!", type));
        }