コード例 #1
0
        protected override void Parse(ref BitStreamReader bsr)
        {
            PacketInfo = new CmdInfo[DemoInfo.MaxSplitscreenPlayers];
            for (int i = 0; i < PacketInfo.Length; i++)
            {
                PacketInfo[i] = new CmdInfo(DemoRef);
                PacketInfo[i].ParseStream(ref bsr);
            }
            InSequence    = bsr.ReadUInt();
            OutSequence   = bsr.ReadUInt();
            MessageStream = new MessageStream(DemoRef);
            MessageStream.ParseStream(ref bsr);

            // After we're doing with the packet, we can process all the messages.
            // Most things should be processed during parsing, but any additional checks should be done here.

            var netTickMessages = MessageStream.Where(tuple => tuple.messageType == MessageType.NetTick).ToList();

            if (netTickMessages.Count > 1)
            {
                DemoRef.LogError("there's more than 2 net tick messages in this packet");
            }
            NetTick?tickInfo = (NetTick?)netTickMessages.FirstOrDefault().message;

            if (tickInfo != null)
            {
                if (DemoRef.EntitySnapshot != null)
                {
                    DemoRef.EntitySnapshot.EngineTick = tickInfo.EngineTick;
                }
            }
            // todo fill prop handles with data here
            TimingAdjustment.AdjustFromPacket(this);
        }
コード例 #2
0
        public BlackIborCouponPricer(Handle <OptionletVolatilityStructure> v = null,
                                     TimingAdjustment timingAdjustment       = TimingAdjustment.Black76,
                                     Handle <Quote> correlation = null)
            : base(v)
        {
            timingAdjustment_ = timingAdjustment;
            correlation_      = correlation ?? new Handle <Quote>(new SimpleQuote(1.0));

            Utils.QL_REQUIRE(timingAdjustment_ == TimingAdjustment.Black76 ||
                             timingAdjustment_ == TimingAdjustment.BivariateLognormal, () =>
                             "unknown timing adjustment (code " + timingAdjustment_ + ")");
            correlation_.registerWith(update);
        }
コード例 #3
0
        protected override void Parse(ref BitStreamReader bsr)
        {
            Command = bsr.ReadStringOfLength(bsr.ReadSInt());
            TimingAdjustment.AdjustFromConsoleCmd(this);
            Match match = KeyPressRegex.Match(Command);

            if (match.Success)
            {
                int val = int.Parse(match.Groups[1].Value);
                if (val >= 0 && val < (int)Packets.ButtonCode.LAST)
                {
                    ButtonCode = (ButtonCode)val;
                }
            }
        }