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
- HttpModuleAction.cs
- ContentOperations.cs
- XmlCharacterData.cs
- XamlClipboardData.cs
- ChangeBlockUndoRecord.cs
- View.cs
- StylusShape.cs
- HashAlgorithm.cs
- PostBackOptions.cs
- RectKeyFrameCollection.cs
- CursorConverter.cs
- DataTableMappingCollection.cs
- ImageSourceTypeConverter.cs
- SR.cs
- PresentationSource.cs
- DataGridCellEditEndingEventArgs.cs
- Win32.cs
- odbcmetadatacollectionnames.cs
- TextEffectResolver.cs
- DiscoveryVersionConverter.cs
- FixedSOMPageConstructor.cs
- EarlyBoundInfo.cs
- Preprocessor.cs
- XmlSchemaGroup.cs
- GridItemPattern.cs
- DateTimeFormatInfoScanner.cs
- MultiTouchSystemGestureLogic.cs
- DefaultIfEmptyQueryOperator.cs
- DataGridCaption.cs
- XslVisitor.cs
- CoTaskMemHandle.cs
- ModuleBuilderData.cs
- FormViewDeleteEventArgs.cs
- CodeFieldReferenceExpression.cs
- SqlConnectionHelper.cs
- VirtualizingPanel.cs
- IdentityReference.cs
- ViewLoader.cs
- RequestStatusBarUpdateEventArgs.cs
- SynchronizationValidator.cs
- DeferrableContentConverter.cs
- EntityDesignerBuildProvider.cs
- XmlCustomFormatter.cs
- MonthChangedEventArgs.cs
- PtsContext.cs
- returneventsaver.cs
- AudioFileOut.cs
- Parallel.cs
- OdbcHandle.cs
- Internal.cs
- ToolStripItemCollection.cs
- StaticFileHandler.cs
- ActivityExecutorDelegateInfo.cs
- Timer.cs
- IndexObject.cs
- RtfControls.cs
- RegexNode.cs
- WebPartDisplayModeCollection.cs
- BitmapImage.cs
- TypeGeneratedEventArgs.cs
- VersionedStream.cs
- HttpCachePolicyWrapper.cs
- OutputCacheSection.cs
- ReadOnlyPropertyMetadata.cs
- Walker.cs
- BuildProviderInstallComponent.cs
- DrawingContextWalker.cs
- ObjectQueryExecutionPlan.cs
- SmtpCommands.cs
- BooleanAnimationBase.cs
- PropertyGroupDescription.cs
- DrawingAttributesDefaultValueFactory.cs
- SynchronizedInputAdaptor.cs
- SrgsElementFactory.cs
- MetadataReference.cs
- IBuiltInEvidence.cs
- ResourcePermissionBase.cs
- XPathItem.cs
- RoutedEventValueSerializer.cs
- ConfigurationValue.cs
- SerTrace.cs
- SqlGatherConsumedAliases.cs
- DropSource.cs
- ItemsPresenter.cs
- EnumMemberAttribute.cs
- ScrollableControlDesigner.cs
- SqlAliaser.cs
- SecuritySessionSecurityTokenAuthenticator.cs
- RSAOAEPKeyExchangeDeformatter.cs
- CurrencyWrapper.cs
- Freezable.cs
- Timer.cs
- KnownBoxes.cs
- IntersectQueryOperator.cs
- EventDescriptor.cs
- ListBase.cs
- Context.cs
- SafeLocalMemHandle.cs
- AssociationTypeEmitter.cs
- FormView.cs