Esempio n. 1
0
 protected override void ProcessRecord()
 {
     string[] strArrays = this.paths;
     for (int i = 0; i < (int)strArrays.Length; i++)
     {
         string str = strArrays[i];
         try
         {
             base.InvokeProvider.Item.Get(str, this.CmdletProviderContext);
         }
         catch (PSNotSupportedException pSNotSupportedException1)
         {
             PSNotSupportedException pSNotSupportedException = pSNotSupportedException1;
             base.WriteError(new ErrorRecord(pSNotSupportedException.ErrorRecord, pSNotSupportedException));
         }
         catch (DriveNotFoundException driveNotFoundException1)
         {
             DriveNotFoundException driveNotFoundException = driveNotFoundException1;
             base.WriteError(new ErrorRecord(driveNotFoundException.ErrorRecord, driveNotFoundException));
         }
         catch (ProviderNotFoundException providerNotFoundException1)
         {
             ProviderNotFoundException providerNotFoundException = providerNotFoundException1;
             base.WriteError(new ErrorRecord(providerNotFoundException.ErrorRecord, providerNotFoundException));
         }
         catch (ItemNotFoundException itemNotFoundException1)
         {
             ItemNotFoundException itemNotFoundException = itemNotFoundException1;
             base.WriteError(new ErrorRecord(itemNotFoundException.ErrorRecord, itemNotFoundException));
         }
     }
 }
Esempio n. 2
0
 protected override void ProcessRecord()
 {
     string[] path = this.Path;
     for (int i = 0; i < (int)path.Length; i++)
     {
         string str = path[i];
         try
         {
             base.InvokeProvider.Property.Get(str, SessionStateUtilities.ConvertArrayToCollection <string>(this.property), this.CmdletProviderContext);
         }
         catch (PSNotSupportedException pSNotSupportedException1)
         {
             PSNotSupportedException pSNotSupportedException = pSNotSupportedException1;
             base.WriteError(new ErrorRecord(pSNotSupportedException.ErrorRecord, pSNotSupportedException));
         }
         catch (DriveNotFoundException driveNotFoundException1)
         {
             DriveNotFoundException driveNotFoundException = driveNotFoundException1;
             base.WriteError(new ErrorRecord(driveNotFoundException.ErrorRecord, driveNotFoundException));
         }
         catch (ProviderNotFoundException providerNotFoundException1)
         {
             ProviderNotFoundException providerNotFoundException = providerNotFoundException1;
             base.WriteError(new ErrorRecord(providerNotFoundException.ErrorRecord, providerNotFoundException));
         }
         catch (ItemNotFoundException itemNotFoundException1)
         {
             ItemNotFoundException itemNotFoundException = itemNotFoundException1;
             base.WriteError(new ErrorRecord(itemNotFoundException.ErrorRecord, itemNotFoundException));
         }
     }
 }
Esempio n. 3
0
        private Collection <PathInfo> GetResolvedPaths(string path)
        {
            Collection <PathInfo> pathInfos = new Collection <PathInfo>();

            try
            {
                pathInfos = base.SessionState.Path.GetResolvedPSPathFromPSPath(path);
            }
            catch (PSNotSupportedException pSNotSupportedException1)
            {
                PSNotSupportedException pSNotSupportedException = pSNotSupportedException1;
                base.WriteError(new ErrorRecord(pSNotSupportedException.ErrorRecord, pSNotSupportedException));
            }
            catch (DriveNotFoundException driveNotFoundException1)
            {
                DriveNotFoundException driveNotFoundException = driveNotFoundException1;
                base.WriteError(new ErrorRecord(driveNotFoundException.ErrorRecord, driveNotFoundException));
            }
            catch (ProviderNotFoundException providerNotFoundException1)
            {
                ProviderNotFoundException providerNotFoundException = providerNotFoundException1;
                base.WriteError(new ErrorRecord(providerNotFoundException.ErrorRecord, providerNotFoundException));
            }
            catch (ItemNotFoundException itemNotFoundException1)
            {
                ItemNotFoundException itemNotFoundException = itemNotFoundException1;
                base.WriteError(new ErrorRecord(itemNotFoundException.ErrorRecord, itemNotFoundException));
            }
            return(pathInfos);
        }
Esempio n. 4
0
        /// <summary>
        /// 1. Set the throttling limit and reset operations complete
        /// 2. Create helper objects
        /// 3. For async case, write the async result object down the
        ///    pipeline.
        /// </summary>
        protected override void BeginProcessing()
        {
            if (!File.Exists(PowerShellProcessInstance.PwshExePath))
            {
                // The pwsh executable file is not found under $PSHOME.
                // This means that PowerShell is currently being hosted in another application,
                // and 'Start-Job' is not supported by design in that scenario.
                string message = StringUtil.Format(
                    RemotingErrorIdStrings.IPCPwshExecutableNotFound,
                    PowerShellProcessInstance.PwshExePath);

                var exception   = new PSNotSupportedException(message);
                var errorRecord = new ErrorRecord(
                    exception,
                    "IPCPwshExecutableNotFound",
                    ErrorCategory.NotInstalled,
                    PowerShellProcessInstance.PwshExePath);

                ThrowTerminatingError(errorRecord);
            }

            CommandDiscovery.AutoloadModulesWithJobSourceAdapters(this.Context, this.CommandOrigin);

            if (ParameterSetName == DefinitionNameParameterSet)
            {
                return;
            }

            // since jobs no more depend on WinRM
            // we will have to skip the check for the same
            SkipWinRMCheck = true;

            base.BeginProcessing();
        }
Esempio n. 5
0
 protected override void ProcessRecord()
 {
     string[] path = this.Path;
     for (int i = 0; i < (int)path.Length; i++)
     {
         string str = path[i];
         try
         {
             base.InvokeProvider.Property.Copy(str, this.property, this.Destination, this.property, base.GetCurrentContext());
         }
         catch (PSNotSupportedException pSNotSupportedException1)
         {
             PSNotSupportedException pSNotSupportedException = pSNotSupportedException1;
             base.WriteError(new ErrorRecord(pSNotSupportedException.ErrorRecord, pSNotSupportedException));
         }
         catch (DriveNotFoundException driveNotFoundException1)
         {
             DriveNotFoundException driveNotFoundException = driveNotFoundException1;
             base.WriteError(new ErrorRecord(driveNotFoundException.ErrorRecord, driveNotFoundException));
         }
         catch (ProviderNotFoundException providerNotFoundException1)
         {
             ProviderNotFoundException providerNotFoundException = providerNotFoundException1;
             base.WriteError(new ErrorRecord(providerNotFoundException.ErrorRecord, providerNotFoundException));
         }
         catch (ItemNotFoundException itemNotFoundException1)
         {
             ItemNotFoundException itemNotFoundException = itemNotFoundException1;
             base.WriteError(new ErrorRecord(itemNotFoundException.ErrorRecord, itemNotFoundException));
         }
     }
 }
Esempio n. 6
0
        protected override void ProcessRecord()
        {
            Collection <PathInfo> resolvedPSPathFromPSPath;

            string[] path = this.Path;
            for (int i = 0; i < (int)path.Length; i++)
            {
                string str = path[i];
                resolvedPSPathFromPSPath = null;
                try
                {
                    resolvedPSPathFromPSPath = base.SessionState.Path.GetResolvedPSPathFromPSPath(str, this.CmdletProviderContext);
                    if (this.relative)
                    {
                        foreach (PathInfo pathInfo in resolvedPSPathFromPSPath)
                        {
                            string str1 = base.SessionState.Path.NormalizeRelativePath(pathInfo.Path, base.SessionState.Path.CurrentLocation.ProviderPath);
                            if (!str1.StartsWith(".", StringComparison.OrdinalIgnoreCase))
                            {
                                str1 = base.SessionState.Path.Combine(".", str1);
                            }
                            base.WriteObject(str1, false);
                        }
                    }
                    goto Label0;
                }
                catch (PSNotSupportedException pSNotSupportedException1)
                {
                    PSNotSupportedException pSNotSupportedException = pSNotSupportedException1;
                    base.WriteError(new ErrorRecord(pSNotSupportedException.ErrorRecord, pSNotSupportedException));
                }
                catch (DriveNotFoundException driveNotFoundException1)
                {
                    DriveNotFoundException driveNotFoundException = driveNotFoundException1;
                    base.WriteError(new ErrorRecord(driveNotFoundException.ErrorRecord, driveNotFoundException));
                }
                catch (ProviderNotFoundException providerNotFoundException1)
                {
                    ProviderNotFoundException providerNotFoundException = providerNotFoundException1;
                    base.WriteError(new ErrorRecord(providerNotFoundException.ErrorRecord, providerNotFoundException));
                }
                catch (ItemNotFoundException itemNotFoundException1)
                {
                    ItemNotFoundException itemNotFoundException = itemNotFoundException1;
                    base.WriteError(new ErrorRecord(itemNotFoundException.ErrorRecord, itemNotFoundException));
                }
            }
            return;

Label0:
            if (!this.relative)
            {
                base.WriteObject(resolvedPSPathFromPSPath, true);
                return;
            }
            else
            {
                return;
            }
        }
 protected override void ProcessRecord()
 {
     try
     {
         CmdletProviderContext cmdletProviderContext = this.CmdletProviderContext;
         cmdletProviderContext.PassThru = base.PassThru;
         base.InvokeProvider.Property.Rename(this.path, this.Name, this.NewName, cmdletProviderContext);
     }
     catch (PSNotSupportedException pSNotSupportedException1)
     {
         PSNotSupportedException pSNotSupportedException = pSNotSupportedException1;
         base.WriteError(new ErrorRecord(pSNotSupportedException.ErrorRecord, pSNotSupportedException));
     }
     catch (DriveNotFoundException driveNotFoundException1)
     {
         DriveNotFoundException driveNotFoundException = driveNotFoundException1;
         base.WriteError(new ErrorRecord(driveNotFoundException.ErrorRecord, driveNotFoundException));
     }
     catch (ProviderNotFoundException providerNotFoundException1)
     {
         ProviderNotFoundException providerNotFoundException = providerNotFoundException1;
         base.WriteError(new ErrorRecord(providerNotFoundException.ErrorRecord, providerNotFoundException));
     }
     catch (ItemNotFoundException itemNotFoundException1)
     {
         ItemNotFoundException itemNotFoundException = itemNotFoundException1;
         base.WriteError(new ErrorRecord(itemNotFoundException.ErrorRecord, itemNotFoundException));
     }
 }
