예제 #1
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (HasFetchFrom)
            {
                hash ^= FetchFrom.GetHashCode();
            }
            if (HasFetchUntil)
            {
                hash ^= FetchUntil.GetHashCode();
            }
            if (HasMaxEvents)
            {
                hash ^= MaxEvents.GetHashCode();
            }
            if (HasOrder)
            {
                hash ^= Order.GetHashCode();
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
예제 #2
0
        // Module defining this command


        // Optional custom code for this activity


        /// <summary>
        /// Returns a configured instance of System.Management.Automation.PowerShell, pre-populated with the command to run.
        /// </summary>
        /// <param name="context">The NativeActivityContext for the currently running activity.</param>
        /// <returns>A populated instance of Sytem.Management.Automation.PowerShell</returns>
        /// <remarks>The infrastructure takes responsibility for closing and disposing the PowerShell instance returned.</remarks>
        protected override ActivityImplementationContext GetPowerShell(NativeActivityContext context)
        {
            System.Management.Automation.PowerShell invoker       = global::System.Management.Automation.PowerShell.Create();
            System.Management.Automation.PowerShell targetCommand = invoker.AddCommand(PSCommandName);

            // Initialize the arguments

            if (ListLog.Expression != null)
            {
                targetCommand.AddParameter("ListLog", ListLog.Get(context));
            }

            if (LogName.Expression != null)
            {
                targetCommand.AddParameter("LogName", LogName.Get(context));
            }

            if (ListProvider.Expression != null)
            {
                targetCommand.AddParameter("ListProvider", ListProvider.Get(context));
            }

            if (ProviderName.Expression != null)
            {
                targetCommand.AddParameter("ProviderName", ProviderName.Get(context));
            }

            if (Path.Expression != null)
            {
                targetCommand.AddParameter("Path", Path.Get(context));
            }

            if (MaxEvents.Expression != null)
            {
                targetCommand.AddParameter("MaxEvents", MaxEvents.Get(context));
            }

            if (Credential.Expression != null)
            {
                targetCommand.AddParameter("Credential", Credential.Get(context));
            }

            if (FilterXPath.Expression != null)
            {
                targetCommand.AddParameter("FilterXPath", FilterXPath.Get(context));
            }

            if (FilterXml.Expression != null)
            {
                targetCommand.AddParameter("FilterXml", FilterXml.Get(context));
            }

            if (FilterHashtable.Expression != null)
            {
                targetCommand.AddParameter("FilterHashtable", FilterHashtable.Get(context));
            }

            if (Force.Expression != null)
            {
                targetCommand.AddParameter("Force", Force.Get(context));
            }

            if (Oldest.Expression != null)
            {
                targetCommand.AddParameter("Oldest", Oldest.Get(context));
            }

            if (GetIsComputerNameSpecified(context) && (PSRemotingBehavior.Get(context) == RemotingBehavior.Custom))
            {
                targetCommand.AddParameter("ComputerName", PSComputerName.Get(context));
            }


            return(new ActivityImplementationContext()
            {
                PowerShellInstance = invoker
            });
        }