Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / Services / Web / System / Web / Services / Discovery / DynamicPhysicalDiscoSearcher.cs / 1305376 / DynamicPhysicalDiscoSearcher.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Web.Services.Discovery { using System; using System.IO; using System.Collections; using System.Web; using System.Web.Caching; using System.Diagnostics; using System.Text; using System.DirectoryServices; using System.Web.Services.Configuration; using System.ComponentModel; ////// /// Does a recursive search of virtual subdirectories to find stuff to /// make a disco file from. *.disco files (or whatever the PrimarySearchPattern is) are /// treated as end-points - recursion stops where they are found. /// internal class DynamicPhysicalDiscoSearcher : DynamicDiscoSearcher { private string startDir; internal DynamicPhysicalDiscoSearcher(string searchDir, string[] excludedUrls, string startUrl) : base(excludedUrls) { startDir = searchDir; origUrl = startUrl; } // ------------------------------------------------------------------------------- internal override void Search(string fileToSkipAtBegin) { SearchInit(fileToSkipAtBegin); ScanDirectory( startDir ); } // ------------------------------------------------------------------------------- // Look in iven directory for subdirectories, feasable for further searching. protected override void SearchSubDirectories(string localDir) { DirectoryInfo dir = new DirectoryInfo(localDir); if (!dir.Exists) return; DirectoryInfo[] subDirs = dir.GetDirectories(); foreach (DirectoryInfo subDir in subDirs) { if (subDir.Name == "." || subDir.Name == ".." ) { continue; } ScanDirectory( localDir + '\\' + subDir.Name ); } } // -------------------------------------------------------------------------------- protected override DirectoryInfo GetPhysicalDir(string dir ) { if ( !Directory.Exists(dir) ) return null; DirectoryInfo directory = new DirectoryInfo(dir); if ( !directory.Exists ) return null; if( 0 != (directory.Attributes & (FileAttributes.Hidden | FileAttributes.System | FileAttributes.Temporary))) { return null; } return directory; } // ------------------------------------------------------------------------------- // Makes result URL found file path from diectory name and short file name. protected override string MakeResultPath(string dirName, string fileName) { string res = origUrl + dirName.Substring(startDir.Length, dirName.Length - startDir.Length).Replace('\\','/') + '/' + fileName; return res; } // -------------------------------------------------------------------------------- // Makes exclusion path absolute for quick comparision on search. protected override string MakeAbsExcludedPath(string pathRelativ) { return startDir + '\\' + pathRelativ.Replace('/', '\\' ); } // -------------------------------------------------------------------------------- protected override bool IsVirtualSearch { get { return false; } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Web.Services.Discovery { using System; using System.IO; using System.Collections; using System.Web; using System.Web.Caching; using System.Diagnostics; using System.Text; using System.DirectoryServices; using System.Web.Services.Configuration; using System.ComponentModel; ////// /// Does a recursive search of virtual subdirectories to find stuff to /// make a disco file from. *.disco files (or whatever the PrimarySearchPattern is) are /// treated as end-points - recursion stops where they are found. /// internal class DynamicPhysicalDiscoSearcher : DynamicDiscoSearcher { private string startDir; internal DynamicPhysicalDiscoSearcher(string searchDir, string[] excludedUrls, string startUrl) : base(excludedUrls) { startDir = searchDir; origUrl = startUrl; } // ------------------------------------------------------------------------------- internal override void Search(string fileToSkipAtBegin) { SearchInit(fileToSkipAtBegin); ScanDirectory( startDir ); } // ------------------------------------------------------------------------------- // Look in iven directory for subdirectories, feasable for further searching. protected override void SearchSubDirectories(string localDir) { DirectoryInfo dir = new DirectoryInfo(localDir); if (!dir.Exists) return; DirectoryInfo[] subDirs = dir.GetDirectories(); foreach (DirectoryInfo subDir in subDirs) { if (subDir.Name == "." || subDir.Name == ".." ) { continue; } ScanDirectory( localDir + '\\' + subDir.Name ); } } // -------------------------------------------------------------------------------- protected override DirectoryInfo GetPhysicalDir(string dir ) { if ( !Directory.Exists(dir) ) return null; DirectoryInfo directory = new DirectoryInfo(dir); if ( !directory.Exists ) return null; if( 0 != (directory.Attributes & (FileAttributes.Hidden | FileAttributes.System | FileAttributes.Temporary))) { return null; } return directory; } // ------------------------------------------------------------------------------- // Makes result URL found file path from diectory name and short file name. protected override string MakeResultPath(string dirName, string fileName) { string res = origUrl + dirName.Substring(startDir.Length, dirName.Length - startDir.Length).Replace('\\','/') + '/' + fileName; return res; } // -------------------------------------------------------------------------------- // Makes exclusion path absolute for quick comparision on search. protected override string MakeAbsExcludedPath(string pathRelativ) { return startDir + '\\' + pathRelativ.Replace('/', '\\' ); } // -------------------------------------------------------------------------------- protected override bool IsVirtualSearch { get { return false; } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- GenericUriParser.cs
- DeviceFiltersSection.cs
- CollectionViewSource.cs
- WindowsStreamSecurityElement.cs
- GlobalEventManager.cs
- Point3DCollectionValueSerializer.cs
- SingleKeyFrameCollection.cs
- DtrList.cs
- SqlFormatter.cs
- DynamicPropertyHolder.cs
- SimpleLine.cs
- InputLanguageSource.cs
- DataControlCommands.cs
- ExecutionEngineException.cs
- Exceptions.cs
- SafeRightsManagementQueryHandle.cs
- Msec.cs
- MasterPage.cs
- XMLDiffLoader.cs
- ClientCredentialsElement.cs
- _HeaderInfoTable.cs
- Line.cs
- HttpWebRequestElement.cs
- NumberEdit.cs
- PointAnimationUsingKeyFrames.cs
- XmlSchemaElement.cs
- FigureHelper.cs
- ToolStripSystemRenderer.cs
- DynamicMethod.cs
- XmlBinaryReader.cs
- TemplatedMailWebEventProvider.cs
- XmlIterators.cs
- EntityContainer.cs
- SourceSwitch.cs
- ExpressionPrefixAttribute.cs
- BasicExpandProvider.cs
- TextCollapsingProperties.cs
- BamlVersionHeader.cs
- CompoundFileDeflateTransform.cs
- CodeSubDirectoriesCollection.cs
- XmlSchemaSimpleContent.cs
- NativeStructs.cs
- Compiler.cs
- SqlCommandSet.cs
- UnsafeNativeMethods.cs
- DataTableClearEvent.cs
- Size3D.cs
- BlobPersonalizationState.cs
- DriveNotFoundException.cs
- WebAdminConfigurationHelper.cs
- ListenerElementsCollection.cs
- ArrayList.cs
- DatasetMethodGenerator.cs
- SkinBuilder.cs
- GetTokenRequest.cs
- TextEditorDragDrop.cs
- XmlAnyAttributeAttribute.cs
- UTF32Encoding.cs
- EnterpriseServicesHelper.cs
- BitmapPalettes.cs
- MessageSmuggler.cs
- Errors.cs
- FlowDocumentScrollViewerAutomationPeer.cs
- RadialGradientBrush.cs
- InheritanceAttribute.cs
- UserControlParser.cs
- JournalEntryListConverter.cs
- WebSysDescriptionAttribute.cs
- CodeAttributeArgumentCollection.cs
- ComplexObject.cs
- DataSourceView.cs
- ItemList.cs
- DiagnosticsElement.cs
- DataTableReader.cs
- NullableConverter.cs
- AssemblyInfo.cs
- TemplatedControlDesigner.cs
- Package.cs
- DataTableCollection.cs
- UTF32Encoding.cs
- DeploymentSection.cs
- HttpServerVarsCollection.cs
- PrivilegeNotHeldException.cs
- UInt64.cs
- ZipQueryOperator.cs
- Stream.cs
- BitmapEffectvisualstate.cs
- Configuration.cs
- PaintValueEventArgs.cs
- Logging.cs
- UnauthorizedAccessException.cs
- OciLobLocator.cs
- CallbackValidator.cs
- AssemblyBuilder.cs
- BaseTreeIterator.cs
- FileDialog.cs
- Mappings.cs
- XmlLanguageConverter.cs
- StreamingContext.cs
- HtmlTableRowCollection.cs