Esempio n. 8
0
        protected override void ProcessRecord()
        {
            ProviderInfo providerInfo = null;

            string[] path = this.Path;
            for (int i = 0; i < (int)path.Length; i++)
            {
                string str = path[i];
                try
                {
                    Collection <string> resolvedProviderPathFromPSPath = base.SessionState.Path.GetResolvedProviderPathFromPSPath(str, this.CmdletProviderContext, out providerInfo);
                    base.WriteObject(resolvedProviderPathFromPSPath, true);
                }
                catch (PSNotSupportedException pSNotSupportedException1)
                {
                    PSNotSupportedException pSNotSupportedException = pSNotSupportedException1;
                    base.WriteError(new ErrorRecord(pSNotSupportedException.ErrorRecord, pSNotSupportedException));
                }
                catch (DriveNotFoundException driveNotFoundException1)
                {
                    DriveNotFoundException driveNotFoundException = driveNotFoundException1;
                    base.WriteError(new ErrorRecord(driveNotFoundException.ErrorRecord, driveNotFoundException));
                }
                catch (ProviderNotFoundException providerNotFoundException1)
                {
                    ProviderNotFoundException providerNotFoundException = providerNotFoundException1;
                    base.WriteError(new ErrorRecord(providerNotFoundException.ErrorRecord, providerNotFoundException));
                }
                catch (ItemNotFoundException itemNotFoundException1)
                {
                    ItemNotFoundException itemNotFoundException = itemNotFoundException1;
                    base.WriteError(new ErrorRecord(itemNotFoundException.ErrorRecord, itemNotFoundException));
                }
            }
        }
 protected override void ProcessRecord()
 {
     string[] path = this.Path;
     for (int i = 0; i < (int)path.Length; i++)
     {
         string str = path[i];
         try
         {
             base.InvokeProvider.Property.New(str, this.Name, this.PropertyType, this.Value, this.CmdletProviderContext);
         }
         catch (PSNotSupportedException pSNotSupportedException1)
         {
             PSNotSupportedException pSNotSupportedException = pSNotSupportedException1;
             base.WriteError(new ErrorRecord(pSNotSupportedException.ErrorRecord, pSNotSupportedException));
         }
         catch (DriveNotFoundException driveNotFoundException1)
         {
             DriveNotFoundException driveNotFoundException = driveNotFoundException1;
             base.WriteError(new ErrorRecord(driveNotFoundException.ErrorRecord, driveNotFoundException));
         }
         catch (ProviderNotFoundException providerNotFoundException1)
         {
             ProviderNotFoundException providerNotFoundException = providerNotFoundException1;
             base.WriteError(new ErrorRecord(providerNotFoundException.ErrorRecord, providerNotFoundException));
         }
         catch (ItemNotFoundException itemNotFoundException1)
         {
             ItemNotFoundException itemNotFoundException = itemNotFoundException1;
             base.WriteError(new ErrorRecord(itemNotFoundException.ErrorRecord, itemNotFoundException));
         }
     }
 }
Esempio n. 10
0
 protected override void ProcessRecord()
 {
     string[] strArrays = this.paths;
     for (int i = 0; i < (int)strArrays.Length; i++)
     {
         string   str      = strArrays[i];
         object[] objArray = new object[1];
         objArray[0] = str;
         CoreCommandBase.tracer.WriteLine("Invoking {0}", objArray);
         try
         {
             base.InvokeProvider.Item.Invoke(str, this.CmdletProviderContext);
         }
         catch (PSNotSupportedException pSNotSupportedException1)
         {
             PSNotSupportedException pSNotSupportedException = pSNotSupportedException1;
             base.WriteError(new ErrorRecord(pSNotSupportedException.ErrorRecord, pSNotSupportedException));
         }
         catch (DriveNotFoundException driveNotFoundException1)
         {
             DriveNotFoundException driveNotFoundException = driveNotFoundException1;
             base.WriteError(new ErrorRecord(driveNotFoundException.ErrorRecord, driveNotFoundException));
         }
         catch (ProviderNotFoundException providerNotFoundException1)
         {
             ProviderNotFoundException providerNotFoundException = providerNotFoundException1;
             base.WriteError(new ErrorRecord(providerNotFoundException.ErrorRecord, providerNotFoundException));
         }
         catch (ItemNotFoundException itemNotFoundException1)
         {
             ItemNotFoundException itemNotFoundException = itemNotFoundException1;
             base.WriteError(new ErrorRecord(itemNotFoundException.ErrorRecord, itemNotFoundException));
         }
     }
 }
Esempio n. 11
0
        protected Database OpenDatabase(string path)
        {
            var type = FileInfo.GetFileTypeInternal(path);

            if (FileType.Package == type)
            {
                var db = new InstallPackage(path, DatabaseOpenMode.ReadOnly);
                this.ApplyTransforms(db);

                return(db);
            }
            else if (FileType.Patch == type)
            {
                return(new PatchPackage(path));
            }
            else
            {
                var message = string.Format(Resources.Error_InvalidStorage, path);
                var ex      = new PSNotSupportedException(message);
                if (null != ex.ErrorRecord)
                {
                    base.WriteError(ex.ErrorRecord);
                }

                return(null);
            }
        }
Esempio n. 12
0
        protected override void ProcessRecord()
        {
            CmdletProviderContext cmdletProviderContext = this.CmdletProviderContext;

            cmdletProviderContext.PassThru = false;
            string[] path = base.Path;
            for (int i = 0; i < (int)path.Length; i++)
            {
                string str = path[i];
                try
                {
                    base.InvokeProvider.Content.Clear(str, cmdletProviderContext);
                }
                catch (PSNotSupportedException pSNotSupportedException1)
                {
                    PSNotSupportedException pSNotSupportedException = pSNotSupportedException1;
                    base.WriteError(new ErrorRecord(pSNotSupportedException.ErrorRecord, pSNotSupportedException));
                }
                catch (DriveNotFoundException driveNotFoundException1)
                {
                    DriveNotFoundException driveNotFoundException = driveNotFoundException1;
                    base.WriteError(new ErrorRecord(driveNotFoundException.ErrorRecord, driveNotFoundException));
                }
                catch (ProviderNotFoundException providerNotFoundException1)
                {
                    ProviderNotFoundException providerNotFoundException = providerNotFoundException1;
                    base.WriteError(new ErrorRecord(providerNotFoundException.ErrorRecord, providerNotFoundException));
                }
                catch (ItemNotFoundException itemNotFoundException1)
                {
                    ItemNotFoundException itemNotFoundException = itemNotFoundException1;
                    base.WriteError(new ErrorRecord(itemNotFoundException.ErrorRecord, itemNotFoundException));
                }
            }
        }
Esempio n. 13
0
        protected override void ProcessRecord()
        {
            CmdletProviderContext cmdletProviderContext = this.CmdletProviderContext;

            cmdletProviderContext.PassThru = base.PassThru;
            PSObject pSObject         = null;
            string   parameterSetName = base.ParameterSetName;
            string   str = parameterSetName;

            if (parameterSetName != null)
            {
                if (str == "propertyValuePathSet" || str == "propertyValueLiteralPathSet")
                {
                    pSObject = new PSObject();
                    pSObject.Properties.Add(new PSNoteProperty(this.Name, this.Value));
                }
                else
                {
                    if (str == "propertyPSObjectPathSet")
                    {
                        pSObject = this.InputObject;
                    }
                }
            }
            string[] path = this.Path;
            for (int i = 0; i < (int)path.Length; i++)
            {
                string str1 = path[i];
                try
                {
                    base.InvokeProvider.Property.Set(str1, pSObject, cmdletProviderContext);
                }
                catch (PSNotSupportedException pSNotSupportedException1)
                {
                    PSNotSupportedException pSNotSupportedException = pSNotSupportedException1;
                    base.WriteError(new ErrorRecord(pSNotSupportedException.ErrorRecord, pSNotSupportedException));
                }
                catch (DriveNotFoundException driveNotFoundException1)
                {
                    DriveNotFoundException driveNotFoundException = driveNotFoundException1;
                    base.WriteError(new ErrorRecord(driveNotFoundException.ErrorRecord, driveNotFoundException));
                }
                catch (ProviderNotFoundException providerNotFoundException1)
                {
                    ProviderNotFoundException providerNotFoundException = providerNotFoundException1;
                    base.WriteError(new ErrorRecord(providerNotFoundException.ErrorRecord, providerNotFoundException));
                }
                catch (ItemNotFoundException itemNotFoundException1)
                {
                    ItemNotFoundException itemNotFoundException = itemNotFoundException1;
                    base.WriteError(new ErrorRecord(itemNotFoundException.ErrorRecord, itemNotFoundException));
                }
            }
        }
