Exemplo n.º 1
0
        private void CheckTime(BufferArgs args)
        {
            DateTime now  = DateTime.Now;
            string   dt   = args.items[1];
            DateTime dtIq = new DateTime(
                Convert.ToInt32(dt.Substring(0, 4)),
                Convert.ToInt32(dt.Substring(4, 2)),
                Convert.ToInt32(dt.Substring(6, 2)),
                Convert.ToInt32(dt.Substring(9, 2)),
                Convert.ToInt32(dt.Substring(12, 2)),
                0);
            TimeSpan ts = now - dtIq;

            if (TimeSpan.Zero == tsIQFeedDif)
            {
                tsIQFeedDif = ts;
                Console.WriteLine("Computer {0} IQFeed {1} Difference {2}", now, dtIq, ts);
            }
            else
            {
                if (ts > (tsIQFeedDif + TimeSpan.FromSeconds(5)) ||
                    ts < (tsIQFeedDif - TimeSpan.FromSeconds(5))
                    )
                {
                    //Console.WriteLine("Computer {0} IQFeed {1} Difference {2}", now, dtIq, ts);
                }
            }
        }
Exemplo n.º 2
0
    private BufferStateBase BufferAddBase(object buffer, BufferArgs bufferArgs)
    {
        // 实例化一个Buffer
        BufferStateBase newBuffer = BufferCreate(buffer, bufferArgs);

        // 判断该buffer是否应该添加到容器中
        if (newBuffer.CurrArgs.m_Addition == true)
        {
            // 添加到容器中
            newBuffer.OnEnter();
            m_bufferList.Add(newBuffer);
        }
        else
        {
            // 判断该状态在容器中是否存在
            if (BufferCheckExistsBase(buffer))                // 存在, 更新作用时间
            {
                BufferStateBase oldBuffer = m_bufferList.Find(delegate(BufferStateBase obj) {
                    return(obj.CurrBufferState.Equals(buffer));
                });
                if (oldBuffer != null)
                {
                    oldBuffer.OnRenovate(newBuffer.CurrArgs);
                }
            }
            else                 // 不存在, 直接添加进去
                                 // 添加到容器中
            {
                newBuffer.OnEnter();
                m_bufferList.Add(newBuffer);
            }
        }
        return(newBuffer);
    }
