Code:
/ 4.0 / 4.0 / untmp / 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.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- ParseChildrenAsPropertiesAttribute.cs
- LightweightCodeGenerator.cs
- AppSettingsExpressionBuilder.cs
- TextEndOfLine.cs
- AdapterUtil.cs
- RecordManager.cs
- JsonWriter.cs
- coordinator.cs
- ListView.cs
- NavigatingCancelEventArgs.cs
- ReaderWriterLock.cs
- UriTemplateTable.cs
- ConcatQueryOperator.cs
- PageThemeCodeDomTreeGenerator.cs
- RepeaterItemEventArgs.cs
- WebBrowserNavigatedEventHandler.cs
- ToolStripDropDownClosedEventArgs.cs
- CodeTypeReferenceExpression.cs
- CollectionViewSource.cs
- HtmlShimManager.cs
- FlowLayoutSettings.cs
- SafeCancelMibChangeNotify.cs
- DataSourceXmlClassAttribute.cs
- DataGridViewCellContextMenuStripNeededEventArgs.cs
- Matrix.cs
- control.ime.cs
- PageAdapter.cs
- CategoryNameCollection.cs
- XmlConverter.cs
- TemplateManager.cs
- WebPartDisplayModeCollection.cs
- XmlAutoDetectWriter.cs
- PathHelper.cs
- Simplifier.cs
- UserPreferenceChangingEventArgs.cs
- OracleInternalConnection.cs
- HttpListenerRequest.cs
- IdnMapping.cs
- CultureInfoConverter.cs
- RemotingSurrogateSelector.cs
- DataListItemEventArgs.cs
- CurrencyManager.cs
- HttpRawResponse.cs
- StylusCollection.cs
- MetafileHeader.cs
- OleDbFactory.cs
- AllMembershipCondition.cs
- DocumentReference.cs
- SafeBitVector32.cs
- PaperSource.cs
- SQLDoubleStorage.cs
- DiscoveryClientRequestChannel.cs
- SiteMapHierarchicalDataSourceView.cs
- SubpageParagraph.cs
- StorageScalarPropertyMapping.cs
- RsaSecurityToken.cs
- IisTraceListener.cs
- XmlMemberMapping.cs
- FilterableAttribute.cs
- WebBrowserHelper.cs
- XmlEventCache.cs
- AddInProcess.cs
- AsynchronousChannel.cs
- InfoCardBaseException.cs
- DoubleUtil.cs
- metadatamappinghashervisitor.cs
- NTAccount.cs
- CompositeDataBoundControl.cs
- DataIdProcessor.cs
- RetriableClipboard.cs
- InputScopeAttribute.cs
- NumberEdit.cs
- LinkUtilities.cs
- WebPageTraceListener.cs
- DeploymentSection.cs
- ArcSegment.cs
- PopupRoot.cs
- DriveNotFoundException.cs
- coordinatorscratchpad.cs
- ConstantExpression.cs
- DocumentationServerProtocol.cs
- QuadraticBezierSegment.cs
- DetailsViewPagerRow.cs
- ObfuscationAttribute.cs
- KeyedCollection.cs
- TreeViewBindingsEditor.cs
- TrustLevelCollection.cs
- FileIOPermission.cs
- Table.cs
- NumericUpDownAcceleration.cs
- ObjectQueryState.cs
- DefaultPropertyAttribute.cs
- PackagingUtilities.cs
- AttachedPropertyBrowsableForTypeAttribute.cs
- ExportOptions.cs
- ParserHooks.cs
- DataContract.cs
- BuildManagerHost.cs
- StorageMappingItemLoader.cs
- XmlSchemaComplexContentRestriction.cs