Esempio n. 14
0
        protected override void ProcessRecord()
        {
            CmdletProviderContext cmdletProviderContext = this.CmdletProviderContext;

            if (this.paths == null || this.paths != null && (int)this.paths.Length == 0)
            {
                string[] empty = new string[1];
                empty[0]   = string.Empty;
                this.paths = empty;
            }
            string[] strArrays = this.paths;
            for (int i = 0; i < (int)strArrays.Length; i++)
            {
                string str = strArrays[i];
                string parameterSetName = base.ParameterSetName;
                string str1             = parameterSetName;
                if (parameterSetName != null && (str1 == "Items" || str1 == "LiteralItems"))
                {
                    try
                    {
                        if (!this.Name)
                        {
                            base.InvokeProvider.ChildItem.Get(str, this.Recurse, cmdletProviderContext);
                        }
                        else
                        {
                            base.InvokeProvider.ChildItem.GetNames(str, ReturnContainers.ReturnMatchingContainers, this.Recurse, cmdletProviderContext);
                        }
                    }
                    catch (PSNotSupportedException pSNotSupportedException1)
                    {
                        PSNotSupportedException pSNotSupportedException = pSNotSupportedException1;
                        base.WriteError(new ErrorRecord(pSNotSupportedException.ErrorRecord, pSNotSupportedException));
                    }
                    catch (DriveNotFoundException driveNotFoundException1)
                    {
                        DriveNotFoundException driveNotFoundException = driveNotFoundException1;
                        base.WriteError(new ErrorRecord(driveNotFoundException.ErrorRecord, driveNotFoundException));
                    }
                    catch (ProviderNotFoundException providerNotFoundException1)
                    {
                        ProviderNotFoundException providerNotFoundException = providerNotFoundException1;
                        base.WriteError(new ErrorRecord(providerNotFoundException.ErrorRecord, providerNotFoundException));
                    }
                    catch (ItemNotFoundException itemNotFoundException1)
                    {
                        ItemNotFoundException itemNotFoundException = itemNotFoundException1;
                        base.WriteError(new ErrorRecord(itemNotFoundException.ErrorRecord, itemNotFoundException));
                    }
                }
            }
        }
Esempio n. 15
0
        internal List <ContentCommandBase.ContentHolder> GetContentReaders(string[] readerPaths, CmdletProviderContext currentCommandContext)
        {
            Collection <PathInfo> pathInfos = this.ResolvePaths(readerPaths, false, true, currentCommandContext);
            List <ContentCommandBase.ContentHolder> contentHolders = new List <ContentCommandBase.ContentHolder>();

            foreach (PathInfo pathInfo in pathInfos)
            {
                Collection <IContentReader> reader = null;
                try
                {
                    string path = WildcardPattern.Escape(pathInfo.Path);
                    if (currentCommandContext.SuppressWildcardExpansion)
                    {
                        path = pathInfo.Path;
                    }
                    reader = base.InvokeProvider.Content.GetReader(path, currentCommandContext);
                }
                catch (PSNotSupportedException pSNotSupportedException1)
                {
                    PSNotSupportedException pSNotSupportedException = pSNotSupportedException1;
                    base.WriteError(new ErrorRecord(pSNotSupportedException.ErrorRecord, pSNotSupportedException));
                    continue;
                }
                catch (DriveNotFoundException driveNotFoundException1)
                {
                    DriveNotFoundException driveNotFoundException = driveNotFoundException1;
                    base.WriteError(new ErrorRecord(driveNotFoundException.ErrorRecord, driveNotFoundException));
                    continue;
                }
                catch (ProviderNotFoundException providerNotFoundException1)
                {
                    ProviderNotFoundException providerNotFoundException = providerNotFoundException1;
                    base.WriteError(new ErrorRecord(providerNotFoundException.ErrorRecord, providerNotFoundException));
                    continue;
                }
                catch (ItemNotFoundException itemNotFoundException1)
                {
                    ItemNotFoundException itemNotFoundException = itemNotFoundException1;
                    base.WriteError(new ErrorRecord(itemNotFoundException.ErrorRecord, itemNotFoundException));
                    continue;
                }
                if (reader == null || reader.Count <= 0 || reader.Count != 1 || reader[0] == null)
                {
                    continue;
                }
                ContentCommandBase.ContentHolder contentHolder = new ContentCommandBase.ContentHolder(pathInfo, reader[0], null);
                contentHolders.Add(contentHolder);
            }
            return(contentHolders);
        }
Esempio n. 16
0
        protected override void ProcessRecord()
        {
            CopyContainers        copyContainer;
            CmdletProviderContext cmdletProviderContext = this.CmdletProviderContext;

            cmdletProviderContext.PassThru = this.PassThru;
            string[] strArrays = this.paths;
            for (int i = 0; i < (int)strArrays.Length; i++)
            {
                string   str         = strArrays[i];
                object[] destination = new object[2];
                destination[0] = str;
                destination[1] = this.Destination;
                CoreCommandBase.tracer.WriteLine("Copy {0} to {1}", destination);
                try
                {
                    if (this.Container)
                    {
                        copyContainer = CopyContainers.CopyTargetContainer;
                    }
                    else
                    {
                        copyContainer = CopyContainers.CopyChildrenOfTargetContainer;
                    }
                    CopyContainers copyContainer1 = copyContainer;
                    base.InvokeProvider.Item.Copy(str, this.Destination, this.Recurse, copyContainer1, cmdletProviderContext);
                }
                catch (PSNotSupportedException pSNotSupportedException1)
                {
                    PSNotSupportedException pSNotSupportedException = pSNotSupportedException1;
                    base.WriteError(new ErrorRecord(pSNotSupportedException.ErrorRecord, pSNotSupportedException));
                }
                catch (DriveNotFoundException driveNotFoundException1)
                {
                    DriveNotFoundException driveNotFoundException = driveNotFoundException1;
                    base.WriteError(new ErrorRecord(driveNotFoundException.ErrorRecord, driveNotFoundException));
                }
                catch (ProviderNotFoundException providerNotFoundException1)
                {
                    ProviderNotFoundException providerNotFoundException = providerNotFoundException1;
                    base.WriteError(new ErrorRecord(providerNotFoundException.ErrorRecord, providerNotFoundException));
                }
                catch (ItemNotFoundException itemNotFoundException1)
                {
                    ItemNotFoundException itemNotFoundException = itemNotFoundException1;
                    base.WriteError(new ErrorRecord(itemNotFoundException.ErrorRecord, itemNotFoundException));
                }
            }
        }
        internal List <ContentCommandBase.ContentHolder> GetContentWriters(string[] writerPaths, CmdletProviderContext currentCommandContext)
        {
            Collection <PathInfo> pathInfos = base.ResolvePaths(writerPaths, true, false, currentCommandContext);
            List <ContentCommandBase.ContentHolder> contentHolders = new List <ContentCommandBase.ContentHolder>();

            foreach (PathInfo pathInfo in pathInfos)
            {
                Collection <IContentWriter> writer = null;
                try
                {
                    writer = base.InvokeProvider.Content.GetWriter(pathInfo.Path, currentCommandContext);
                }
                catch (PSNotSupportedException pSNotSupportedException1)
                {
                    PSNotSupportedException pSNotSupportedException = pSNotSupportedException1;
                    base.WriteError(new ErrorRecord(pSNotSupportedException.ErrorRecord, pSNotSupportedException));
                    continue;
                }
                catch (DriveNotFoundException driveNotFoundException1)
                {
                    DriveNotFoundException driveNotFoundException = driveNotFoundException1;
                    base.WriteError(new ErrorRecord(driveNotFoundException.ErrorRecord, driveNotFoundException));
                    continue;
                }
                catch (ProviderNotFoundException providerNotFoundException1)
                {
                    ProviderNotFoundException providerNotFoundException = providerNotFoundException1;
                    base.WriteError(new ErrorRecord(providerNotFoundException.ErrorRecord, providerNotFoundException));
                    continue;
                }
                catch (ItemNotFoundException itemNotFoundException1)
                {
                    ItemNotFoundException itemNotFoundException = itemNotFoundException1;
                    base.WriteError(new ErrorRecord(itemNotFoundException.ErrorRecord, itemNotFoundException));
                    continue;
                }
                if (writer == null || writer.Count <= 0 || writer.Count != 1 || writer[0] == null)
                {
                    continue;
                }
                ContentCommandBase.ContentHolder contentHolder = new ContentCommandBase.ContentHolder(pathInfo, null, writer[0]);
                contentHolders.Add(contentHolder);
            }
            return(contentHolders);
        }
