Tmx.TmxProvider.NewDrive C# (CSharp) Method

NewDrive() protected method

protected NewDrive ( System.Management.Automation.PSDriveInfo drive ) : System.Management.Automation.PSDriveInfo
drive System.Management.Automation.PSDriveInfo
return System.Management.Automation.PSDriveInfo
        protected override PSDriveInfo NewDrive(PSDriveInfo drive)
        {
            try{
            
                string id = string.Empty;
                string name = string.Empty;
            
                WriteVerbose("TmxProvider::NewDrive()");
                var dynamicParameters = DynamicParameters as RuntimeDefinedParameterDictionary;
                try{ id = dynamicParameters["Id"].Value.ToString(); } 
                catch (Exception) {
                    // nothing to report
                    // there might not be a parameter
                }
                try{name = dynamicParameters["Name"].Value.ToString();} 
                catch (Exception) {
                    // nothing to report
                    // there might not be a parameter
                }
                if (id.Length > 0) {
                    return new TmxDriveInfo(id, drive);
                } else if (name.Length > 0) {
                    return new TmxDriveInfo(name, drive);
                } else {
                    return new TmxDriveInfo(drive);
                }
            }
            catch (Exception e) {
                WriteVerbose(e.Message);
                WriteVerbose("TmxProvider::NewDrive()");
                return null;
            }
        }