Esempio n. 1
0
        public AccountDataSnapshot GetSnapshot(byte providerId, byte route)
        {
            AccountDataTable table = this.GetTable(providerId, route, false);

            if (table == null)
            {
                return(new AccountDataSnapshot(new AccountDataEntry[0]));
            }
            AccountDataSnapshot result;

            lock (table)
            {
                List <AccountDataEntry> list = new List <AccountDataEntry>();
                foreach (string current in table.Items.Keys)
                {
                    AccountDataTableItem accountDataTableItem = table.Items[current];
                    AccountData          accountData          = new AccountData(this.framework.Clock.DateTime, AccountDataType.AccountValue, current, providerId, route);
                    this.CopyFields(accountDataTableItem.Values, accountData.Fields);
                    List <AccountData> list2 = new List <AccountData>();
                    foreach (AccountDataFieldList current2 in accountDataTableItem.Positions.Values)
                    {
                        AccountData accountData2 = new AccountData(this.framework.Clock.DateTime, AccountDataType.Position, current, providerId, route);
                        this.CopyFields(current2, accountData2.Fields);
                        list2.Add(accountData2);
                    }
                    List <AccountData> list3 = new List <AccountData>();
                    foreach (AccountDataFieldList current3 in accountDataTableItem.Orders.Values)
                    {
                        AccountData accountData3 = new AccountData(this.framework.Clock.DateTime, AccountDataType.Order, current, providerId, route);
                        this.CopyFields(current3, accountData3.Fields);
                        list3.Add(accountData3);
                    }
                    list.Add(new AccountDataEntry(current, accountData, list2.ToArray(), list3.ToArray()));
                }
                result = new AccountDataSnapshot(list.ToArray());
            }
            return(result);
        }
Esempio n. 2
0
		public AccountDataSnapshot GetSnapshot(byte providerId, byte route)
		{
			AccountDataTable table = this.GetTable(providerId, route, false);
			if (table == null)
			{
				return new AccountDataSnapshot(new AccountDataEntry[0]);
			}
			AccountDataSnapshot result;
			lock (table)
			{
				List<AccountDataEntry> list = new List<AccountDataEntry>();
				foreach (string current in table.Items.Keys)
				{
					AccountDataTableItem accountDataTableItem = table.Items[current];
					AccountData accountData = new AccountData(this.framework.Clock.DateTime, AccountDataType.AccountValue, current, providerId, route);
					this.CopyFields(accountDataTableItem.Values, accountData.Fields);
					List<AccountData> list2 = new List<AccountData>();
					foreach (AccountDataFieldList current2 in accountDataTableItem.Positions.Values)
					{
						AccountData accountData2 = new AccountData(this.framework.Clock.DateTime, AccountDataType.Position, current, providerId, route);
						this.CopyFields(current2, accountData2.Fields);
						list2.Add(accountData2);
					}
					List<AccountData> list3 = new List<AccountData>();
					foreach (AccountDataFieldList current3 in accountDataTableItem.Orders.Values)
					{
						AccountData accountData3 = new AccountData(this.framework.Clock.DateTime, AccountDataType.Order, current, providerId, route);
						this.CopyFields(current3, accountData3.Fields);
						list3.Add(accountData3);
					}
					list.Add(new AccountDataEntry(current, accountData, list2.ToArray(), list3.ToArray()));
				}
				result = new AccountDataSnapshot(list.ToArray());
			}
			return result;
		}