Esempio n. 18
0
 protected override void ProcessRecord()
 {
     base.SessionState.Path.PushCurrentLocation(this.stackName);
     if (this.Path != null)
     {
         try
         {
             PathInfo pathInfo = base.SessionState.Path.SetLocation(this.Path, this.CmdletProviderContext);
             if (this.PassThru)
             {
                 base.WriteObject(pathInfo);
             }
         }
         catch (PSNotSupportedException pSNotSupportedException1)
         {
             PSNotSupportedException pSNotSupportedException = pSNotSupportedException1;
             base.WriteError(new ErrorRecord(pSNotSupportedException.ErrorRecord, pSNotSupportedException));
         }
         catch (DriveNotFoundException driveNotFoundException1)
         {
             DriveNotFoundException driveNotFoundException = driveNotFoundException1;
             base.WriteError(new ErrorRecord(driveNotFoundException.ErrorRecord, driveNotFoundException));
         }
         catch (ProviderNotFoundException providerNotFoundException1)
         {
             ProviderNotFoundException providerNotFoundException = providerNotFoundException1;
             base.WriteError(new ErrorRecord(providerNotFoundException.ErrorRecord, providerNotFoundException));
         }
         catch (ItemNotFoundException itemNotFoundException1)
         {
             ItemNotFoundException itemNotFoundException = itemNotFoundException1;
             base.WriteError(new ErrorRecord(itemNotFoundException.ErrorRecord, itemNotFoundException));
         }
         catch (PSArgumentException pSArgumentException1)
         {
             PSArgumentException pSArgumentException = pSArgumentException1;
             base.WriteError(new ErrorRecord(pSArgumentException.ErrorRecord, pSArgumentException));
         }
     }
 }
Esempio n. 19
0
 protected override void ProcessRecord()
 {
     if (this.paths == null || this.paths != null && (int)this.paths.Length == 0)
     {
         string[] empty = new string[1];
         empty[0]   = string.Empty;
         this.paths = empty;
     }
     string[] strArrays = this.paths;
     for (int i = 0; i < (int)strArrays.Length; i++)
     {
         string str = strArrays[i];
         try
         {
             base.InvokeProvider.Item.New(str, this.Name, this.ItemType, this.Value, this.CmdletProviderContext);
         }
         catch (PSNotSupportedException pSNotSupportedException1)
         {
             PSNotSupportedException pSNotSupportedException = pSNotSupportedException1;
             base.WriteError(new ErrorRecord(pSNotSupportedException.ErrorRecord, pSNotSupportedException));
         }
         catch (DriveNotFoundException driveNotFoundException1)
         {
             DriveNotFoundException driveNotFoundException = driveNotFoundException1;
             base.WriteError(new ErrorRecord(driveNotFoundException.ErrorRecord, driveNotFoundException));
         }
         catch (ProviderNotFoundException providerNotFoundException1)
         {
             ProviderNotFoundException providerNotFoundException = providerNotFoundException1;
             base.WriteError(new ErrorRecord(providerNotFoundException.ErrorRecord, providerNotFoundException));
         }
         catch (ItemNotFoundException itemNotFoundException1)
         {
             ItemNotFoundException itemNotFoundException = itemNotFoundException1;
             base.WriteError(new ErrorRecord(itemNotFoundException.ErrorRecord, itemNotFoundException));
         }
     }
 }
Esempio n. 20
0
        protected override void ProcessRecord()
        {
            CmdletProviderContext cmdletProviderContext;
            Collection <PathInfo> resolvedPSPathFromPSPath;
            StringCollection      stringCollections = new StringCollection();

            if (!this.resolve)
            {
                stringCollections.AddRange(this.Path);
            }
            else
            {
                cmdletProviderContext = this.CmdletProviderContext;
                string[] strArrays = this.paths;
                for (int i = 0; i < (int)strArrays.Length; i++)
                {
                    string str = strArrays[i];
                    resolvedPSPathFromPSPath = null;
                    try
                    {
                        resolvedPSPathFromPSPath = base.SessionState.Path.GetResolvedPSPathFromPSPath(str, cmdletProviderContext);
                        goto Label0;
                    }
                    catch (PSNotSupportedException pSNotSupportedException1)
                    {
                        PSNotSupportedException pSNotSupportedException = pSNotSupportedException1;
                        base.WriteError(new ErrorRecord(pSNotSupportedException.ErrorRecord, pSNotSupportedException));
                    }
                    catch (DriveNotFoundException driveNotFoundException1)
                    {
                        DriveNotFoundException driveNotFoundException = driveNotFoundException1;
                        base.WriteError(new ErrorRecord(driveNotFoundException.ErrorRecord, driveNotFoundException));
                    }
                    catch (ProviderNotFoundException providerNotFoundException1)
                    {
                        ProviderNotFoundException providerNotFoundException = providerNotFoundException1;
                        base.WriteError(new ErrorRecord(providerNotFoundException.ErrorRecord, providerNotFoundException));
                    }
                    catch (ItemNotFoundException itemNotFoundException1)
                    {
                        ItemNotFoundException itemNotFoundException = itemNotFoundException1;
                        base.WriteError(new ErrorRecord(itemNotFoundException.ErrorRecord, itemNotFoundException));
                    }
                }
            }
Label3:
            int num = 0;

            while (num < stringCollections.Count)
            {
                string empty            = null;
                string parameterSetName = base.ParameterSetName;
                string str1             = parameterSetName;
                if (parameterSetName != null)
                {
                    if (str1 == "IsAbsoluteSet")
                    {
                        string str2 = null;
                        bool   flag = base.SessionState.Path.IsPSAbsolute(stringCollections[num], out str2);
                        base.WriteObject(flag);
                        goto Label1;
                    }
                    else if (str1 == "QualifierSet")
                    {
                        int num1 = stringCollections[num].IndexOf(":", StringComparison.CurrentCulture);
                        if (num1 >= 0)
                        {
                            if (!base.SessionState.Path.IsProviderQualified(stringCollections[num]))
                            {
                                empty = stringCollections[num].Substring(0, num1 + 1);
                                goto Label2;
                            }
                            else
                            {
                                empty = stringCollections[num].Substring(0, num1 + 2);
                                goto Label2;
                            }
                        }
                        else
                        {
                            FormatException formatException = new FormatException(StringUtil.Format(NavigationResources.ParsePathFormatError, stringCollections[num]));
                            base.WriteError(new ErrorRecord(formatException, "ParsePathFormatError", ErrorCategory.InvalidArgument, stringCollections[num]));
                            goto Label1;
                        }
                    }
                    else if (str1 == "ParentSet" || str1 == "LiteralPathSet")
                    {
                        if (!stringCollections[num].StartsWith("\\", StringComparison.CurrentCulture))
                        {
                            stringCollections[num].StartsWith("/", StringComparison.CurrentCulture);
                        }
                        try
                        {
                            empty = base.SessionState.Path.ParseParent(stringCollections[num], string.Empty, this.CmdletProviderContext, true);
                            goto Label2;
                        }
                        catch (PSNotSupportedException pSNotSupportedException2)
                        {
                            empty = string.Empty;
                            goto Label2;
                        }
                    }
                    else if (str1 == "LeafSet")
                    {
                        try
                        {
                            empty = base.SessionState.Path.ParseChildName(stringCollections[num], this.CmdletProviderContext, true);
                            goto Label2;
                        }
                        catch (PSNotSupportedException pSNotSupportedException3)
                        {
                            empty = stringCollections[num];
                            goto Label2;
                        }
                        catch (DriveNotFoundException driveNotFoundException3)
                        {
                            DriveNotFoundException driveNotFoundException2 = driveNotFoundException3;
                            base.WriteError(new ErrorRecord(driveNotFoundException2.ErrorRecord, driveNotFoundException2));
                            goto Label1;
                        }
                        catch (ProviderNotFoundException providerNotFoundException3)
                        {
                            ProviderNotFoundException providerNotFoundException2 = providerNotFoundException3;
                            base.WriteError(new ErrorRecord(providerNotFoundException2.ErrorRecord, providerNotFoundException2));
                            goto Label1;
                        }
                    }
                    else if (str1 == "NoQualifierSet")
                    {
                        empty = this.RemoveQualifier(stringCollections[num]);
                        goto Label2;
                    }
                }
Label2:
                if (empty != null)
                {
                    base.WriteObject(empty);
                }
Label1:
                num++;
            }
            return;

Label0:
            IEnumerator <PathInfo> enumerator = resolvedPSPathFromPSPath.GetEnumerator();

            using (enumerator)
            {
                while (enumerator.MoveNext())
                {
                    PathInfo current = enumerator.Current;
                    try
                    {
                        if (base.InvokeProvider.Item.Exists(current.Path, cmdletProviderContext))
                        {
                            stringCollections.Add(current.Path);
                        }
                    }
                    catch (PSNotSupportedException pSNotSupportedException5)
                    {
                        PSNotSupportedException pSNotSupportedException4 = pSNotSupportedException5;
                        base.WriteError(new ErrorRecord(pSNotSupportedException4.ErrorRecord, pSNotSupportedException4));
                    }
                    catch (DriveNotFoundException driveNotFoundException5)
                    {
                        DriveNotFoundException driveNotFoundException4 = driveNotFoundException5;
                        base.WriteError(new ErrorRecord(driveNotFoundException4.ErrorRecord, driveNotFoundException4));
                    }
                    catch (ProviderNotFoundException providerNotFoundException5)
                    {
                        ProviderNotFoundException providerNotFoundException4 = providerNotFoundException5;
                        base.WriteError(new ErrorRecord(providerNotFoundException4.ErrorRecord, providerNotFoundException4));
                    }
                    catch (ItemNotFoundException itemNotFoundException3)
                    {
                        ItemNotFoundException itemNotFoundException2 = itemNotFoundException3;
                        base.WriteError(new ErrorRecord(itemNotFoundException2.ErrorRecord, itemNotFoundException2));
                    }
                }
                goto Label3;
            }
        }
