Exemplo n.º 1
0
        public static void UpdateData(string curveData)
        {
            try
            {
                string[] curves = curveData.Split(',');
                long     index;
                if (curves != null && curves.Length > 0)
                {
                    index = Convert.ToInt64(curves[0]);
                    if (!LSTCurvesData.Contains(curveData))
                    {
                        LSTCurvesData.Add(curveData);
                    }

                    foreach (string header in LSTCurveHeaders)
                    {
                        CurveInfo[] infos = LSTIndexInfo.Where(x => (x.Name.TrimEnd().TrimStart() == header.TrimEnd().TrimStart())).ToArray();
                        if (infos.Length > 0)
                        {
                            if (infos[0].MaxIndex < index)
                            {
                                infos[0].MaxIndex = index;
                            }

                            if (infos[0].MinIndex > index)
                            {
                                infos[0].MinIndex = index;
                            }
                        }
                        else
                        {
                            CurveInfo info = new CurveInfo()
                            {
                                Name = header, MaxIndex = index, MinIndex = index
                            };
                            if (!LSTIndexInfo.Contains(info))
                            {
                                LSTIndexInfo.Add(info);
                            }
                        }
                    }
                }
                else
                {
                    throw new Exception("Empty or Invalid data received");
                }
            }
            catch (Exception ex)
            {
                Logger.WrieException(string.Format("Data Subscription failed - {0}", ex.Message));
                throw new Exception(string.Format("Data Subscription failed - {0}", ex.Message));
            }
        }
Exemplo n.º 2
0
 public static void ClearPrevData()
 {
     LSTCurvesData.Clear();
     LSTIndexInfo.Clear();
     LSTCurveHeaders.Clear();
 }