Exemplo n.º 3
0
 public override bool OnRenovate(BufferArgs newArgs)
 {
     CurrArgs.m_ContinuousTime = newArgs.m_ContinuousTime;
     CurrArgs.m_fValue1        = newArgs.m_fValue1;
     hs.HuDun  = (int)newArgs.m_fValue1;
     lastHuDun = hs.HuDun;
     return(true);
 }
    /// <summary>
    /// 冰冻Buffer,没有霸体的怪物会停止移动攻击等行为
    /// </summary>
    /// <param name="value">冰冻时间.</param>
    /// <param name="bufferUI">UI样式,为0时不显示.</param>
    /// <param name="addMore">If set to <c>true</c> 是否可以叠加.</param>
    /// <param name="permanent">If set to <c>true</c> 是否永久添加.</param>
    public void DeBufferFreeze(float continueTime, int bufferUI, bool addMore, bool permanent)
    {
        BufferArgs args = new BufferArgs();

        args.m_iBufferUI      = bufferUI;
        args.m_Addition       = addMore;
        args.m_ContinuousTime = continueTime;
        args.m_Permanent      = permanent;
        m_BufferMgr.BufferAdd(BufferType.DeBuffer.DeBufferFreeze, args);
    }
    /// <summary>
    /// 增加防御力
    /// </summary>
    /// <param name="difensiveAdd">增加的防御力数值.</param>
    /// <param name="continueTime">持续时间.</param>
    /// <param name="bufferUI">UI样式,为0时不显示.</param>
    /// <param name="addMore">If set to <c>true</c> 是否能重复添加.</param>
    /// <param name="permanent">If set to <c>true</c> 是否永久添加.</param>
    public BufferStateBase BufferAddDefensive(float difensiveAdd, float continueTime, int bufferUI, bool addMore, bool permanent, bool total, int grade, bool playAttackEffect)
    {
        BufferArgs args = new BufferArgs();

        args.m_iBufferUI      = bufferUI;
        args.m_fValue1        = difensiveAdd;
        args.m_Addition       = addMore;
        args.m_ContinuousTime = continueTime;
        args.m_Permanent      = permanent;
        return(m_BufferMgr.BufferAdd(BufferType.Buffer.BufferAddDefensive, args));
    }
    /// <summary>
    /// 一次性加血Buffer
    /// </summary>
    /// <param name="value">加血比例.</param>
    /// <param name="continueTime">持续时间.</param>
    /// <param name="bufferUI">UI样式,为0时不显示.</param>
    /// <param name="addMore">If set to <c>true</c> 是否可以叠加.</param>
    public void BufferAddBlood(float value, int bufferUI, bool usePercent)
    {
        BufferArgs args = new BufferArgs();

        args.m_bUsePercent    = usePercent;
        args.m_iBufferUI      = bufferUI;
        args.m_fValue1        = value;
        args.m_Addition       = false;
        args.m_ContinuousTime = 0f;
        m_BufferMgr.BufferAdd(BufferType.Buffer.BufferAddBlood, args);
    }
    /// <summary>
    /// 怪物破甲Buffer,一段时间直接减少怪物护甲
    /// </summary>
    /// <param name="value">减少护甲值.</param>
    /// <param name="continueTime">持续时间.</param>
    /// <param name="bufferUI">显示的UI.</param>
    /// <param name="addMore">If set to <c>true</c> 能否重复增加.</param>
    /// <param name="permanent">If set to <c>true</c> 是否永久.</param>
    public void DeBufferSunderArmor(float value, float continueTime, int bufferUI, bool addMore, bool permanent)
    {
        BufferArgs args = new BufferArgs();

        args.m_fValue1        = value;
        args.m_ContinuousTime = continueTime;
        args.m_iBufferUI      = bufferUI;
        args.m_Addition       = addMore;
        args.m_Permanent      = permanent;
        m_BufferMgr.BufferAdd(BufferType.DeBuffer.DeBufferSunderArmor, args);
    }
    /// <summary>
    /// 加速Buffer
    /// </summary>
    /// <param name="value">加速比例(为1时加速一倍).</param>
    /// <param name="continueTime">持续时间.</param>
    /// <param name="bufferUI">UI样式,为0时不显示.</param>
    /// <param name="addMore">If set to <c>true</c> 是否可以叠加.</param>
    /// <param name="permanent">If set to <c>true</c> 是否永久添加.</param>
    public BufferStateBase BufferSpeedUp(float value, float continueTime, int bufferUI, bool addMore, bool permanent)
    {
        BufferArgs args = new BufferArgs();

        args.m_iBufferUI      = bufferUI;
        args.m_fValue1        = value;
        args.m_Addition       = addMore;
        args.m_ContinuousTime = continueTime;
        args.m_Permanent      = permanent;
        return(m_BufferMgr.BufferAdd(BufferType.Buffer.BufferSpeedUp, args));
    }
    /// <summary>
    /// 增加防御力
    /// </summary>
    /// <param name="difensiveAdd">增加的防御力数值.</param>
    /// <param name="continueTime">持续时间.</param>
    /// <param name="bufferUI">UI样式,为0时不显示.</param>
    /// <param name="addMore">If set to <c>true</c> 是否能重复添加.</param>
    /// <param name="permanent">If set to <c>true</c> 是否永久添加.</param>
    public void BufferAddDefensive(float difensiveAdd, float continueTime, int bufferUI, bool addMore, bool permanent)
    {
        BufferArgs args = new BufferArgs();

        args.m_iBufferUI      = bufferUI;
        args.m_fValue1        = difensiveAdd;
        args.m_Addition       = addMore;
        args.m_ContinuousTime = continueTime;
        args.m_Permanent      = permanent;
        m_BufferMgr.BufferAdd(BufferType.Buffer.BufferAddDefensive, args);
    }
    /// <summary>
    /// 增加攻速Buffer
    /// </summary>
    /// <param name="attackSpeedAdd">攻速加成百分比.</param>
    /// <param name="continueTime">持续时间.</param>
    /// <param name="bufferUI">UI样式,为0时不显示.</param>
    /// <param name="addMore">If set to <c>true</c> 是否能重复添加.</param>
    /// <param name="permanent">If set to <c>true</c> 是否永久.</param>
    public void BufferAddAttackSpeed(float attackSpeedAdd, float continueTime, int bufferUI, bool addMore, bool permanent)
    {
        BufferArgs args = new BufferArgs();

        args.m_iBufferUI      = bufferUI;
        args.m_fValue1        = attackSpeedAdd;
        args.m_Addition       = addMore;
        args.m_ContinuousTime = continueTime;
        args.m_Permanent      = permanent;
        m_BufferMgr.BufferAdd(BufferType.Buffer.BufferAddAttackSpeed, args);
    }
    /// <summary>
    /// 流血Buffer,每个一段时间血量减少一定值
    /// </summary>
    /// <param name="value">血量减少的值.</param>
    /// <param name="interval">减血间隔.</param>
    /// <param name="continueTime">持续时间.</param>
    /// <param name="bufferUI">UI样式,为0时不显示.</param>
    /// <param name="addMore">If set to <c>true</c> 是否可以叠加.</param>
    /// <param name="permanent">If set to <c>true</c> 是否永久添加.</param>
    public void PerDeBufferBleed(int value, float interval, float continueTime, int bufferUI, bool addMore, bool permanent)
    {
        BufferArgs args = new BufferArgs();

        args.m_iBufferUI      = bufferUI;
        args.m_iValue1        = value;
        args.m_fValue1        = interval;
        args.m_Addition       = addMore;
        args.m_ContinuousTime = continueTime;
        args.m_Permanent      = permanent;
        m_BufferMgr.BufferAdd(BufferType.PerDeBuffer.PerDeBufferBleed, args);
    }
    /// <summary>
    /// 一段时间增加攻击力Buffer
    /// </summary>
    /// <param name="value">增加攻击力的数值.</param>
    /// <param name="continueTime">持续时间.</param>
    /// <param name="bufferUI">UI样式,为0时不显示.</param>
    /// <param name="addMore">If set to <c>true</c> 是否可以叠加.</param>
    /// <param name="usePercent">If set to <c>true</c> 是否使用百分比添加.</param>
    /// <param name="permanent">If set to <c>true</c> 能够永久添加.</param>
    public void BufferAddDamage(float value, float continueTime, int bufferUI, bool addMore, bool usePercent, bool permanent)
    {
        BufferArgs args = new BufferArgs();

        args.m_iBufferUI      = bufferUI;
        args.m_fValue1        = value;
        args.m_Addition       = addMore;
        args.m_ContinuousTime = continueTime;
        args.m_bUsePercent    = permanent;
        args.m_Permanent      = permanent;
        m_BufferMgr.BufferAdd(BufferType.Buffer.BufferAddDamage, args);
    }
    /// 狂暴Buffer,一段时间增加攻击力和移动速度
    /// </summary>
    /// <param name="speedAdd">速度增加百分比,单位为1</param>
    /// <param name="attackAdd">攻击力增加值.</param>
    /// <param name="continueTime">持续时间.</param>
    /// <param name="bufferUI">UI样式,为0时不显示.</param>
    /// <param name="addMore">If set to <c>true</c> 是否能重复添加.</param>
    /// <param name="permanent">If set to <c>true</c> 是否永久添加.</param>
    public BufferStateBase BufferRage(float speedAdd, float attackAdd, float continueTime, int bufferUI, bool addMore, bool permanent)
    {
        BufferArgs args = new BufferArgs();

        args.m_iBufferUI      = bufferUI;
        args.m_fValue1        = speedAdd;
        args.m_fValue2        = attackAdd;
        args.m_Addition       = addMore;
        args.m_ContinuousTime = continueTime;
        args.m_Permanent      = permanent;
        return(m_BufferMgr.BufferAdd(BufferType.Buffer.BufferRage, args));
    }
    /// <summary>
    /// 重生Buffer
    /// </summary>
    /// <param name="value">重生概率.</param>
    /// <param name="reliveHP">重生时血量回复百分比.</param>
    /// <param name="continueTime">持续时间.</param>
    /// <param name="bufferUI">UI显示.</param>
    /// <param name="addMore">If set to <c>true</c> 是否可以叠加.</param>
    /// <param name="permanent">If set to <c>true</c> 是否永久添加.</param>
    /// <summary>
    public BufferStateBase BufferRelive(float probability, float reliveHP, float continueTime, int bufferUI, bool addMore, bool permanent)
    {
        BufferArgs args = new BufferArgs();

        args.m_iBufferUI      = bufferUI;
        args.m_fValue1        = probability;
        args.m_fValue2        = reliveHP;
        args.m_Addition       = addMore;
        args.m_ContinuousTime = continueTime;
        args.m_Permanent      = permanent;
        return(m_BufferMgr.BufferAdd(BufferType.Buffer.BufferRelive, args));
    }
    /// <summary>
    /// 怪物周期性加血Buffer
    /// </summary>
    /// <param name="value">加血数值.</param>
    /// <param name="refreshTime">加血刷新时间.</param>
    /// <param name="continueTime">持续时间.</param>
    /// <param name="bufferUI">UI显示.</param>
    /// <param name="usePercent">If set to <c>true</c>是否使用百分比.</param>
    /// <param name="addMore">If set to <c>true</c> 能否重复添加.</param>
    /// <param name="permanent">If set to <c>true</c> 是否永久添加.</param>
    public BufferStateBase PerBufferAddBlood(float value, float refreshTime, float continueTime, int bufferUI, bool usePercent, bool addMore, bool permanent)
    {
        BufferArgs args = new BufferArgs();

        args.m_bUsePercent    = usePercent;
        args.m_iBufferUI      = bufferUI;
        args.m_fValue1        = value;
        args.m_fValue2        = refreshTime;
        args.m_Addition       = addMore;
        args.m_ContinuousTime = continueTime;
        args.m_Permanent      = permanent;
        return(m_BufferMgr.BufferAdd(BufferType.PerBuffer.PerBufferAddBlood, args));
    }
    /// <summary>
    /// 无敌
    /// </summary>
    /// <param name="continueTime">持续时间.</param>
    /// <param name="bufferUI">UI样式,为0时不显示.</param>
    /// <param name="addMore">If set to <c>true</c> 是否能重复添加.</param>
    /// <param name="permanent">If set to <c>true</c> 是否永久添加.</param>
    public BufferStateBase BufferInvincible(float continueTime, int bufferUI, bool addMore, bool permanent, bool total, int grade, bool playAttackEffect)
    {
        BufferArgs args = new BufferArgs();

        args.m_iBufferUI      = bufferUI;
        args.m_Addition       = addMore;
        args.m_ContinuousTime = continueTime;
        args.m_Permanent      = permanent;
        args.m_bValue1        = total;
        args.m_iValue1        = grade;
        args.m_bValue2        = playAttackEffect;
        return(m_BufferMgr.BufferAdd(BufferType.Buffer.BufferInvincible, args));
    }
