Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / CompMod / System / ComponentModel / SyntaxCheck.cs / 1305376 / SyntaxCheck.cs
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//-----------------------------------------------------------------------------
namespace System.ComponentModel {
using System;
using System.Diagnostics;
using System.IO;
using System.Runtime.InteropServices;
using System.Security.Permissions;
///
///
/// SyntaxCheck
/// Helper class to check for path and machine name syntax.
///
[HostProtection(SharedState = true)]
public static class SyntaxCheck {
///
/// Checks the syntax of the machine name (no "\" anywhere in it).
///
///
public static bool CheckMachineName(string value) {
if (value == null)
return false;
value = value.Trim();
if (value.Equals(String.Empty))
return false;
// Machine names shouldn't contain any "\"
return (value.IndexOf('\\') == -1);
}
///
/// Checks the syntax of the path (must start with "\\").
///
///
public static bool CheckPath(string value) {
if (value == null)
return false;
value = value.Trim();
if (value.Equals(String.Empty))
return false;
// Path names should start with "\\"
return value.StartsWith("\\\\");
}
///
/// Checks the syntax of the path (must start with "\" or drive letter "C:").
/// NOTE: These denote a file or directory path!!
///
///
///
public static bool CheckRootedPath(string value) {
if (value == null)
return false;
value = value.Trim();
if (value.Equals(String.Empty))
return false;
// Is it rooted?
return Path.IsPathRooted(value);
}
}
}
// 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
- CapabilitiesSection.cs
- ChangeConflicts.cs
- BindingManagerDataErrorEventArgs.cs
- WindowsListViewItem.cs
- AppSettingsReader.cs
- RuntimeEnvironment.cs
- SamlAction.cs
- PixelFormat.cs
- HttpContext.cs
- WebBrowserDesigner.cs
- ParenthesizePropertyNameAttribute.cs
- BuildProviderCollection.cs
- CommandValueSerializer.cs
- TabItem.cs
- UniqueEventHelper.cs
- DoubleStorage.cs
- CodeIndexerExpression.cs
- Trace.cs
- GridViewDeleteEventArgs.cs
- Container.cs
- ContractsBCL.cs
- EasingQuaternionKeyFrame.cs
- CngAlgorithmGroup.cs
- DbConnectionPool.cs
- ComplexTypeEmitter.cs
- EventMappingSettings.cs
- CompilerTypeWithParams.cs
- DataKeyArray.cs
- DataGridViewColumn.cs
- AnnotationHighlightLayer.cs
- TextCompositionEventArgs.cs
- AnnotationHelper.cs
- SchemaLookupTable.cs
- GetCardDetailsRequest.cs
- ScaleTransform.cs
- ScrollBar.cs
- SoapCodeExporter.cs
- SaveFileDialog.cs
- ComProxy.cs
- _Win32.cs
- webeventbuffer.cs
- EditorPartChrome.cs
- CssStyleCollection.cs
- CrossAppDomainChannel.cs
- BrowserCapabilitiesFactoryBase.cs
- CanonicalFontFamilyReference.cs
- MoveSizeWinEventHandler.cs
- StrongNameMembershipCondition.cs
- Span.cs
- SetIterators.cs
- MatrixTransform.cs
- Buffer.cs
- MergeLocalizationDirectives.cs
- MetadataSerializer.cs
- TrackingServices.cs
- DataPagerCommandEventArgs.cs
- WebServiceEndpoint.cs
- PropertyContainer.cs
- ResponseBodyWriter.cs
- ConfigurationStrings.cs
- Membership.cs
- Int32KeyFrameCollection.cs
- BindingContext.cs
- AuthenticationServiceManager.cs
- DelegateHelpers.Generated.cs
- AttributedMetaModel.cs
- SizeChangedInfo.cs
- BulletDecorator.cs
- TextEditorThreadLocalStore.cs
- SiteMap.cs
- XmlImplementation.cs
- HttpModuleCollection.cs
- ContextMenuAutomationPeer.cs
- Listbox.cs
- SendMailErrorEventArgs.cs
- NotConverter.cs
- AttributeSetAction.cs
- ActionMessageFilterTable.cs
- ScriptingRoleServiceSection.cs
- CodeMethodInvokeExpression.cs
- StagingAreaInputItem.cs
- FileLogRecordEnumerator.cs
- SafeRightsManagementHandle.cs
- ProcessModelSection.cs
- EditingCoordinator.cs
- DateTimeFormatInfo.cs
- DBNull.cs
- RootBuilder.cs
- SchemaSetCompiler.cs
- SystemIPGlobalProperties.cs
- _NestedSingleAsyncResult.cs
- ButtonBaseAutomationPeer.cs
- Exception.cs
- DrawingGroup.cs
- InternalsVisibleToAttribute.cs
- CommandPlan.cs
- SqlProcedureAttribute.cs
- SocketException.cs
- DropSource.cs
- Trace.cs