示例#1
0
        public AccountDataSnapshot GetSnapshot(byte providerId, byte route)
        {
            var table = GetTable(providerId, route, false);
            if (table == null)
                return new AccountDataSnapshot(new AccountDataEntry[0]);

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

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

            AccountDataSnapshot result;

            lock (table)
            {
                var list = new List <AccountDataEntry>();
                foreach (string current in table.Items.Keys)
                {
                    var class2      = table.Items[current];
                    var accountData = new AccountData(this.framework.Clock.DateTime, AccountDataType.AccountValue, current, providerId, route);
                    CopyFields(class2.Values, accountData.Fields);
                    var list2 = new List <AccountData>();
                    foreach (var current2 in class2.Positions.Values)
                    {
                        var accountData2 = new AccountData(this.framework.Clock.DateTime, AccountDataType.Position, current, providerId, route);
                        CopyFields(current2, accountData2.Fields);
                        list2.Add(accountData2);
                    }
                    var list3 = new List <AccountData>();
                    foreach (var current3 in class2.Orders.Values)
                    {
                        var accountData3 = new AccountData(this.framework.Clock.DateTime, AccountDataType.Order, current, providerId, route);
                        CopyFields(current3, accountData3.Fields);
                        list3.Add(accountData3);
                    }
                    list.Add(new AccountDataEntry(current, accountData, list2.ToArray(), list3.ToArray()));
                }
                result = new AccountDataSnapshot(list.ToArray());
            }
            return(result);
        }