Exemplo n.º 17
0
 public void RenovateBuff(BufferStateBase buffer, BufferArgs args)
 {
     foreach (var item in m_bufferList)
     {
         if (item == buffer)
         {
             temp = item;
         }
     }
     if (temp != null)
     {
         temp.OnRenovate(args);
     }
 }
    /// <summary>
    /// 眩晕Buffer,没有霸体的怪物会停止移动攻击等行为
    /// </summary>
    /// <param name="value">眩晕时间.</param>
    /// <param name="bufferUI">UI样式,为0时不显示.</param>
    /// <param name="addMore">If set to <c>true</c> 是否可以叠加.</param>
    /// <param name="permanent">If set to <c>true</c> 是否永久添加.</param>
    public void DeBufferDizzness(float continueTime, int bufferUI, bool addMore, bool permanent)
    {
        if (transform.parent.parent.GetComponent <MonsterActionCtl> ().GetState() >= MonsterState.UnderThumpAttack)
        {
            return;
        }
        BufferArgs args = new BufferArgs();

        args.m_iBufferUI      = bufferUI;
        args.m_Addition       = addMore;
        args.m_ContinuousTime = continueTime;
        args.m_Permanent      = permanent;
        m_BufferMgr.BufferAdd(BufferType.DeBuffer.DeBufferDizzness, args);
    }
    /// <summary>
    /// 冰冻Buffer,没有霸体的怪物会停止移动攻击等行为
    /// </summary>
    /// <param name="value">冰冻时间.</param>
    /// <param name="bufferUI">UI样式,为0时不显示.</param>
    /// <param name="addMore">If set to <c>true</c> 是否可以叠加.</param>
    /// <param name="permanent">If set to <c>true</c> 是否永久添加.</param>
    public BufferStateBase DeBufferFreeze(float continueTime, int bufferUI, bool addMore, bool permanent)
    {
        if (monsterMessage.beiji.GetInvincibleInfo().IsInvincible)
        {
            return(null);
        }
        GameControl.gameControl.audioManager.PlayEffectSound(AUDIOCATALOG.guaiwu, AUDIO_NAME.monster_freeze);
        BufferArgs args = new BufferArgs();

        args.m_iBufferUI      = bufferUI;
        args.m_Addition       = addMore;
        args.m_ContinuousTime = continueTime;
        args.m_Permanent      = permanent;
        return(m_BufferMgr.BufferAdd(BufferType.DeBuffer.DeBufferFreeze, args));
    }
    /// <summary>
    /// 怪物的易伤buff,一段时间内收到的伤害成比例上升
    /// </summary>
    /// <param name="value">伤害的翻倍数</param>
    /// <param name="continueTime">持续时间</param>
    /// <param name="bufferUI">显示的UI</param>
    /// <param name="addMore">是否能重复增加</param>
    /// <param name="permanent">是否永久</param>
    public BufferStateBase DeBuffAptToAtttack(float value, float continueTime, int bufferUI, bool addMore, bool permanent)
    {
        if (monsterMessage.beiji.GetInvincibleInfo().IsInvincible)
        {
            return(null);
        }
        BufferArgs args = new BufferArgs();

        args.m_fValue1        = value;
        args.m_ContinuousTime = continueTime;
        args.m_iBufferUI      = bufferUI;
        args.m_Addition       = addMore;
        args.m_Permanent      = permanent;
        return(m_BufferMgr.BufferAdd(BufferType.DeBuffer.DeBuffAptToAtttack, args));
    }
 public override bool OnRenovate(BufferArgs args)
 {
     CurrCtrl.GetComponentInChildren <HealthState>().AddDefenseEvent((int)CurrArgs.m_fValue1, 0, 0);
     CurrArgs.m_ContinuousTime = args.m_ContinuousTime;
     CurrArgs.m_fValue1        = args.m_fValue1;
     CurrCtrl.GetComponentInChildren <HealthState>().AddDefenseEvent((int)-CurrArgs.m_fValue1, 0, 0);
     if (CurrArgs.m_iBufferUI == 1)
     {
         GameObject temp1 = GameObject.Instantiate(sunderArmorBuff, CurrCtrl.GetComponent <MonsterMessage>().monsterBody.transform.position, Quaternion.identity) as GameObject;
         temp1.transform.localScale = new Vector3(m_BufferCrl.buffScale, m_BufferCrl.buffScale, 1f);
         temp1.transform.position   = new Vector3(temp1.transform.position.x + m_BufferCrl.xDis, temp1.transform.position.y + m_BufferCrl.yDis, temp1.transform.position.z);
         temp1.transform.SetParent(CurrCtrl.GetComponent <MonsterMessage>().monsterBody.transform);
     }
     return(true);
 }
