Ejemplo n.º 1
0
        internal Document[] BuildDocument(TargetObject targetObject)
        {
            _Runspace.EnterTargetObject(targetObject);
            var result = new List <Document>();

            for (var c = 0; c < Context.Option.Output.Culture.Length; c++)
            {
                _Runspace.EnterCulture(Context.Option.Output.Culture[c]);
                for (var i = 0; i < _Builder.Length; i++)
                {
                    foreach (var instanceName in Context.InstanceNameBinder.GetInstanceName(_Builder[i].Name))
                    {
                        _Runspace.EnterDocument(instanceName);
                        try
                        {
                            var document = _Builder[i].Process(_Runspace, targetObject.Value);
                            if (document != null)
                            {
                                result.Add(document);
                            }
                        }
                        finally
                        {
                            _Runspace.ExitDocument();
                        }
                    }
                }
            }
            return(result.ToArray());
        }
Ejemplo n.º 2
0
        internal Document[] BuildDocument(PSObject sourceObject)
        {
            _Runspace.EnterTargetObject(sourceObject);
            var result = new List <Document>();

            for (var c = 0; c < Context.Option.Output.Culture.Length; c++)
            {
                _Runspace.EnterCulture(Context.Option.Output.Culture[c]);
                for (var i = 0; i < _Builder.Length; i++)
                {
                    foreach (var instanceName in Context.InstanceNameBinder.GetInstanceName(_Builder[i].Name))
                    {
                        _Runspace.InstanceName = instanceName;

                        // TODO: Add target name binding
                        var document = _Builder[i].Process(_Runspace, sourceObject);
                        result.Add(document);
                    }
                }
            }
            return(result.ToArray());
        }