Esempio n. 21
0
        internal Collection <PathInfo> ResolvePaths(string[] pathsToResolve, bool allowNonexistingPaths, bool allowEmptyResult, CmdletProviderContext currentCommandContext)
        {
            Collection <PathInfo> pathInfos = new Collection <PathInfo>();

            string[] strArrays = pathsToResolve;
            for (int i = 0; i < (int)strArrays.Length; i++)
            {
                string      str         = strArrays[i];
                bool        flag        = false;
                bool        flag1       = false;
                ErrorRecord errorRecord = null;
                try
                {
                    Collection <PathInfo> resolvedPSPathFromPSPath = base.SessionState.Path.GetResolvedPSPathFromPSPath(str, currentCommandContext);
                    if (resolvedPSPathFromPSPath.Count == 0)
                    {
                        flag = true;
                        if (!currentCommandContext.SuppressWildcardExpansion)
                        {
                            flag1 = true;
                        }
                    }
                    foreach (PathInfo pathInfo in resolvedPSPathFromPSPath)
                    {
                        pathInfos.Add(pathInfo);
                    }
                }
                catch (PSNotSupportedException pSNotSupportedException1)
                {
                    PSNotSupportedException pSNotSupportedException = pSNotSupportedException1;
                    base.WriteError(new ErrorRecord(pSNotSupportedException.ErrorRecord, pSNotSupportedException));
                }
                catch (DriveNotFoundException driveNotFoundException1)
                {
                    DriveNotFoundException driveNotFoundException = driveNotFoundException1;
                    base.WriteError(new ErrorRecord(driveNotFoundException.ErrorRecord, driveNotFoundException));
                }
                catch (ProviderNotFoundException providerNotFoundException1)
                {
                    ProviderNotFoundException providerNotFoundException = providerNotFoundException1;
                    base.WriteError(new ErrorRecord(providerNotFoundException.ErrorRecord, providerNotFoundException));
                }
                catch (ItemNotFoundException itemNotFoundException1)
                {
                    ItemNotFoundException itemNotFoundException = itemNotFoundException1;
                    flag        = true;
                    errorRecord = new ErrorRecord(itemNotFoundException.ErrorRecord, itemNotFoundException);
                }
                if (flag)
                {
                    if (!allowNonexistingPaths || flag1 || !currentCommandContext.SuppressWildcardExpansion && WildcardPattern.ContainsWildcardCharacters(str))
                    {
                        if (errorRecord == null)
                        {
                            string    str1      = StringUtil.Format(NavigationResources.ItemNotFound, this.Path);
                            Exception exception = new Exception(str1);
                            errorRecord = new ErrorRecord(exception, "ItemNotFound", ErrorCategory.ObjectNotFound, this.Path);
                        }
                        base.WriteError(errorRecord);
                    }
                    else
                    {
                        ProviderInfo providerInfo = null;
                        PSDriveInfo  pSDriveInfo  = null;
                        string       unresolvedProviderPathFromPSPath = base.SessionState.Path.GetUnresolvedProviderPathFromPSPath(str, currentCommandContext, out providerInfo, out pSDriveInfo);
                        PathInfo     pathInfo1 = new PathInfo(pSDriveInfo, providerInfo, unresolvedProviderPathFromPSPath, base.SessionState);
                        pathInfos.Add(pathInfo1);
                    }
                }
            }
            return(pathInfos);
        }
Esempio n. 22
0
        /// <summary>
        /// Connect all disconnected sessions.
        /// </summary>
        private void ConnectSessions(Collection <PSSession> psSessions)
        {
            List <IThrottleOperation> connectOperations = new List <IThrottleOperation>();

            // Create a disconnect operation for each runspace to disconnect.
            foreach (PSSession psSession in psSessions)
            {
                if (ShouldProcess(psSession.Name, VerbsCommunications.Connect))
                {
                    if (psSession.ComputerType != TargetMachineType.RemoteMachine)
                    {
                        // PS session disconnection is not supported for VM/Container sessions.
                        string msg = StringUtil.Format(RemotingErrorIdStrings.RunspaceCannotBeConnectedForVMContainerSession,
                                                       psSession.Name, psSession.ComputerName, psSession.ComputerType);
                        Exception   reason      = new PSNotSupportedException(msg);
                        ErrorRecord errorRecord = new ErrorRecord(reason, "CannotConnectVMContainerSession", ErrorCategory.InvalidOperation, psSession);
                        WriteError(errorRecord);
                    }
                    else if (psSession.Runspace.RunspaceStateInfo.State == RunspaceState.Disconnected &&
                             psSession.Runspace.RunspaceAvailability == RunspaceAvailability.None)
                    {
                        // Can only connect sessions that are in Disconnected state.
                        // Update session connection information based on cmdlet parameters.
                        UpdateConnectionInfo(psSession.Runspace.ConnectionInfo as WSManConnectionInfo);

                        ConnectRunspaceOperation connectOperation = new ConnectRunspaceOperation(
                            psSession,
                            _stream,
                            this.Host,
                            null,
                            _failedSessions);
                        connectOperations.Add(connectOperation);
                    }
                    else if (psSession.Runspace.RunspaceStateInfo.State != RunspaceState.Opened)
                    {
                        // Write error record if runspace is not already in the Opened state.
                        string      msg         = StringUtil.Format(RemotingErrorIdStrings.RunspaceCannotBeConnected, psSession.Name);
                        Exception   reason      = new RuntimeException(msg);
                        ErrorRecord errorRecord = new ErrorRecord(reason, "PSSessionConnectFailed", ErrorCategory.InvalidOperation, psSession);
                        WriteError(errorRecord);
                    }
                    else
                    {
                        // Session is already connected.  Write to output.
                        WriteObject(psSession);
                    }
                }

                _allSessions.Add(psSession);
            }

            if (connectOperations.Count > 0)
            {
                // Make sure operations are not set as complete while processing input.
                _operationsComplete.Reset();

                // Submit list of connect operations.
                _throttleManager.SubmitOperations(connectOperations);

                // Write any output now.
                Collection <object> streamObjects = _stream.ObjectReader.NonBlockingRead();
                foreach (object streamObject in streamObjects)
                {
                    WriteStreamObject((Action <Cmdlet>)streamObject);
                }
            }
        }
Esempio n. 23
0
        protected override void ProcessRecord()
        {
            CmdletProviderContext cmdletProviderContext = this.CmdletProviderContext;

            try
            {
                if (!base.InvokeProvider.Item.Exists(this.Path, cmdletProviderContext))
                {
                    object[] path = new object[1];
                    path[0] = this.Path;
                    PSInvalidOperationException pSInvalidOperationException = PSTraceSource.NewInvalidOperationException("NavigationResources", "RenameItemDoesntExist", path);
                    base.WriteError(new ErrorRecord(pSInvalidOperationException.ErrorRecord, pSInvalidOperationException));
                    return;
                }
            }
            catch (PSNotSupportedException pSNotSupportedException1)
            {
                PSNotSupportedException pSNotSupportedException = pSNotSupportedException1;
                base.WriteError(new ErrorRecord(pSNotSupportedException.ErrorRecord, pSNotSupportedException));
                return;
            }
            catch (DriveNotFoundException driveNotFoundException1)
            {
                DriveNotFoundException driveNotFoundException = driveNotFoundException1;
                base.WriteError(new ErrorRecord(driveNotFoundException.ErrorRecord, driveNotFoundException));
                return;
            }
            catch (ProviderNotFoundException providerNotFoundException1)
            {
                ProviderNotFoundException providerNotFoundException = providerNotFoundException1;
                base.WriteError(new ErrorRecord(providerNotFoundException.ErrorRecord, providerNotFoundException));
                return;
            }
            catch (ItemNotFoundException itemNotFoundException1)
            {
                ItemNotFoundException itemNotFoundException = itemNotFoundException1;
                base.WriteError(new ErrorRecord(itemNotFoundException.ErrorRecord, itemNotFoundException));
                return;
            }
            bool flag = false;

            try
            {
                flag = base.SessionState.Path.IsCurrentLocationOrAncestor(this.path, cmdletProviderContext);
            }
            catch (PSNotSupportedException pSNotSupportedException3)
            {
                PSNotSupportedException pSNotSupportedException2 = pSNotSupportedException3;
                base.WriteError(new ErrorRecord(pSNotSupportedException2.ErrorRecord, pSNotSupportedException2));
                return;
            }
            catch (DriveNotFoundException driveNotFoundException3)
            {
                DriveNotFoundException driveNotFoundException2 = driveNotFoundException3;
                base.WriteError(new ErrorRecord(driveNotFoundException2.ErrorRecord, driveNotFoundException2));
                return;
            }
            catch (ProviderNotFoundException providerNotFoundException3)
            {
                ProviderNotFoundException providerNotFoundException2 = providerNotFoundException3;
                base.WriteError(new ErrorRecord(providerNotFoundException2.ErrorRecord, providerNotFoundException2));
                return;
            }
            catch (ItemNotFoundException itemNotFoundException3)
            {
                ItemNotFoundException itemNotFoundException2 = itemNotFoundException3;
                base.WriteError(new ErrorRecord(itemNotFoundException2.ErrorRecord, itemNotFoundException2));
                return;
            }
            if (!flag)
            {
                cmdletProviderContext.PassThru = this.PassThru;
                object[] newName = new object[2];
                newName[0] = this.Path;
                newName[1] = this.NewName;
                CoreCommandBase.tracer.WriteLine("Rename {0} to {1}", newName);
                try
                {
                    base.InvokeProvider.Item.Rename(this.Path, this.NewName, cmdletProviderContext);
                }
                catch (PSNotSupportedException pSNotSupportedException5)
                {
                    PSNotSupportedException pSNotSupportedException4 = pSNotSupportedException5;
                    base.WriteError(new ErrorRecord(pSNotSupportedException4.ErrorRecord, pSNotSupportedException4));
                    return;
                }
                catch (DriveNotFoundException driveNotFoundException5)
                {
                    DriveNotFoundException driveNotFoundException4 = driveNotFoundException5;
                    base.WriteError(new ErrorRecord(driveNotFoundException4.ErrorRecord, driveNotFoundException4));
                    return;
                }
                catch (ProviderNotFoundException providerNotFoundException5)
                {
                    ProviderNotFoundException providerNotFoundException4 = providerNotFoundException5;
                    base.WriteError(new ErrorRecord(providerNotFoundException4.ErrorRecord, providerNotFoundException4));
                    return;
                }
                catch (ItemNotFoundException itemNotFoundException5)
                {
                    ItemNotFoundException itemNotFoundException4 = itemNotFoundException5;
                    base.WriteError(new ErrorRecord(itemNotFoundException4.ErrorRecord, itemNotFoundException4));
                    return;
                }
                return;
            }
            else
            {
                object[] objArray = new object[1];
                objArray[0] = this.Path;
                PSInvalidOperationException pSInvalidOperationException1 = PSTraceSource.NewInvalidOperationException("NavigationResources", "RenamedItemInUse", objArray);
                base.WriteError(new ErrorRecord(pSInvalidOperationException1.ErrorRecord, pSInvalidOperationException1));
            }
        }