Exemplo n.º 22
0
    // 1.添加一个新的Buffer(包括刷新或者重新添加)
    private BufferStateBase BufferCreate(object buffer, BufferArgs bufferArgs)
    {
        BufferStateBase newBuffer =
            Activator.CreateInstance(
                Type.GetType(buffer.ToString())
                )
            as BufferStateBase;

        newBuffer.CurrArgs        = bufferArgs;
        newBuffer.CurrCtrl        = CurrCtrl;
        newBuffer.CurrBufferType  = buffer.GetType();
        newBuffer.CurrBufferState = buffer;

        return(newBuffer);
    }
Exemplo n.º 23
0
 private void Handle9100Line(object o, BufferArgs args)
 {
     //HistoryState hs = (HistoryState)e.user;
     //GetHistory gh = hs.gh;
     //Console.WriteLine("hl {0}", e.Line);
     if (null == gh)
     {
         throw new ApplicationException("gh is null");
     }
     //lock (typeof(GetHistory)) {
     //Monitor.Enter(typeof(GetHistory));  // ensure only a single entrance
     //Monitor.Enter(cs);
     gh.doLine(args, this);
     //Monitor.Exit(typeof(GetHistory));   // ensure only a single exit
     //Monitor.Exit(cs);
     //}
 }
Exemplo n.º 24
0
        private void OnChain(object o, BufferArgs args)
        {
            //Console.WriteLine(args.Line);
            int    colon  = args.Line.IndexOf(":");
            string sCalls = args.Line.Substring(0, colon);
            string sPuts  = args.Line.Substring(colon + 1);

            port.IgnoreRemainingLines();

            if (sCalls.EndsWith(" "))
            {
                sCalls = sCalls.Substring(0, sCalls.Length - 1);
            }
            if (sCalls.EndsWith(","))
            {
                sCalls = sCalls.Substring(0, sCalls.Length - 1);
            }
            if ("," == sCalls.Substring(0, 1))
            {
                sCalls = sCalls.Substring(1);
            }
            if (sPuts.EndsWith(" "))
            {
                sPuts = sPuts.Substring(0, sPuts.Length - 1);
            }
            if (sPuts.EndsWith(","))
            {
                sPuts = sPuts.Substring(0, sPuts.Length - 1);
            }
            if ("," == sPuts.Substring(0, 1))
            {
                sPuts = sPuts.Substring(1);
            }

            rCalls = sCalls.Split(chDelim);
            rPuts  = sPuts.Split(chDelim);

            if (null != NewChain)
            {
                NewChain(this, new OptionArgs(rCalls, rPuts));
            }

            NewChain = null;
            port     = null;
        }
    /// <summary>
    /// 眩晕Buffer,怪物会停止移动攻击等行为
    /// </summary>
    /// <param name="value">眩晕时间.</param>
    /// <param name="bufferUI">UI样式,为0时不显示.</param>
    /// <param name="usefolForSuperArmor">对霸体怪物是否起作用</param>
    /// <param name="addMore">If set to <c>true</c> 是否可以叠加.</param>
    /// <param name="permanent">If set to <c>true</c> 是否永久添加.</param>
    public BufferStateBase DeBufferDizzness(float continueTime, int bufferUI, bool usefolForSuperArmor, bool addMore, bool permanent)
    {
        if (transform.parent.parent.GetComponent <MonsterActionCtl>().GetState() >= MonsterState.UnderThumpAttack)
        {
            return(null);
        }
        if (monsterMessage.beiji.GetInvincibleInfo().IsInvincible)
        {
            return(null);
        }
        BufferArgs args = new BufferArgs();

        args.m_iBufferUI      = bufferUI;
        args.m_bValue1        = usefolForSuperArmor;
        args.m_Addition       = addMore;
        args.m_ContinuousTime = continueTime;
        args.m_Permanent      = permanent;
        return(m_BufferMgr.BufferAdd(BufferType.DeBuffer.DeBufferDizzness, args));
    }
