Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / ndp / fx / src / CompMod / System / ComponentModel / SyntaxCheck.cs / 1 / 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. //------------------------------------------------------------------------------ // // 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
- ViewCellRelation.cs
- FullTextState.cs
- TextTreeNode.cs
- DesignerActionService.cs
- ToolStripDropDown.cs
- JumpTask.cs
- Int16KeyFrameCollection.cs
- SafeWaitHandle.cs
- ScaleTransform.cs
- DecimalAnimation.cs
- BamlLocalizerErrorNotifyEventArgs.cs
- WebConfigurationHostFileChange.cs
- CodeObject.cs
- SafeCertificateStore.cs
- CatalogPartCollection.cs
- EasingKeyFrames.cs
- OptimalBreakSession.cs
- ConvertEvent.cs
- ListViewGroup.cs
- TableLayoutColumnStyleCollection.cs
- CryptoProvider.cs
- _ContextAwareResult.cs
- DataGridViewRowHeaderCell.cs
- DataTableMappingCollection.cs
- TdsParserSafeHandles.cs
- CatalogZoneDesigner.cs
- WebPartPersonalization.cs
- EntityDataSourceWizardForm.cs
- BinaryWriter.cs
- RemoteWebConfigurationHostStream.cs
- DataGridViewTextBoxCell.cs
- OperatingSystem.cs
- OdbcTransaction.cs
- AsyncOperation.cs
- SaveLedgerEntryRequest.cs
- Triangle.cs
- MarkupCompiler.cs
- FixUpCollection.cs
- Geometry3D.cs
- TextContainerChangeEventArgs.cs
- ItemChangedEventArgs.cs
- ComponentSerializationService.cs
- ObjectIDGenerator.cs
- ConnectionManagementElementCollection.cs
- DefaultTraceListener.cs
- PrimitiveDataContract.cs
- RoutedEvent.cs
- LinqMaximalSubtreeNominator.cs
- ObjectFactoryCodeDomTreeGenerator.cs
- HttpStreamMessageEncoderFactory.cs
- StringExpressionSet.cs
- PriorityBinding.cs
- SerializationUtility.cs
- Floater.cs
- FastEncoderWindow.cs
- TableItemPatternIdentifiers.cs
- VolatileEnlistmentState.cs
- ToolStripContextMenu.cs
- WebErrorHandler.cs
- AttachedPropertyMethodSelector.cs
- RelativeSource.cs
- ColorTranslator.cs
- ConnectionsZone.cs
- HtmlInputHidden.cs
- XsdDateTime.cs
- SQLMembershipProvider.cs
- PasswordBox.cs
- SystemWebSectionGroup.cs
- InstancePersistenceCommandException.cs
- PropertyFilter.cs
- OleCmdHelper.cs
- Lookup.cs
- WebServiceData.cs
- BitFlagsGenerator.cs
- RefType.cs
- SqlDataSourceQuery.cs
- SystemWebCachingSectionGroup.cs
- XmlChildEnumerator.cs
- ImageAnimator.cs
- XmlQueryStaticData.cs
- CharUnicodeInfo.cs
- XmlIncludeAttribute.cs
- PtsHelper.cs
- HebrewNumber.cs
- Inline.cs
- Rectangle.cs
- DataGridViewColumnConverter.cs
- DiagnosticsConfiguration.cs
- EmptyStringExpandableObjectConverter.cs
- ScriptResourceAttribute.cs
- NativeDirectoryServicesQueryAPIs.cs
- PolyLineSegment.cs
- PropertyRef.cs
- OracleConnection.cs
- UriTemplateVariableQueryValue.cs
- DescendantOverDescendantQuery.cs
- SqlWorkflowPersistenceService.cs
- BuildManager.cs
- RegistrationServices.cs
- ModuleElement.cs