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
- WebBrowserDesigner.cs
- shaperfactory.cs
- ParseHttpDate.cs
- HttpStreams.cs
- ApplicationManager.cs
- StorageEntityTypeMapping.cs
- PolicyUnit.cs
- VarRefManager.cs
- FactoryGenerator.cs
- DataObject.cs
- FastPropertyAccessor.cs
- WinFormsUtils.cs
- MailDefinition.cs
- CellCreator.cs
- DataViewListener.cs
- MultiSelectRootGridEntry.cs
- NetworkInterface.cs
- PartialCachingControl.cs
- IPHostEntry.cs
- ToolStripSeparatorRenderEventArgs.cs
- Scheduler.cs
- dtdvalidator.cs
- SendMailErrorEventArgs.cs
- StringSorter.cs
- SharedDp.cs
- ViewEvent.cs
- safex509handles.cs
- WmpBitmapEncoder.cs
- ConfigurationSectionGroupCollection.cs
- UserControl.cs
- DataObjectAttribute.cs
- Site.cs
- ToolStripItemCollection.cs
- CommandManager.cs
- ConfigurationProperty.cs
- ServiceInfo.cs
- TextFormatterHost.cs
- SystemUnicastIPAddressInformation.cs
- MobileFormsAuthentication.cs
- DataGridColumnDropSeparator.cs
- DataGridView.cs
- TextReader.cs
- Rotation3D.cs
- ToolStripContentPanel.cs
- FontCacheUtil.cs
- ImageList.cs
- ServiceModelConfigurationSectionGroup.cs
- smtpconnection.cs
- MultipleViewProviderWrapper.cs
- NavigationService.cs
- WebConfigurationHost.cs
- ResourcesBuildProvider.cs
- UIntPtr.cs
- PositiveTimeSpanValidatorAttribute.cs
- TabletDeviceInfo.cs
- BitmapSource.cs
- EventLogTraceListener.cs
- DateTimeConstantAttribute.cs
- WorkItem.cs
- PrintEvent.cs
- WSSecurityOneDotOneReceiveSecurityHeader.cs
- InternalPermissions.cs
- WindowsFormsHelpers.cs
- PinProtectionHelper.cs
- DocumentationServerProtocol.cs
- TagMapInfo.cs
- RowBinding.cs
- shaperfactoryquerycacheentry.cs
- TypeCacheManager.cs
- ListChangedEventArgs.cs
- EntityTypeEmitter.cs
- UndirectedGraph.cs
- EntityDataSourceWrapper.cs
- DispatcherTimer.cs
- BitmapVisualManager.cs
- MenuItem.cs
- AspNetHostingPermission.cs
- ConvertEvent.cs
- DesignSurfaceServiceContainer.cs
- CustomAttributeSerializer.cs
- PageClientProxyGenerator.cs
- ErrorRuntimeConfig.cs
- Keywords.cs
- CodeAttachEventStatement.cs
- EmptyElement.cs
- CheckBox.cs
- WebBrowsableAttribute.cs
- ZipPackagePart.cs
- PermissionToken.cs
- TypeDescriptorFilterService.cs
- HttpSysSettings.cs
- XmlArrayItemAttributes.cs
- SamlConditions.cs
- TimeSpanSecondsConverter.cs
- WebPartEditorOkVerb.cs
- Adorner.cs
- BindingExpressionBase.cs
- DrawingVisualDrawingContext.cs
- ConfigXmlComment.cs
- DataControlButton.cs