Exemplo n.º 26
0
        private void UMessage(BufferArgs args)
        {
            LevelIIUpdateMessage Message;

            try {
                Message = new LevelIIUpdateMessage(args.items);
                if (htWatchEvents.ContainsKey(Message.Symbol))
                {
                    LevelIIUpdateMessageHandler mh = htWatchEvents[Message.Symbol] as LevelIIUpdateMessageHandler;
                    if (null != mh)
                    {
                        mh(this, new LevelIIUpdateMessageEventArgs(Message));
                    }
                }
            }
            catch (Exception e) {
                Console.WriteLine("IQFeedLevelII.UMessage error: " + args.Line);
                Console.WriteLine("  ** Exception {0}", e.ToString());
            }
        }
Exemplo n.º 27
0
        private void OnResult(object o, BufferArgs args)
        {
            //Console.WriteLine(args.Line);
            args.items = args.Line.Split(chDelim);

            switch (args.items[0])
            {
            case "U": // data
                UMessage(args);
                break;

            case "T": // time stamp
                TMessage(args);
                break;

            case "M": // mmid,name
                break;

            case "E": // error text
                Console.WriteLine("{0} 9200 Error: {1}", Clock.Now, args.items[1]);
                break;

            case "O=":
            case "O": // market is open
                Console.WriteLine("{0} 9200 Market is open", Clock.Now);
                break;

            case "C=":
            case "C": // market is closed
                Console.WriteLine("{0} 9200 Market is closed", Clock.Now);
                break;

            case "n": // symbol not found
                Console.WriteLine("9200 Symbol not found: {0}", args.items[1]);
                break;

            default:
                Console.WriteLine("{0} 9200 unknown: {1}", Clock.Now, args.Line);
                break;
            }
        }
