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
- SerialReceived.cs
- ConcurrentDictionary.cs
- ListSortDescriptionCollection.cs
- ChildDocumentBlock.cs
- EditableTreeList.cs
- FileDialog_Vista_Interop.cs
- AuthStoreRoleProvider.cs
- MatrixTransform3D.cs
- RadioButtonPopupAdapter.cs
- SystemNetworkInterface.cs
- TrackingServices.cs
- SqlBuilder.cs
- FloaterParagraph.cs
- NumberFormatter.cs
- JpegBitmapEncoder.cs
- WinEventQueueItem.cs
- XmlDigitalSignatureProcessor.cs
- CodeDomSerializationProvider.cs
- ServiceNameCollection.cs
- WebPartHeaderCloseVerb.cs
- XmlQueryContext.cs
- MemberJoinTreeNode.cs
- Matrix3D.cs
- ClientConfigurationSystem.cs
- IList.cs
- SimpleBitVector32.cs
- Bidi.cs
- SqlXml.cs
- TypeUtils.cs
- CompositeTypefaceMetrics.cs
- ExpressionBuilderCollection.cs
- DocumentEventArgs.cs
- XmlSchemaComplexContent.cs
- _ScatterGatherBuffers.cs
- ToolStripLabel.cs
- LinqDataSourceInsertEventArgs.cs
- EUCJPEncoding.cs
- UnauthorizedAccessException.cs
- OdbcException.cs
- SoapObjectWriter.cs
- MetaModel.cs
- PrintController.cs
- ModelItemDictionary.cs
- NetPeerTcpBinding.cs
- UserValidatedEventArgs.cs
- RectAnimationUsingKeyFrames.cs
- Compiler.cs
- PictureBox.cs
- ContextMenuAutomationPeer.cs
- SqlInternalConnectionTds.cs
- CollectionViewGroup.cs
- RuntimeConfig.cs
- HtmlShimManager.cs
- EdmValidator.cs
- DrawingAttributeSerializer.cs
- RemoteWebConfigurationHostStream.cs
- DBNull.cs
- WebPartDisplayModeCollection.cs
- Focus.cs
- HuffCodec.cs
- DbProviderSpecificTypePropertyAttribute.cs
- TcpClientCredentialType.cs
- SequenceQuery.cs
- SiteMapDataSourceView.cs
- ParentQuery.cs
- ObjectListGeneralPage.cs
- AdvancedBindingEditor.cs
- PasswordDeriveBytes.cs
- BoundingRectTracker.cs
- MessageUtil.cs
- IPipelineRuntime.cs
- Parser.cs
- SecurityKeyType.cs
- DBConnectionString.cs
- SecurityState.cs
- Column.cs
- ParallelTimeline.cs
- ObjectDataSourceDisposingEventArgs.cs
- Border.cs
- ObjectViewListener.cs
- ListViewDeletedEventArgs.cs
- SspiSafeHandles.cs
- IndicFontClient.cs
- XsltOutput.cs
- MouseGesture.cs
- WebPartRestoreVerb.cs
- DependencyPropertyAttribute.cs
- UserNameSecurityTokenAuthenticator.cs
- ConstantCheck.cs
- TransformerInfo.cs
- X509Certificate.cs
- Signature.cs
- StackSpiller.Temps.cs
- CompareInfo.cs
- FormsAuthenticationUser.cs
- Axis.cs
- ControlValuePropertyAttribute.cs
- UdpChannelFactory.cs
- WebServiceData.cs
- CodeDesigner.cs