Esempio n. 24
0
        protected override void ProcessRecord()
        {
            ProviderInfo singleProvider = null;

            try
            {
                singleProvider = base.SessionState.Internal.GetSingleProvider(this.PSProvider);
            }
            catch (ProviderNotFoundException providerNotFoundException1)
            {
                ProviderNotFoundException providerNotFoundException = providerNotFoundException1;
                base.WriteError(new ErrorRecord(providerNotFoundException.ErrorRecord, providerNotFoundException));
                return;
            }
            if (singleProvider != null)
            {
                string   newDriveConfirmAction           = NavigationResources.NewDriveConfirmAction;
                string   newDriveConfirmResourceTemplate = NavigationResources.NewDriveConfirmResourceTemplate;
                object[] name = new object[3];
                name[0] = this.Name;
                name[1] = singleProvider.FullName;
                name[2] = this.Root;
                string str = string.Format(Thread.CurrentThread.CurrentCulture, newDriveConfirmResourceTemplate, name);
                if (base.ShouldProcess(str, newDriveConfirmAction))
                {
                    if (this.Persist && !singleProvider.Name.Equals("FileSystem", StringComparison.OrdinalIgnoreCase))
                    {
                        ErrorRecord errorRecord = new ErrorRecord(new NotSupportedException(FileSystemProviderStrings.PersistNotSupported), "DriveRootNotNetworkPath", ErrorCategory.InvalidArgument, this);
                        base.ThrowTerminatingError(errorRecord);
                    }
                    PSDriveInfo pSDriveInfo = new PSDriveInfo(this.Name, singleProvider, this.Root, this.Description, base.Credential, this.Persist);
                    try
                    {
                        base.SessionState.Drive.New(pSDriveInfo, this.Scope, this.CmdletProviderContext);
                    }
                    catch (PSNotSupportedException pSNotSupportedException1)
                    {
                        PSNotSupportedException pSNotSupportedException = pSNotSupportedException1;
                        base.WriteError(new ErrorRecord(pSNotSupportedException.ErrorRecord, pSNotSupportedException));
                    }
                    catch (DriveNotFoundException driveNotFoundException1)
                    {
                        DriveNotFoundException driveNotFoundException = driveNotFoundException1;
                        base.WriteError(new ErrorRecord(driveNotFoundException.ErrorRecord, driveNotFoundException));
                    }
                    catch (ProviderNotFoundException providerNotFoundException3)
                    {
                        ProviderNotFoundException providerNotFoundException2 = providerNotFoundException3;
                        base.WriteError(new ErrorRecord(providerNotFoundException2.ErrorRecord, providerNotFoundException2));
                    }
                    catch (PSArgumentException pSArgumentException1)
                    {
                        PSArgumentException pSArgumentException = pSArgumentException1;
                        base.WriteError(new ErrorRecord(pSArgumentException.ErrorRecord, pSArgumentException));
                    }
                    catch (ItemNotFoundException itemNotFoundException1)
                    {
                        ItemNotFoundException itemNotFoundException = itemNotFoundException1;
                        base.WriteError(new ErrorRecord(itemNotFoundException.ErrorRecord, itemNotFoundException));
                    }
                    catch (SessionStateOverflowException sessionStateOverflowException)
                    {
                        throw;
                    }
                    catch (SessionStateException sessionStateException1)
                    {
                        SessionStateException sessionStateException = sessionStateException1;
                        base.WriteError(new ErrorRecord(sessionStateException.ErrorRecord, sessionStateException));
                    }
                }
            }
        }
Esempio n. 25
0
        private void MoveItem(string path)
        {
            CmdletProviderContext cmdletProviderContext = this.CmdletProviderContext;

            try
            {
                string str = path;
                if (!base.SuppressWildcardExpansion)
                {
                    str = WildcardPattern.Escape(path);
                }
                if (!base.InvokeProvider.Item.Exists(str, cmdletProviderContext))
                {
                    object[] objArray = new object[1];
                    objArray[0] = path;
                    PSInvalidOperationException pSInvalidOperationException = PSTraceSource.NewInvalidOperationException("NavigationResources", "MoveItemDoesntExist", objArray);
                    base.WriteError(new ErrorRecord(pSInvalidOperationException.ErrorRecord, pSInvalidOperationException));
                    return;
                }
            }
            catch (PSNotSupportedException pSNotSupportedException1)
            {
                PSNotSupportedException pSNotSupportedException = pSNotSupportedException1;
                base.WriteError(new ErrorRecord(pSNotSupportedException.ErrorRecord, pSNotSupportedException));
                return;
            }
            catch (DriveNotFoundException driveNotFoundException1)
            {
                DriveNotFoundException driveNotFoundException = driveNotFoundException1;
                base.WriteError(new ErrorRecord(driveNotFoundException.ErrorRecord, driveNotFoundException));
                return;
            }
            catch (ProviderNotFoundException providerNotFoundException1)
            {
                ProviderNotFoundException providerNotFoundException = providerNotFoundException1;
                base.WriteError(new ErrorRecord(providerNotFoundException.ErrorRecord, providerNotFoundException));
                return;
            }
            catch (ItemNotFoundException itemNotFoundException1)
            {
                ItemNotFoundException itemNotFoundException = itemNotFoundException1;
                base.WriteError(new ErrorRecord(itemNotFoundException.ErrorRecord, itemNotFoundException));
                return;
            }
            bool flag = false;

            try
            {
                flag = base.SessionState.Path.IsCurrentLocationOrAncestor(path, cmdletProviderContext);
            }
            catch (PSNotSupportedException pSNotSupportedException3)
            {
                PSNotSupportedException pSNotSupportedException2 = pSNotSupportedException3;
                base.WriteError(new ErrorRecord(pSNotSupportedException2.ErrorRecord, pSNotSupportedException2));
                return;
            }
            catch (DriveNotFoundException driveNotFoundException3)
            {
                DriveNotFoundException driveNotFoundException2 = driveNotFoundException3;
                base.WriteError(new ErrorRecord(driveNotFoundException2.ErrorRecord, driveNotFoundException2));
                return;
            }
            catch (ProviderNotFoundException providerNotFoundException3)
            {
                ProviderNotFoundException providerNotFoundException2 = providerNotFoundException3;
                base.WriteError(new ErrorRecord(providerNotFoundException2.ErrorRecord, providerNotFoundException2));
                return;
            }
            catch (ItemNotFoundException itemNotFoundException3)
            {
                ItemNotFoundException itemNotFoundException2 = itemNotFoundException3;
                base.WriteError(new ErrorRecord(itemNotFoundException2.ErrorRecord, itemNotFoundException2));
                return;
            }
            if (!flag)
            {
                CmdletProviderContext passThru = cmdletProviderContext;
                passThru.PassThru = this.PassThru;
                object[] destination = new object[2];
                destination[0] = path;
                destination[1] = this.Destination;
                CoreCommandBase.tracer.WriteLine("Moving {0} to {1}", destination);
                try
                {
                    string str1 = path;
                    if (!base.SuppressWildcardExpansion)
                    {
                        str1 = WildcardPattern.Escape(path);
                    }
                    base.InvokeProvider.Item.Move(str1, this.Destination, passThru);
                }
                catch (PSNotSupportedException pSNotSupportedException5)
                {
                    PSNotSupportedException pSNotSupportedException4 = pSNotSupportedException5;
                    base.WriteError(new ErrorRecord(pSNotSupportedException4.ErrorRecord, pSNotSupportedException4));
                }
                catch (DriveNotFoundException driveNotFoundException5)
                {
                    DriveNotFoundException driveNotFoundException4 = driveNotFoundException5;
                    base.WriteError(new ErrorRecord(driveNotFoundException4.ErrorRecord, driveNotFoundException4));
                }
                catch (ProviderNotFoundException providerNotFoundException5)
                {
                    ProviderNotFoundException providerNotFoundException4 = providerNotFoundException5;
                    base.WriteError(new ErrorRecord(providerNotFoundException4.ErrorRecord, providerNotFoundException4));
                }
                catch (ItemNotFoundException itemNotFoundException5)
                {
                    ItemNotFoundException itemNotFoundException4 = itemNotFoundException5;
                    base.WriteError(new ErrorRecord(itemNotFoundException4.ErrorRecord, itemNotFoundException4));
                }
            }
            else
            {
                object[] objArray1 = new object[1];
                objArray1[0] = path;
                PSInvalidOperationException pSInvalidOperationException1 = PSTraceSource.NewInvalidOperationException("NavigationResources", "MoveItemInUse", objArray1);
                base.WriteError(new ErrorRecord(pSInvalidOperationException1.ErrorRecord, pSInvalidOperationException1));
                return;
            }
        }