Exemplo n.º 28
0
 private void IgnoreRemainingLines(object o, BufferArgs e)
 {
     if ("!ENDMSG!" == e.Line)
     {
         //Console.WriteLine("EndCmd");
         EndCmd();
         //bs = null;
     }
     else
     {
         if (0 == e.Line.Length)
         {
             // ignore it
         }
         else
         {
             if (Regex.IsMatch(e.Line, "!ERROR!", RegexOptions.None))
             {
                 // skip a blank line and prepare for finish
                 Console.WriteLine("errline: {0}", e.Line);
             }
         }
     }
 }
Exemplo n.º 29
0
        private void ProcessPort5009(object o, BufferArgs args)
        {
            //Console.WriteLine( "*" + args.Line + "*" );

            args.items = args.Line.Split(chDelim);

            switch (args.items[0])
            {
            case "Q":
                if ("Not Found" == args.items[3])
                {
                    Console.WriteLine("Symbol not found, number of items: {0} {1}", args.items[1], args.items.Length);
                    if (null != HandleWatchSymbolNotFound)
                    {
                        HandleWatchSymbolNotFound(this, new WatchSymbolNotFoundMessageEventArgs(args.items[1]));
                    }
                }
                else
                {
                    UpdateMessage update = new UpdateMessage(args.items);
                    if (null != HandleUpdateMessage)
                    {
                        HandleUpdateMessage(this, new UpdateMessageEventArgs(update));
                    }
                    //if (null != HandleQ) HandleQ(this, args);
                }
                break;

            case "P":
                SummaryMessage summary = new SummaryMessage(args.items);
                if (null != HandleSummaryMessage)
                {
                    HandleSummaryMessage(this, new SummaryMessageEventArgs(summary));
                }
                //if (null != HandleP) HandleP(this, args);
                break;

            case "F":
                FundamentalMessage fundamental = new FundamentalMessage(args.items);
                if (null != HandleFundamentalMessage)
                {
                    HandleFundamentalMessage(this, new FundamentalMessageEventArgs(fundamental));
                }
                //if (null != HandleF) HandleF(this, args);
                break;

            case "N":

                int pos;                                         // extract headline just in case it has commas in it
                pos           = args.Line.IndexOf(",", 2);       // just prior story id
                pos           = args.Line.IndexOf(",", pos + 1); // just prior symbol list
                pos           = args.Line.IndexOf(",", pos + 1); // just prior datetime
                pos           = args.Line.IndexOf(",", pos + 1); // just prior headline
                args.headline = args.Line.Substring(pos + 1);    // get rest of line

                NewsMessage news = new NewsMessage(args.items, args.headline);
                if (null != HandleNewsMessage)
                {
                    HandleNewsMessage(this, new NewsMessageEventArgs(news));
                }
                //if (null != HandleN) HandleN(this, args);
                break;

            case "T":
                CheckTime(args);
                //if (null != HandleT) HandleT(this, args);
                break;

            case "S":
                Console.WriteLine("*" + args.Line + "*");
                SystemMessage system = new SystemMessage(args.items);
                if (null != HandleSystemMessage)
                {
                    HandleSystemMessage(this, new SystemMessageEventArgs(system));
                }
                //HandleS(e);
                break;
            }
        }
Exemplo n.º 30
0
 public string Serialize(InArgs <object> target, BufferArgs readOnlySpan)
 => $"{_names.Serialize}({target}, {readOnlySpan})";