コード例 #1
0
        private void ParseDbRow(SNode node)
        {
            MarketHistory history = new MarketHistory();

            history.Region = Region;
            history.Type   = Type;

            SNodeContainer members = node.Members;

            for (int i = 0; i < members.Length; i++)
            {
                SNode  value = members[i++];
                SIdent ident = members[i] as SIdent;

                SInt  intV  = value as SInt;
                SLong longV = value as SLong;

                int  sintV  = 0;
                long slongV = 0;

                if (intV != null)
                {
                    sintV = intV.Value;
                }
                else if (longV != null)
                {
                    slongV = longV.Value;
                }

                switch (ident.Value)
                {
                case "historyDate":
                    history.HistoryTicks = slongV;
                    break;

                case "lowPrice":
                    history.LowPrice = slongV;
                    break;

                case "highPrice":
                    history.HighPrice = slongV;
                    break;

                case "avgPrice":
                    history.AveragePrice = slongV;
                    break;

                case "volume":
                    history.Volume = slongV;
                    break;

                case "orders":
                    history.Orders = sintV;
                    break;

                default:
                    throw new ParseException("Can't parse " + ident);
                }
            }
            List.Add(history);
        }
コード例 #2
0
		private void ParseDbRow(SNode node)
		{
			MarketHistory history = new MarketHistory();
			history.Region = Region;
			history.Type = Type;

			SNodeContainer members = node.Members;
			for ( int i = 0; i < members.Length; i++)
			{
				SNode value = members[i++];
				SIdent ident = members[i] as SIdent;

				SInt intV = value as SInt;
				SLong longV = value as SLong;

				int sintV = 0;
				long slongV = 0;

				if (intV != null)
					sintV = intV.Value;
				else if (longV != null)
					slongV = longV.Value;

				switch (ident.Value)
				{
					case "historyDate":
						history.HistoryTicks = slongV;
						break;
					case "lowPrice":
						history.LowPrice = slongV;
						break;
					case "highPrice":
						history.HighPrice = slongV;
						break;
					case "avgPrice":
						history.AveragePrice = slongV;
						break;
					case "volume":
						history.Volume = slongV;
						break;
					case "orders":
						history.Orders = sintV;
						break;
					default:
						throw new ParseException("Can't parse " + ident);
				}
			}
			List.Add(history);
		}