Esempio n. 26
0
        protected override void ProcessRecord()
        {
            Collection <PathInfo> resolvedPSPathFromPSPath;
            CmdletProviderContext cmdletProviderContext = this.CmdletProviderContext;
            bool flag  = false;
            bool flag1 = false;

            string[] path = this.Path;
            for (int i = 0; i < (int)path.Length; i++)
            {
                string str = path[i];
                resolvedPSPathFromPSPath = null;
                try
                {
                    resolvedPSPathFromPSPath = base.SessionState.Path.GetResolvedPSPathFromPSPath(str, cmdletProviderContext);
                    goto Label0;
                }
                catch (PSNotSupportedException pSNotSupportedException1)
                {
                    PSNotSupportedException pSNotSupportedException = pSNotSupportedException1;
                    base.WriteError(new ErrorRecord(pSNotSupportedException.ErrorRecord, pSNotSupportedException));
                }
                catch (DriveNotFoundException driveNotFoundException1)
                {
                    DriveNotFoundException driveNotFoundException = driveNotFoundException1;
                    base.WriteError(new ErrorRecord(driveNotFoundException.ErrorRecord, driveNotFoundException));
                }
                catch (ProviderNotFoundException providerNotFoundException1)
                {
                    ProviderNotFoundException providerNotFoundException = providerNotFoundException1;
                    base.WriteError(new ErrorRecord(providerNotFoundException.ErrorRecord, providerNotFoundException));
                }
                catch (ItemNotFoundException itemNotFoundException1)
                {
                    ItemNotFoundException itemNotFoundException = itemNotFoundException1;
                    base.WriteError(new ErrorRecord(itemNotFoundException.ErrorRecord, itemNotFoundException));
                }
            }
            return;

Label0:
            IEnumerator <PathInfo> enumerator = resolvedPSPathFromPSPath.GetEnumerator();

            using (enumerator)
            {
                while (enumerator.MoveNext())
                {
                    PathInfo current = enumerator.Current;
                    bool     flag2   = false;
                    try
                    {
                        flag2 = base.SessionState.Path.IsCurrentLocationOrAncestor(current.Path, cmdletProviderContext);
                    }
                    catch (PSNotSupportedException pSNotSupportedException3)
                    {
                        PSNotSupportedException pSNotSupportedException2 = pSNotSupportedException3;
                        base.WriteError(new ErrorRecord(pSNotSupportedException2.ErrorRecord, pSNotSupportedException2));
                        continue;
                    }
                    catch (DriveNotFoundException driveNotFoundException3)
                    {
                        DriveNotFoundException driveNotFoundException2 = driveNotFoundException3;
                        base.WriteError(new ErrorRecord(driveNotFoundException2.ErrorRecord, driveNotFoundException2));
                        continue;
                    }
                    catch (ProviderNotFoundException providerNotFoundException3)
                    {
                        ProviderNotFoundException providerNotFoundException2 = providerNotFoundException3;
                        base.WriteError(new ErrorRecord(providerNotFoundException2.ErrorRecord, providerNotFoundException2));
                        continue;
                    }
                    catch (ItemNotFoundException itemNotFoundException3)
                    {
                        ItemNotFoundException itemNotFoundException2 = itemNotFoundException3;
                        base.WriteError(new ErrorRecord(itemNotFoundException2.ErrorRecord, itemNotFoundException2));
                        continue;
                    }
                    if (!flag2)
                    {
                        bool   flag3 = false;
                        string unresolvedProviderPathFromPSPath = base.GetUnresolvedProviderPathFromPSPath(current.Path);
                        try
                        {
                            flag3 = base.SessionState.Internal.HasChildItems(current.Provider.Name, unresolvedProviderPathFromPSPath, cmdletProviderContext);
                            cmdletProviderContext.ThrowFirstErrorOrDoNothing();
                        }
                        catch (PSNotSupportedException pSNotSupportedException5)
                        {
                            PSNotSupportedException pSNotSupportedException4 = pSNotSupportedException5;
                            base.WriteError(new ErrorRecord(pSNotSupportedException4.ErrorRecord, pSNotSupportedException4));
                            continue;
                        }
                        catch (DriveNotFoundException driveNotFoundException5)
                        {
                            DriveNotFoundException driveNotFoundException4 = driveNotFoundException5;
                            base.WriteError(new ErrorRecord(driveNotFoundException4.ErrorRecord, driveNotFoundException4));
                            continue;
                        }
                        catch (ProviderNotFoundException providerNotFoundException5)
                        {
                            ProviderNotFoundException providerNotFoundException4 = providerNotFoundException5;
                            base.WriteError(new ErrorRecord(providerNotFoundException4.ErrorRecord, providerNotFoundException4));
                            continue;
                        }
                        catch (ItemNotFoundException itemNotFoundException5)
                        {
                            ItemNotFoundException itemNotFoundException4 = itemNotFoundException5;
                            base.WriteError(new ErrorRecord(itemNotFoundException4.ErrorRecord, itemNotFoundException4));
                            continue;
                        }
                        if (!this.Recurse && flag3)
                        {
                            string str1 = StringUtil.Format(NavigationResources.RemoveItemWithChildren, current.Path);
                            if (!base.ShouldContinue(str1, null, ref flag, ref flag1))
                            {
                                continue;
                            }
                        }
                        try
                        {
                            base.SessionState.Internal.RemoveItem(current.Provider.Name, unresolvedProviderPathFromPSPath, this.Recurse, cmdletProviderContext);
                        }
                        catch (PSNotSupportedException pSNotSupportedException7)
                        {
                            PSNotSupportedException pSNotSupportedException6 = pSNotSupportedException7;
                            base.WriteError(new ErrorRecord(pSNotSupportedException6.ErrorRecord, pSNotSupportedException6));
                        }
                        catch (DriveNotFoundException driveNotFoundException7)
                        {
                            DriveNotFoundException driveNotFoundException6 = driveNotFoundException7;
                            base.WriteError(new ErrorRecord(driveNotFoundException6.ErrorRecord, driveNotFoundException6));
                        }
                        catch (ProviderNotFoundException providerNotFoundException7)
                        {
                            ProviderNotFoundException providerNotFoundException6 = providerNotFoundException7;
                            base.WriteError(new ErrorRecord(providerNotFoundException6.ErrorRecord, providerNotFoundException6));
                        }
                        catch (ItemNotFoundException itemNotFoundException7)
                        {
                            ItemNotFoundException itemNotFoundException6 = itemNotFoundException7;
                            base.WriteError(new ErrorRecord(itemNotFoundException6.ErrorRecord, itemNotFoundException6));
                        }
                    }
                    else
                    {
                        object[] objArray = new object[1];
                        objArray[0] = current.Path;
                        PSInvalidOperationException pSInvalidOperationException = PSTraceSource.NewInvalidOperationException("NavigationResources", "RemoveItemInUse", objArray);
                        base.WriteError(new ErrorRecord(pSInvalidOperationException.ErrorRecord, pSInvalidOperationException));
                    }
                }
                return;
            }
        }
Esempio n. 27
0
        protected override void ProcessRecord()
        {
            object obj = null;
            string parameterSetName = base.ParameterSetName;
            string str = parameterSetName;

            if (parameterSetName != null)
            {
                if (str == "Path" || str == "LiteralPath")
                {
                    try
                    {
                        obj = base.SessionState.Path.SetLocation(this.Path, this.CmdletProviderContext);
                    }
                    catch (PSNotSupportedException pSNotSupportedException1)
                    {
                        PSNotSupportedException pSNotSupportedException = pSNotSupportedException1;
                        base.WriteError(new ErrorRecord(pSNotSupportedException.ErrorRecord, pSNotSupportedException));
                    }
                    catch (DriveNotFoundException driveNotFoundException1)
                    {
                        DriveNotFoundException driveNotFoundException = driveNotFoundException1;
                        base.WriteError(new ErrorRecord(driveNotFoundException.ErrorRecord, driveNotFoundException));
                    }
                    catch (ProviderNotFoundException providerNotFoundException1)
                    {
                        ProviderNotFoundException providerNotFoundException = providerNotFoundException1;
                        base.WriteError(new ErrorRecord(providerNotFoundException.ErrorRecord, providerNotFoundException));
                    }
                    catch (ItemNotFoundException itemNotFoundException1)
                    {
                        ItemNotFoundException itemNotFoundException = itemNotFoundException1;
                        base.WriteError(new ErrorRecord(itemNotFoundException.ErrorRecord, itemNotFoundException));
                    }
                    catch (PSArgumentException pSArgumentException1)
                    {
                        PSArgumentException pSArgumentException = pSArgumentException1;
                        base.WriteError(new ErrorRecord(pSArgumentException.ErrorRecord, pSArgumentException));
                    }
                }
                else
                {
                    if (str == "Stack")
                    {
                        try
                        {
                            obj = base.SessionState.Path.SetDefaultLocationStack(this.StackName);
                        }
                        catch (ItemNotFoundException itemNotFoundException3)
                        {
                            ItemNotFoundException itemNotFoundException2 = itemNotFoundException3;
                            base.WriteError(new ErrorRecord(itemNotFoundException2.ErrorRecord, itemNotFoundException2));
                        }
                    }
                }
            }
            if (this.passThrough && obj != null)
            {
                base.WriteObject(obj);
            }
        }
