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
- Pair.cs
- DbCommandDefinition.cs
- DESCryptoServiceProvider.cs
- EncryptedType.cs
- ComponentEvent.cs
- ConfigUtil.cs
- FirstMatchCodeGroup.cs
- BamlCollectionHolder.cs
- HostUtils.cs
- CollectionType.cs
- MouseOverProperty.cs
- Site.cs
- HandledEventArgs.cs
- ButtonBase.cs
- PartialTrustVisibleAssembly.cs
- BmpBitmapDecoder.cs
- ColumnMap.cs
- GridViewRow.cs
- ListSortDescription.cs
- EntityKey.cs
- SequentialOutput.cs
- Decimal.cs
- DataObject.cs
- PenContexts.cs
- WindowsToolbarAsMenu.cs
- CommonDialog.cs
- TableLayoutRowStyleCollection.cs
- PackageRelationshipCollection.cs
- RecognizedWordUnit.cs
- Error.cs
- NativeCppClassAttribute.cs
- InvariantComparer.cs
- SynchronizationLockException.cs
- MimePart.cs
- TextRangeEditTables.cs
- StandardOleMarshalObject.cs
- DataPagerFieldCommandEventArgs.cs
- ClassicBorderDecorator.cs
- StrokeSerializer.cs
- SafeFileMappingHandle.cs
- TreeNodeStyleCollection.cs
- InternalPermissions.cs
- DependencyProperty.cs
- NavigateEvent.cs
- ExpressionPrefixAttribute.cs
- _AutoWebProxyScriptEngine.cs
- SqlBinder.cs
- ResourceAttributes.cs
- _SslState.cs
- XmlSchemaIdentityConstraint.cs
- RtfNavigator.cs
- CodeTypeConstructor.cs
- CodeNamespaceImportCollection.cs
- UrlParameterWriter.cs
- _ShellExpression.cs
- SecUtil.cs
- MethodBuilderInstantiation.cs
- RuntimeIdentifierPropertyAttribute.cs
- FunctionQuery.cs
- XPathException.cs
- MSAANativeProvider.cs
- UrlMappingsModule.cs
- RefExpr.cs
- MsmqProcessProtocolHandler.cs
- SqlCommandSet.cs
- QueryExpr.cs
- WebPartConnectVerb.cs
- SiteMapSection.cs
- MachineKeySection.cs
- PersonalizationProvider.cs
- SortableBindingList.cs
- Compiler.cs
- ObjectView.cs
- ChineseLunisolarCalendar.cs
- ProviderIncompatibleException.cs
- DataTablePropertyDescriptor.cs
- InteropTrackingRecord.cs
- Sorting.cs
- TreeViewEvent.cs
- CheckableControlBaseAdapter.cs
- MetadataUtilsSmi.cs
- ToolStripItemRenderEventArgs.cs
- XmlTextReaderImpl.cs
- SymmetricAlgorithm.cs
- BamlBinaryReader.cs
- PropertyOverridesDialog.cs
- MessageHeaderDescriptionCollection.cs
- BamlLocalizableResourceKey.cs
- LingerOption.cs
- Splitter.cs
- ZipIOZip64EndOfCentralDirectoryLocatorBlock.cs
- RadioButtonAutomationPeer.cs
- ListMarkerSourceInfo.cs
- StructuralCache.cs
- AtomPub10ServiceDocumentFormatter.cs
- TreeNodeStyle.cs
- StyleHelper.cs
- TransformedBitmap.cs
- DataGridViewHitTestInfo.cs
- StringOutput.cs