Code:
/ DotNET / DotNET / 8.0 / untmp / whidbey / REDBITS / 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); } } }
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- SplayTreeNode.cs
- LoginUtil.cs
- DesignerOptions.cs
- SecurityException.cs
- StatusBarItem.cs
- PageAdapter.cs
- FilteredAttributeCollection.cs
- URLMembershipCondition.cs
- Window.cs
- ScriptResourceDefinition.cs
- CompilerError.cs
- IdnElement.cs
- StylusEventArgs.cs
- ConfigurationValues.cs
- TableStyle.cs
- BufferBuilder.cs
- Scheduling.cs
- ListParaClient.cs
- AccessKeyManager.cs
- XmlSignatureManifest.cs
- ExceptionHandlerDesigner.cs
- XmlSchemaSet.cs
- RenamedEventArgs.cs
- InstanceHandle.cs
- SQLInt32Storage.cs
- TextBlockAutomationPeer.cs
- HebrewNumber.cs
- RestClientProxyHandler.cs
- PropertyDescriptorCollection.cs
- ReferenceService.cs
- CursorConverter.cs
- ConfigurationSectionCollection.cs
- DataGridSortCommandEventArgs.cs
- ActivityTypeCodeDomSerializer.cs
- CultureTableRecord.cs
- SecurityHelper.cs
- AnimationException.cs
- AssociatedControlConverter.cs
- DataControlField.cs
- GeometryHitTestParameters.cs
- _SslStream.cs
- IntAverageAggregationOperator.cs
- IODescriptionAttribute.cs
- ConfigsHelper.cs
- ScriptingRoleServiceSection.cs
- ObjectToIdCache.cs
- TokenizerHelper.cs
- DatatypeImplementation.cs
- PersonalizationStateInfoCollection.cs
- SuppressMergeCheckAttribute.cs
- ReachBasicContext.cs
- ByteStreamBufferedMessageData.cs
- HttpHostedTransportConfiguration.cs
- SecurityUtils.cs
- NGCPageContentCollectionSerializerAsync.cs
- WebServiceEnumData.cs
- SoapServerMessage.cs
- BoundingRectTracker.cs
- IconConverter.cs
- InternalResources.cs
- MissingMemberException.cs
- ControlAdapter.cs
- FormViewPagerRow.cs
- EntityTransaction.cs
- DocumentXmlWriter.cs
- SqlDataSourceStatusEventArgs.cs
- PersonalizableAttribute.cs
- Math.cs
- XPathBuilder.cs
- ColorConvertedBitmapExtension.cs
- SafeFileMappingHandle.cs
- ReferentialConstraint.cs
- AsymmetricSignatureDeformatter.cs
- UserInitiatedNavigationPermission.cs
- ContentElement.cs
- BehaviorService.cs
- FormsAuthenticationEventArgs.cs
- XhtmlBasicLabelAdapter.cs
- ProcessHostFactoryHelper.cs
- TraceSection.cs
- WebContext.cs
- SafeNativeMethods.cs
- ServiceDeploymentInfo.cs
- SafeRegistryKey.cs
- MarkupWriter.cs
- ConfigXmlCDataSection.cs
- ScaleTransform.cs
- WsatConfiguration.cs
- XmlNavigatorFilter.cs
- EventListener.cs
- UnorderedHashRepartitionStream.cs
- InternalSafeNativeMethods.cs
- ScrollItemPatternIdentifiers.cs
- TransactionContext.cs
- ConfigXmlText.cs
- Model3DGroup.cs
- SqlMethodTransformer.cs
- CachedPathData.cs
- StringReader.cs
- ProfileService.cs