Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / 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
- Freezable.cs
- ColumnResizeAdorner.cs
- WeakKeyDictionary.cs
- WebControl.cs
- HorizontalAlignConverter.cs
- ColumnReorderedEventArgs.cs
- HighlightComponent.cs
- File.cs
- ThreadExceptionDialog.cs
- WebPartTransformer.cs
- GeometryDrawing.cs
- ManifestResourceInfo.cs
- XsltConvert.cs
- ContentFilePart.cs
- ThreadStaticAttribute.cs
- ObjectCacheHost.cs
- Grid.cs
- EndpointDiscoveryMetadata11.cs
- FixedSOMSemanticBox.cs
- LightweightCodeGenerator.cs
- CacheSection.cs
- AssemblyCache.cs
- FixedSOMContainer.cs
- Identifier.cs
- ResourceReferenceExpression.cs
- MultiSelectRootGridEntry.cs
- ExpressionHelper.cs
- GeometryValueSerializer.cs
- DataBindingHandlerAttribute.cs
- DataSvcMapFile.cs
- TraceLevelHelper.cs
- TextEditorCopyPaste.cs
- DialogDivider.cs
- Color.cs
- EnumMember.cs
- CollectionView.cs
- PropertyEmitter.cs
- AlignmentYValidation.cs
- FrameworkContextData.cs
- ControlPropertyNameConverter.cs
- ChildTable.cs
- TracedNativeMethods.cs
- EventData.cs
- unitconverter.cs
- TransportContext.cs
- LongAverageAggregationOperator.cs
- SqlServices.cs
- VisualStyleInformation.cs
- ResetableIterator.cs
- CompiledXpathExpr.cs
- DesignerImageAdapter.cs
- MarkedHighlightComponent.cs
- ResolveRequestResponseAsyncResult.cs
- XmlValidatingReaderImpl.cs
- Tokenizer.cs
- BamlCollectionHolder.cs
- SQLBoolean.cs
- PrivilegedConfigurationManager.cs
- SBCSCodePageEncoding.cs
- DomNameTable.cs
- RawStylusInputReport.cs
- bindurihelper.cs
- SignedPkcs7.cs
- DynamicMethod.cs
- NotifyIcon.cs
- ClientBuildManager.cs
- DESCryptoServiceProvider.cs
- SocketAddress.cs
- SqlMetaData.cs
- DbParameterHelper.cs
- SessionIDManager.cs
- WinFormsSpinner.cs
- ReadOnlyHierarchicalDataSourceView.cs
- HiddenFieldPageStatePersister.cs
- IsolatedStoragePermission.cs
- MsmqIntegrationInputMessage.cs
- DataGridViewRowDividerDoubleClickEventArgs.cs
- KeyTimeConverter.cs
- TableLayoutPanelResizeGlyph.cs
- PropertyGrid.cs
- XmlSchemaAnnotated.cs
- FullTextState.cs
- FilterEventArgs.cs
- XmlSchemaComplexContentRestriction.cs
- DataBindingsDialog.cs
- TextDecorationLocationValidation.cs
- OleDbParameterCollection.cs
- PaginationProgressEventArgs.cs
- DataComponentGenerator.cs
- _UncName.cs
- SyndicationSerializer.cs
- DataGridViewRowPostPaintEventArgs.cs
- HandlerMappingMemo.cs
- URLMembershipCondition.cs
- SQLByte.cs
- DateTimeOffsetStorage.cs
- BCryptNative.cs
- PerspectiveCamera.cs
- CodePrimitiveExpression.cs
- XmlMembersMapping.cs