Пример #1
0
        /// <summary>
        /// Replays the actions in this save track into an <see cref="ISaver"/>.
        /// </summary>
        /// <param name="dataAdapter">The adapter into which to replay the actions.</param>
        public void Replay(ISaver dataAdapter)
        {
            foreach (var action in this.actions)
            {
                switch (action.ActionType)
                {
                case ActionType.SetSetting:
                    var pair = (KeyValuePair <string, string>)action.Item;
                    dataAdapter.SetSetting(pair.Key, pair.Value);
                    break;

                case ActionType.RemoveSetting:
                    dataAdapter.RemoveSetting((string)action.Item);
                    break;

                case ActionType.AddSecurity:
                    dataAdapter.AddSecurity((SecurityData)action.Item);
                    break;

                case ActionType.RemoveSecurity:
                    dataAdapter.RemoveSecurity((Guid)action.Item);
                    break;

                case ActionType.AddPriceQuote:
                    dataAdapter.AddPriceQuote((PriceQuoteData)action.Item);
                    break;

                case ActionType.RemovePriceQuote:
                    dataAdapter.RemovePriceQuote((Guid)action.Item);
                    break;

                case ActionType.AddAccount:
                    dataAdapter.AddAccount((AccountData)action.Item);
                    break;

                case ActionType.RemoveAccount:
                    dataAdapter.RemoveAccount((Guid)action.Item);
                    break;

                case ActionType.AddTransaction:
                    dataAdapter.AddTransaction((TransactionData)action.Item);
                    break;

                case ActionType.RemoveTransaction:
                    dataAdapter.RemoveTransaction((Guid)action.Item);
                    break;
                }
            }
        }
Пример #2
0
 /// <summary>
 /// Replays the actions in this save track into an <see cref="ISaver"/>.
 /// </summary>
 /// <param name="dataAdapter">The adapter into which to replay the actions.</param>
 public void Replay(ISaver dataAdapter)
 {
     foreach (var action in this.actions)
     {
         switch (action.ActionType)
         {
             case ActionType.SetSetting:
                 var pair = (KeyValuePair<string, string>)action.Item;
                 dataAdapter.SetSetting(pair.Key, pair.Value);
                 break;
             case ActionType.RemoveSetting:
                 dataAdapter.RemoveSetting((string)action.Item);
                 break;
             case ActionType.AddSecurity:
                 dataAdapter.AddSecurity((SecurityData)action.Item);
                 break;
             case ActionType.RemoveSecurity:
                 dataAdapter.RemoveSecurity((Guid)action.Item);
                 break;
             case ActionType.AddPriceQuote:
                 dataAdapter.AddPriceQuote((PriceQuoteData)action.Item);
                 break;
             case ActionType.RemovePriceQuote:
                 dataAdapter.RemovePriceQuote((Guid)action.Item);
                 break;
             case ActionType.AddAccount:
                 dataAdapter.AddAccount((AccountData)action.Item);
                 break;
             case ActionType.RemoveAccount:
                 dataAdapter.RemoveAccount((Guid)action.Item);
                 break;
             case ActionType.AddTransaction:
                 dataAdapter.AddTransaction((TransactionData)action.Item);
                 break;
             case ActionType.RemoveTransaction:
                 dataAdapter.RemoveTransaction((Guid)action.Item);
                 break;
         }
     }
 }