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
- ToolStripItemEventArgs.cs
- IdentityModelDictionary.cs
- DataTableNewRowEvent.cs
- CompensatableTransactionScopeActivity.cs
- _TransmitFileOverlappedAsyncResult.cs
- InputProviderSite.cs
- ToolStripContainerActionList.cs
- ObjectStateManagerMetadata.cs
- IBuiltInEvidence.cs
- PartialToken.cs
- DictionaryManager.cs
- EnvironmentPermission.cs
- XPathParser.cs
- DataViewSettingCollection.cs
- DispatcherEventArgs.cs
- ThousandthOfEmRealPoints.cs
- ISAPIWorkerRequest.cs
- TextTreeFixupNode.cs
- SoapAttributeOverrides.cs
- IERequestCache.cs
- AssertUtility.cs
- AssemblyName.cs
- ResourcesBuildProvider.cs
- KnownBoxes.cs
- XmlReturnWriter.cs
- XPathScanner.cs
- ThreadLocal.cs
- DataSetMappper.cs
- ClassValidator.cs
- TableDetailsRow.cs
- Shape.cs
- TreeBuilderBamlTranslator.cs
- SQLBytesStorage.cs
- DataRowCollection.cs
- ViewStateException.cs
- ConfigurationSchemaErrors.cs
- PropertyFilterAttribute.cs
- SafePipeHandle.cs
- StrokeSerializer.cs
- WindowsClientElement.cs
- _ScatterGatherBuffers.cs
- ListView.cs
- ToolStripOverflowButton.cs
- SimpleTextLine.cs
- FontFamily.cs
- ReadOnlyDataSourceView.cs
- SecurityToken.cs
- OracleCommand.cs
- ImageMapEventArgs.cs
- FormsAuthenticationUserCollection.cs
- OdbcHandle.cs
- WebHostedComPlusServiceHost.cs
- Symbol.cs
- Simplifier.cs
- ISFTagAndGuidCache.cs
- CalculatedColumn.cs
- SqlClientFactory.cs
- TextBoxDesigner.cs
- HwndProxyElementProvider.cs
- TableItemStyle.cs
- FixedTextContainer.cs
- PeerNearMe.cs
- Variant.cs
- ArraySortHelper.cs
- SR.cs
- ColumnResult.cs
- Models.cs
- HTMLTagNameToTypeMapper.cs
- PingReply.cs
- DataServiceHostFactory.cs
- FixedDocumentSequencePaginator.cs
- PointCollection.cs
- BindStream.cs
- TdsParserStaticMethods.cs
- SiteMapHierarchicalDataSourceView.cs
- DropTarget.cs
- AmbientValueAttribute.cs
- NetSectionGroup.cs
- Point.cs
- MailAddressCollection.cs
- NullEntityWrapper.cs
- NativeMethods.cs
- PolyLineSegment.cs
- LinqDataSourceValidationException.cs
- Msmq.cs
- QuaternionRotation3D.cs
- LogReservationCollection.cs
- DataBindingCollection.cs
- ApplyImportsAction.cs
- ResourceDescriptionAttribute.cs
- ListItemConverter.cs
- WebEvents.cs
- HttpProfileGroupBase.cs
- XamlFigureLengthSerializer.cs
- PhysicalOps.cs
- BaseDataListComponentEditor.cs
- BrowserCapabilitiesCodeGenerator.cs
- ConnectionManagementElementCollection.cs
- ToolStripRenderEventArgs.cs
- WsatRegistrationHeader.cs