コード例 #1
0
            /// <summary>
            /// Recursively sets the parent scope for all of the scopes in the recording and populates the flattened array of user actions.
            /// </summary>
            /// <param name="scope">The scope.</param>
            /// <param name="recording">The recording.</param>
            private static void SetParentScopeAndUserActions(Scope scope, ref Recording recording)
            {
                if (scope.Children.IsNullOrEmpty())
                {
                    return;
                }

                foreach (var child in scope.Children)
                {
                    child.Parent = scope;

                    if (child.GetType() == typeof(Scope))
                    {
                        SetParentScopeAndUserActions((Scope)child, ref recording);
                    }
                    else if (child.GetType().IsSubclassOf(typeof(UserAction)))
                    {
                        UserAction userAction = (UserAction)child;
                        userAction.Recording = recording;
                        recording.AddUserAction(userAction);
                    }
                }
            }