Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / 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
- SortKey.cs
- DES.cs
- BuildManager.cs
- QueryCacheKey.cs
- ToolStripItem.cs
- ToolStripOverflowButton.cs
- ServiceEndpointCollection.cs
- PropertyDescriptorCollection.cs
- DataReaderContainer.cs
- InboundActivityHelper.cs
- Message.cs
- Pair.cs
- SqlConnectionStringBuilder.cs
- ProfilePropertySettings.cs
- PackagingUtilities.cs
- MILUtilities.cs
- XmlRawWriter.cs
- EncryptedXml.cs
- PropertyValueUIItem.cs
- CacheEntry.cs
- DrawItemEvent.cs
- AppSecurityManager.cs
- Errors.cs
- GridViewCancelEditEventArgs.cs
- Thumb.cs
- ThicknessKeyFrameCollection.cs
- FastEncoder.cs
- WebPartCloseVerb.cs
- OneToOneMappingSerializer.cs
- HtmlInputFile.cs
- linebase.cs
- UnsafeNativeMethods.cs
- RangeValidator.cs
- PassportAuthenticationEventArgs.cs
- SafeHandles.cs
- ObjectDataSource.cs
- ServiceOperationInvoker.cs
- SmtpClient.cs
- TextProperties.cs
- DataBoundControlHelper.cs
- TrackingStringDictionary.cs
- CalendarDesigner.cs
- TCEAdapterGenerator.cs
- ConfigXmlText.cs
- ADMembershipProvider.cs
- OperatingSystemVersionCheck.cs
- RolePrincipal.cs
- QilUnary.cs
- SkewTransform.cs
- WindowsSysHeader.cs
- NetCodeGroup.cs
- ContentElement.cs
- HttpListenerElement.cs
- SQLSingleStorage.cs
- Deflater.cs
- MetadataSection.cs
- TemplateEditingVerb.cs
- ButtonColumn.cs
- odbcmetadatacollectionnames.cs
- UnsafeNativeMethods.cs
- validationstate.cs
- ResourceDictionaryCollection.cs
- BaseCodePageEncoding.cs
- ReferenceTypeElement.cs
- TrustSection.cs
- NavigationWindow.cs
- TdsParserStaticMethods.cs
- SymLanguageVendor.cs
- StrongName.cs
- GenericParameterDataContract.cs
- RelatedCurrencyManager.cs
- ConnectionInterfaceCollection.cs
- EntityDataSourceWizardForm.cs
- TraceHwndHost.cs
- TextServicesContext.cs
- AnnotationHighlightLayer.cs
- CryptoConfig.cs
- GACMembershipCondition.cs
- WindowsFont.cs
- WpfGeneratedKnownTypes.cs
- SiteMapNodeItemEventArgs.cs
- OSFeature.cs
- LineServices.cs
- ControlHelper.cs
- PropertyAccessVisitor.cs
- ThemeDictionaryExtension.cs
- ExportException.cs
- COMException.cs
- ProgressBarHighlightConverter.cs
- Rect3DValueSerializer.cs
- IdleTimeoutMonitor.cs
- FormViewDeleteEventArgs.cs
- ButtonField.cs
- SineEase.cs
- ContractReference.cs
- ColumnWidthChangingEvent.cs
- GenericTypeParameterBuilder.cs
- DateTimeOffset.cs
- CmsUtils.cs
- IgnoreSection.cs