Esempio n. 28
0
        /// <summary>
        /// Perform runspace disconnect processing on all input.
        /// </summary>
        protected override void ProcessRecord()
        {
            Dictionary <Guid, PSSession> psSessions;
            List <IThrottleOperation>    disconnectOperations = new List <IThrottleOperation>();

            try
            {
                // Get all remote runspaces to disconnect.
                if (ParameterSetName == DisconnectPSSessionCommand.SessionParameterSet)
                {
                    if (Session == null || Session.Length == 0)
                    {
                        return;
                    }

                    psSessions = new Dictionary <Guid, PSSession>();
                    foreach (PSSession psSession in Session)
                    {
                        psSessions.Add(psSession.InstanceId, psSession);
                    }
                }
                else
                {
                    psSessions = GetMatchingRunspaces(false, true);
                }

                // Look for local sessions that have the EnableNetworkAccess property set and
                // return a string containing all of the session names.  Emit a warning for
                // these sessions.
                string cnNames = GetLocalhostWithNetworkAccessEnabled(psSessions);
                if (!string.IsNullOrEmpty(cnNames))
                {
                    WriteWarning(
                        StringUtil.Format(RemotingErrorIdStrings.EnableNetworkAccessWarning, cnNames));
                }

                // Create a disconnect operation for each runspace to disconnect.
                foreach (PSSession psSession in psSessions.Values)
                {
                    if (ShouldProcess(psSession.Name, VerbsCommunications.Disconnect))
                    {
                        // PS session disconnection is not supported for VM/Container sessions.
                        if (psSession.ComputerType != TargetMachineType.RemoteMachine)
                        {
                            // Write error record.
                            string msg = StringUtil.Format(RemotingErrorIdStrings.RunspaceCannotBeDisconnectedForVMContainerSession,
                                                           psSession.Name, psSession.ComputerName, psSession.ComputerType);
                            Exception   reason      = new PSNotSupportedException(msg);
                            ErrorRecord errorRecord = new ErrorRecord(reason, "CannotDisconnectVMContainerSession", ErrorCategory.InvalidOperation, psSession);
                            WriteError(errorRecord);
                            continue;
                        }

                        // Can only disconnect an Opened runspace.
                        if (psSession.Runspace.RunspaceStateInfo.State == RunspaceState.Opened)
                        {
                            // Update the connectionInfo object with passed in session options.
                            if (_sessionOption != null)
                            {
                                psSession.Runspace.ConnectionInfo.SetSessionOptions(_sessionOption);
                            }

                            // Validate the ConnectionInfo IdleTimeout value against the MaxIdleTimeout
                            // value returned by the server and the hard coded minimum allowed value.
                            if (!ValidateIdleTimeout(psSession))
                            {
                                continue;
                            }

                            DisconnectRunspaceOperation disconnectOperation = new DisconnectRunspaceOperation(psSession, _stream);
                            disconnectOperations.Add(disconnectOperation);
                        }
                        else if (psSession.Runspace.RunspaceStateInfo.State != RunspaceState.Disconnected)
                        {
                            // Write error record.
                            string      msg         = StringUtil.Format(RemotingErrorIdStrings.RunspaceCannotBeDisconnected, psSession.Name);
                            Exception   reason      = new RuntimeException(msg);
                            ErrorRecord errorRecord = new ErrorRecord(reason, "CannotDisconnectSessionWhenNotOpened", ErrorCategory.InvalidOperation, psSession);
                            WriteError(errorRecord);
                        }
                        else
                        {
                            // Session is already disconnected.  Write to output.
                            WriteObject(psSession);
                        }
                    }
                }
            }
            catch (PSRemotingDataStructureException)
            {
                // Allow cmdlet to end and then re-throw exception.
                _operationsComplete.Set();
                throw;
            }
            catch (PSRemotingTransportException)
            {
                // Allow cmdlet to end and then re-throw exception.
                _operationsComplete.Set();
                throw;
            }
            catch (RemoteException)
            {
                // Allow cmdlet to end and then re-throw exception.
                _operationsComplete.Set();
                throw;
            }
            catch (InvalidRunspaceStateException)
            {
                // Allow cmdlet to end and then re-throw exception.
                _operationsComplete.Set();
                throw;
            }

            if (disconnectOperations.Count > 0)
            {
                // Make sure operations are not set as complete while processing input.
                _operationsComplete.Reset();

                // Submit list of disconnect operations.
                _throttleManager.SubmitOperations(disconnectOperations);

                // Write any output now.
                Collection <object> streamObjects = _stream.ObjectReader.NonBlockingRead();
                foreach (object streamObject in streamObjects)
                {
                    WriteStreamObject((Action <Cmdlet>)streamObject);
                }
            }
        }
Esempio n. 29
0
        protected override void ProcessRecord()
        {
            string[] path = this.Path;
            for (int i = 0; i < (int)path.Length; i++)
            {
                string str  = path[i];
                string str1 = null;
                try
                {
                    str1 = base.SessionState.Path.Combine(str, this.ChildPath, this.CmdletProviderContext);
                }
                catch (PSNotSupportedException pSNotSupportedException1)
                {
                    PSNotSupportedException pSNotSupportedException = pSNotSupportedException1;
                    base.WriteError(new ErrorRecord(pSNotSupportedException.ErrorRecord, pSNotSupportedException));
                    goto Label0;
                }
                catch (DriveNotFoundException driveNotFoundException1)
                {
                    DriveNotFoundException driveNotFoundException = driveNotFoundException1;
                    base.WriteError(new ErrorRecord(driveNotFoundException.ErrorRecord, driveNotFoundException));
                    goto Label0;
                }
                catch (ProviderNotFoundException providerNotFoundException1)
                {
                    ProviderNotFoundException providerNotFoundException = providerNotFoundException1;
                    base.WriteError(new ErrorRecord(providerNotFoundException.ErrorRecord, providerNotFoundException));
                    goto Label0;
                }
                catch (ItemNotFoundException itemNotFoundException1)
                {
                    ItemNotFoundException itemNotFoundException = itemNotFoundException1;
                    base.WriteError(new ErrorRecord(itemNotFoundException.ErrorRecord, itemNotFoundException));
                    goto Label0;
                }
                if (!this.Resolve)
                {
                    if (str1 != null)
                    {
                        base.WriteObject(str1);
                    }
                }
                else
                {
                    Collection <PathInfo> resolvedPSPathFromPSPath = null;
                    try
                    {
                        resolvedPSPathFromPSPath = base.SessionState.Path.GetResolvedPSPathFromPSPath(str1, this.CmdletProviderContext);
                    }
                    catch (PSNotSupportedException pSNotSupportedException3)
                    {
                        PSNotSupportedException pSNotSupportedException2 = pSNotSupportedException3;
                        base.WriteError(new ErrorRecord(pSNotSupportedException2.ErrorRecord, pSNotSupportedException2));
                        goto Label0;
                    }
                    catch (DriveNotFoundException driveNotFoundException3)
                    {
                        DriveNotFoundException driveNotFoundException2 = driveNotFoundException3;
                        base.WriteError(new ErrorRecord(driveNotFoundException2.ErrorRecord, driveNotFoundException2));
                        goto Label0;
                    }
                    catch (ProviderNotFoundException providerNotFoundException3)
                    {
                        ProviderNotFoundException providerNotFoundException2 = providerNotFoundException3;
                        base.WriteError(new ErrorRecord(providerNotFoundException2.ErrorRecord, providerNotFoundException2));
                        goto Label0;
                    }
                    catch (ItemNotFoundException itemNotFoundException3)
                    {
                        ItemNotFoundException itemNotFoundException2 = itemNotFoundException3;
                        base.WriteError(new ErrorRecord(itemNotFoundException2.ErrorRecord, itemNotFoundException2));
                        goto Label0;
                    }
                    for (int j = 0; j < resolvedPSPathFromPSPath.Count; j++)
                    {
                        try
                        {
                            if (resolvedPSPathFromPSPath[j] != null)
                            {
                                base.WriteObject(resolvedPSPathFromPSPath[j].Path);
                            }
                        }
                        catch (PSNotSupportedException pSNotSupportedException5)
                        {
                            PSNotSupportedException pSNotSupportedException4 = pSNotSupportedException5;
                            base.WriteError(new ErrorRecord(pSNotSupportedException4.ErrorRecord, pSNotSupportedException4));
                        }
                        catch (DriveNotFoundException driveNotFoundException5)
                        {
                            DriveNotFoundException driveNotFoundException4 = driveNotFoundException5;
                            base.WriteError(new ErrorRecord(driveNotFoundException4.ErrorRecord, driveNotFoundException4));
                        }
                        catch (ProviderNotFoundException providerNotFoundException5)
                        {
                            ProviderNotFoundException providerNotFoundException4 = providerNotFoundException5;
                            base.WriteError(new ErrorRecord(providerNotFoundException4.ErrorRecord, providerNotFoundException4));
                        }
                        catch (ItemNotFoundException itemNotFoundException5)
                        {
                            ItemNotFoundException itemNotFoundException4 = itemNotFoundException5;
                            base.WriteError(new ErrorRecord(itemNotFoundException4.ErrorRecord, itemNotFoundException4));
                        }
                    }
                }
Label0:
                continue;
            }
        }